/* macOS Big Sur 风格前台样式 - 毛玻璃效果 + 蓝白色调 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #007AFF;
    --primary-blue-hover: #0051D5;
    --bg-gradient-start: #E3F2FD;
    --bg-gradient-mid: #BBDEFB;
    --bg-gradient-end: #90CAF9;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.18);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background: #F2F1F4;
    min-height: 100vh;
    color: var(--text-primary);
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 公告栏 - 深色背景 */
.announcement-bar {
    background: rgba(28, 28, 30, 0.95);
    color: white;
    padding: 12px 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.announcement-content {
    white-space: nowrap;
    animation: scroll-left 20s linear infinite;
    padding-left: 100%;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 80px auto 40px;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* 顶部导航 - 漂浮卡片效果 */
.header {
    background: white;
    border-radius: 20px;
    padding: 28px 36px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 按钮样式 - macOS 风格 */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #d1d1d6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* 商品容器 */
.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* 商品卡片 - 漂浮效果 */
.product-card {
    background: white;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.product-card h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.product-stock {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
}

.product-stock.out-of-stock {
    color: #FF3B30;
}

/* 库存进度条 */
.stock-progress {
    width: 100%;
    height: 8px;
    background: #E5E5EA;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.stock-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

/* 库存充足 (>45) - 绿色 */
.stock-high {
    background: linear-gradient(90deg, #34C759 0%, #30D158 100%);
}

/* 库存中等 (16-45) - 橙色 */
.stock-medium {
    background: linear-gradient(90deg, #FF9500 0%, #FF9F0A 100%);
}

/* 库存不足 (1-15) - 红色 */
.stock-low {
    background: linear-gradient(90deg, #FF3B30 0%, #FF453A 100%);
}

/* 库存为0 - 灰色 */
.stock-empty {
    background: #E5E5EA;
}

.product-card button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 12px;
}

/* 模态框 - 毛玻璃效果 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 36px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 认证表单 */
.auth-modal {
    max-width: 420px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}

.auth-tab.active {
    background: white;
    color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 28px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-form input {
    width: 100%;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.8);
    font-family: inherit;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.auth-form button {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    border-radius: 12px;
}

/* 结果模态框 */
.result-modal h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 28px;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: -0.5px;
}

.card-display {
    background: rgba(0, 122, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.product-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.card-code {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-blue);
    word-break: break-all;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
}

/* 提货记录 */
.records-modal {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.close-btn {
    background: rgba(0, 0, 0, 0.04);
    font-size: 28px;
    color: var(--text-secondary);
    padding: 0;
    width: 36px;
    height: 36px;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.records-list {
    max-height: 500px;
    overflow-y: auto;
}

.record-item {
    background: rgba(0, 122, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 122, 255, 0.15);
}

.record-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.record-product {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 16px;
}

.record-time {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.record-card {
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    color: var(--primary-blue);
    word-break: break-all;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
}

/* 加载状态 */
.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px;
    font-size: 16px;
    font-weight: 500;
}

/* 空状态 */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 80px 20px;
}

.empty-state p {
    font-size: 17px;
    margin-bottom: 8px;
    font-weight: 500;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        margin-top: 60px;
        padding: 0 16px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 24px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .user-info {
        flex-direction: column;
        width: 100%;
    }
    
    .user-info button {
        width: 100%;
    }
    
    .products-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 28px;
    }
    
    .auth-form h2,
    .result-modal h2,
    .modal-header h2 {
        font-size: 24px;
    }
}

/* 动画效果 - 移除 */
.product-card {
    /* 不添加动画 */
}

/* ===== 全屏溯源水印 ===== */
/* 水印层由 JS 注入，pointer-events:none 保证不挡交互；z-index 1 确保不盖弹窗(2000)和公告栏(1000) */
[data-watermark="trace"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1 !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}
