/* ========== 基础重置与变量 ========== */
:root {
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --sidebar-bg: #1E293B;
    --success: #10B981;
    --success-hover: #059669;
    --warning: #F59E0B;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --bg: #F9FAFB;
    --card-bg: #FFFFFF;
    --text: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --radius-lg: 12px;
    --radius: 8px;
    color-scheme: light only;
    -webkit-text-fill-color: currentColor;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ========== 强制浅色模式（所有浏览器，含夸克等） ========== */
html {
    color-scheme: light only;
    background: #F9FAFB !important;
    filter: none !important;
}
body {
    background: #F9FAFB !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827;
}
body * {
    -webkit-text-fill-color: currentColor;
}
/* 防止深色模式覆盖 */
body, body div, body span, body p, body a, body button, body input, body textarea, body select, body td, body th, body label, body h1, body h2, body h3, body h4, body h5, body h6, body li, body strong, body em, body small {
    -webkit-text-fill-color: currentColor;
}
input, textarea, select {
    background: #FFFFFF !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827;
}

/* 去掉number输入框的增减箭头 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* ========== 公告样式 ========== */
@keyframes scrollAnnouncement {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

html { color-scheme: light only; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

/* ========== 导航栏 ========== */
.navbar {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 525px;
    margin: 0 auto;
    padding: 0 18px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
}
/* 品牌强制分行：多多 第一行，新媒体 第二行 */
.navbar-brand .b1 { font-size: 18px; display: block; }
.navbar-brand .b2 { font-size: 13px; display: block; }
.navbar-brand .brand-line2 { display: none; }
.navbar-brand .brand-br { display: none; }

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.navbar-nav a, .navbar-nav button {
    font-size: 13px;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.nav-link {
    color: var(--text-secondary);
}
.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: #EFF6FF;
}

.balance-badge {
    background: #ECFDF5;
    color: var(--success);
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-outline {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: #F3F4F6; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ========== 胶囊导航按钮 ========== */
.nav-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    border: 1px solid transparent;
}
.nav-pill:hover {
    background: rgba(59,130,246,0.08);
    color: var(--primary);
}
.nav-pill.active {
    background: var(--primary);
    color: white;
}
.nav-pill.primary {
    background: var(--primary);
    color: white;
}
.nav-pill.success {
    background: var(--success);
    color: white;
}
.nav-pill.outline {
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.nav-pill.outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========== 卡片 ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    padding: 24px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.form-input::placeholder { color: #9CA3AF; }

select.form-input {
    appearance: auto;
}

/* ========== 表格 ========== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 12px 8px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 13px;
}

table tr:hover { background: #F9FAFB; }

/* ========== 徽章 ========== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-gray { background: #F3F4F6; color: #6B7280; }

/* ========== 布局 ========== */
.page-container {
    max-width: 525px;
    margin: 0 auto;
    padding: 24px 18px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

/* ========== 登录/注册页 ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--success);
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.auth-tab.active {
    color: var(--success);
    border-bottom-color: var(--success);
}

.alert {
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
}

.alert-error { background: #FEF2F2; color: var(--danger); }
.alert-success { background: #ECFDF5; color: var(--success); }

/* ========== 管理员侧边栏 ========== */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    width: 200px;
    background: var(--sidebar-bg);
    color: white;
    flex-shrink: 0;
}

.admin-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: 700;
    font-size: 16px;
}

.admin-sidebar a, .admin-nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.admin-sidebar a:hover, .admin-nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-sidebar a.active, .admin-nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.admin-sidebar a .icon {
    margin-right: 10px;
    font-size: 16px;
}

.admin-main {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

/* ========== 金额选择 ========== */
.amount-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.amount-btn {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: white;
    cursor: pointer;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    transition: all 0.2s;
}

.amount-btn:hover {
    border-color: var(--success);
    background: #ECFDF5;
}

.amount-btn.selected {
    border-color: var(--success);
    background: #ECFDF5;
}

/* ========== 二维码 ========== */
.qrcode-container {
    text-align: center;
    padding: 20px;
}

.qrcode-container img {
    max-width: 280px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.page-container > .stats-grid {
    grid-template-columns: 1fr 1fr;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ========== 进度条 ========== */
.progress-bar {
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.5s;
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ========== 客服弹窗 ========== */
.cs-popup {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 150;
    padding: 24px;
    transform: translateX(100%);
    transition: transform 0.3s;
}

.cs-popup.show {
    transform: translateX(0);
}

.cs-popup img {
    max-width: 100%;
    border-radius: var(--radius);
}

/* ========== 订单卡片 ========== */
.order-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

.order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.order-row:last-child { margin-bottom: 0; }

.order-label {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    margin-right: 8px;
}

.order-value {
    font-size: 13px;
    word-break: break-all;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ========== 移动端管理后台侧边栏 ========== */
.mobile-menu-btn {
    display: none;
    background: none;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 299;
}

.mobile-sidebar-overlay.show { display: block; }

/* ========== 单价标签 ========== */
.price-tag {
    display: inline-block;
    background: #FEF3C7;
    color: #92400E;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 15px;
    margin-left: 8px;
}

/* ========== 追加阅读弹窗 ========== */
.add-reads-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.add-reads-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

/* ========== 统计行 ========== */
.stat-row {
    display: grid;
    grid-template-columns: 80px repeat(3, 1fr);
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: 13px;
    align-items: center;
}

.stat-row-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    background: #F9FAFB;
    padding: 8px 0;
    border-radius: 4px;
    text-align: center;
}

.stat-row-header:first-child { text-align: left; padding-left: 8px; }

/* ========== 手机端底部导航 ========== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -1px 6px rgba(0,0,0,0.1);
    z-index: 100;
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
}
.mobile-bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-secondary);
    text-decoration: none;
}
.mobile-bottom-nav a.active {
    color: var(--primary);
    font-weight: 600;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .navbar-inner { max-width: 100%; padding: 0 12px; height: auto; min-height: 56px; flex-wrap: wrap; align-items: center; }
    .navbar-brand { font-size: 16px; line-height: 1.2; text-align: center; }
    .navbar-brand .b1 { font-size: 16px; display: block; }
    .navbar-brand .b2 { font-size: 12px; display: block; }
    .navbar-brand .brand-line2 { display: none; }
    .navbar-brand .brand-br { display: none; }
    .navbar-nav { 
        gap: 4px; 
        flex-wrap: wrap; 
        justify-content: flex-end;
        align-items: center;
        width: 100%;
        padding: 4px 0 6px;
        writing-mode: horizontal-tb;
    }
    .navbar-nav .nav-link { display: none; }
    .navbar-nav .nav-pill, .navbar-nav .balance-badge { writing-mode: horizontal-tb; }
    .navbar-nav .nav-pill { 
        padding: 4px 8px; 
        font-size: 11px; 
    }
    .navbar-nav .balance-badge { font-size: 11px; padding: 2px 8px; }
    
    .admin-sidebar { 
        display: none;
        position: fixed;
        left: 0;
        top: 56px;
        bottom: 0;
        z-index: 300;
        width: 200px;
    }
    .admin-sidebar.show { display: block; }
    .mobile-menu-btn { display: inline-flex !important; }
    #mobile-menu-btn { display: inline-flex !important; }
    
    .admin-main { padding: 16px 12px; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-card { padding: 10px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 11px; }
    .amount-grid { grid-template-columns: repeat(2, 1fr); }
    .page-container { padding: 12px 10px; }
    .card { padding: 14px; }
    
    table th, table td { padding: 8px 4px; font-size: 12px; }
    
    .cs-popup { width: 100%; }
    
    .stat-row { grid-template-columns: 60px repeat(3, 1fr); font-size: 12px; }
    
    .order-card { padding: 12px; }
    
    /* 单价标签自适应 */
    .price-tag-mobile {
        background: linear-gradient(135deg,#fef3c7,#fde68a);
        padding: 6px 12px;
        border-radius: 16px;
        font-weight: 700;
        color: #92400e;
        font-size: 13px;
        display: inline-block;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .auth-card { padding: 24px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .stat-card { padding: 8px; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 10px; }
    .amount-grid { grid-template-columns: 1fr 1fr; }
}
