/**
 * 笃学 - 全局样式
 */

/* ========== 变量定义 ========== */
:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --success: #059669;
    --success-light: #10b981;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --info: #06b6d4;
    --orange: #f97316;
    
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --bottom-nav-height: 60px;
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, select, textarea {
    font-family: inherit;
}

/* ========== 布局 ========== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--primary);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.nav-item span:first-child {
    margin-right: 12px;
    font-size: 18px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* 顶部导航 */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    padding: 8px;
    margin-right: 12px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.points-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--warning-light), var(--orange));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

/* 底部导航 */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.bottom-nav .nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    padding: 8px 4px;
    font-size: 10px;
}

.bottom-nav .nav-item span {
    font-size: 20px;
    margin-right: 0;
    margin-bottom: 2px;
}

/* 内容区 */
.content {
    padding: 24px;
}

/* ========== 卡片 ========== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-link {
    color: var(--primary);
    font-size: 13px;
}

.card-body {
    padding: 20px;
}

.date-range {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 倒计时卡片 ========== */
.countdown-card {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.countdown-info {
    flex: 1;
}

.countdown-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.countdown-days {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.days-number {
    font-size: 56px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.days-text {
    font-size: 24px;
    color: var(--primary);
}

.countdown-date {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.phase-tag {
    display: inline-block;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 12px;
}

.countdown-icon {
    font-size: 64px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

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

/* ========== 任务列表 ========== */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-title {
    font-weight: 500;
}

.task-due {
    font-size: 12px;
    color: var(--text-secondary);
}

.task-complete-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.task-complete-btn:hover {
    background: var(--success-light);
}

/* ========== 复习列表 ========== */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.review-subject {
    color: var(--primary);
    font-weight: 500;
    white-space: nowrap;
}

.review-text {
    color: var(--text-secondary);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 快捷入口 ========== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-btn.primary { border-top: 3px solid var(--primary); }
.quick-btn.warning { border-top: 3px solid var(--warning); }
.quick-btn.success { border-top: 3px solid var(--success); }
.quick-btn.info { border-top: 3px solid var(--info); }

.quick-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.quick-btn span:last-child {
    font-size: 13px;
    font-weight: 500;
}

/* ========== 错题列表 ========== */
.wrong-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wrong-item {
    display: block;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.wrong-item:hover {
    background: var(--border-light);
}

.wrong-subject {
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
}

.wrong-text {
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.wrong-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.status-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.status-tag.unmastered {
    background: #fef2f2;
    color: var(--danger);
}

.status-tag.practicing {
    background: #fffbeb;
    color: var(--warning);
}

.status-tag.mastered {
    background: #ecfdf5;
    color: var(--success);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

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

.empty-state p {
    color: var(--text-secondary);
}

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

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-success:hover {
    background: #047857;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

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

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    z-index: 9999;
    animation: slideDown 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--info);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

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

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.pagination a {
    background: var(--bg-white);
    border: 1px solid var(--border);
    color: var(--text);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== 筛选标签 ========== */
.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-tab {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover,
.filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ========== 题目详情 ========== */
.question-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 13px;
}

.question-type {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
}

.question-text {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.options-list {
    list-style: none;
}

.options-list li {
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.options-list li:hover {
    background: var(--border-light);
}

.options-list li.correct {
    background: #d1fae5;
    border: 2px solid var(--success);
}

.options-list li.wrong {
    background: #fee2e2;
    border: 2px solid var(--danger);
}

/* ========== 上传区域 ========== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

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

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-light);
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .bottom-nav {
        display: flex;
    }
    
    .content {
        padding: 16px;
        padding-bottom: 80px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .countdown-card {
        padding: 20px;
    }
    
    .days-number {
        font-size: 42px;
    }
    
    .countdown-icon {
        font-size: 48px;
    }
    
    .card-header {
        padding: 12px 16px;
    }
    
    .card-body {
        padding: 16px;
    }
}

/* ========== 复习模式 ========== */
.review-mode {
    max-width: 800px;
    margin: 0 auto;
}

.review-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.review-question {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.review-option {
    padding: 16px;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.review-option:hover {
    border-color: var(--primary);
}

.review-option.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.review-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ========== 模态框 ========== */
.modal-overlay {
    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: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========== 积分商城 ========== */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.shop-item {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.shop-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.shop-image {
    height: 120px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.shop-info {
    padding: 16px;
}

.shop-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.shop-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.shop-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.points-cost {
    color: var(--orange);
    font-weight: 600;
}

@media (max-width: 768px) {
    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== 积分明细 ========== */
.points-list {
    display: flex;
    flex-direction: column;
}

.points-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.points-item:last-child {
    border-bottom: none;
}

.points-reason {
    font-weight: 500;
}

.points-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.points-amount {
    font-weight: 600;
    font-size: 16px;
}

.points-amount.earn {
    color: var(--success);
}

.points-amount.spend {
    color: var(--danger);
}

/* ========== 学习计划 ========== */
.plan-timeline {
    position: relative;
    padding-left: 30px;
}

.plan-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.plan-phase {
    position: relative;
    margin-bottom: 24px;
}

.plan-phase::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid white;
}

.plan-phase.foundation::before { background: #10b981; }
.plan-phase.improvement::before { background: #f59e0b; }
.plan-phase.sprint::before { background: #ef4444; }

.plan-phase.current::before {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.plan-phase-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.plan-phase-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.plan-phase-content {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
}

/* ========== 打印页面 ========== */
.print-page {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
}

.print-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.print-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

.print-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.print-questions {
    margin-bottom: 30px;
}

.print-question {
    margin-bottom: 24px;
    page-break-inside: avoid;
}

.print-question-num {
    font-weight: bold;
    margin-bottom: 8px;
}

.print-answer-line {
    border-bottom: 1px solid var(--text);
    height: 30px;
    margin-top: 8px;
}

/* ========== 评分星星 ========== */
.star-rating {
    display: flex;
    gap: 8px;
}

.star {
    font-size: 28px;
    cursor: pointer;
    color: var(--border);
    transition: all 0.2s;
}

.star.active {
    color: var(--warning);
}

.star:hover {
    transform: scale(1.1);
}

/* ========== 加载动画 ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-secondary); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }

/* ========== Pad适配 (768px-1024px) ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 200px;
        --sidebar-width: 200px;
    }
    
    .sidebar .nav-item {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .countdown-card {
        padding: 20px;
    }
    
    .days-number {
        font-size: 48px;
    }
    
    /* Pad上表格优化 */
    .data-table {
        font-size: 13px;
    }
    
    .data-table th, .data-table td {
        padding: 10px 12px;
    }
    
    /* Pad上卡片内边距 */
    .card-body {
        padding: 16px;
    }
    
    .card-header {
        padding: 12px 16px;
    }
    
    /* Pad横屏时用侧边栏，竖屏时收起 */
    .menu-toggle {
        display: block;
    }
}

/* ========== 小Pad/大手机竖屏 (480-768px) ========== */
@media (min-width: 480px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== 小屏幕优化 ========== */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .countdown-card {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }
    
    .days-number {
        font-size: 36px;
    }
    
    .countdown-icon {
        font-size: 40px;
        margin-top: 8px;
    }
    
    .content {
        padding: 12px;
        padding-bottom: 80px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* 表格在小屏上横向滚动 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 500px;
    }
    
    .bottom-nav .nav-item small {
        font-size: 9px;
    }
}

/* ========== 打印优化 ========== */
@media print {
    .sidebar, .top-bar, .bottom-nav, .menu-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    body {
        background: white;
    }
}

/* ========== 触摸优化 ========== */
@media (hover: none) and (pointer: coarse) {
    .nav-item, .btn, .form-group input, .form-group select {
        min-height: 44px;
    }
    
    .nav-item {
        padding: 14px 20px;
    }
    
    .bottom-nav .nav-item {
        min-height: auto;
    }
    
    .star {
        font-size: 36px;
    }
    
    /* 防止触摸时高亮 */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}
