/* ========== 蜂鸣体育备课助手 - Liquid Glass 设计语言 ========== */

/* 切换主题时禁用所有过渡动画，避免卡顿 */
.no-transitions,
.no-transitions *,
.no-transitions *::before,
.no-transitions *::after {
    transition: none !important;
    animation: none !important;
}

:root {
    /* 主色 - macOS 系统蓝 */
    --primary: #0A84FF;
    --primary-dark: #0066CC;
    --primary-light: #4DA3FF;

    /* 玻璃材质（浅色） */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.75);
    --glass-bg-thin: rgba(255, 255, 255, 0.35);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-highlight: rgba(255, 255, 255, 0.8);

    /* 背景渐变 - 中性的品牌蓝灰，不含任何天气元素 */
    --app-bg: linear-gradient(135deg, #e8eef5 0%, #dce4ef 40%, #e6ecf4 100%);

    /* 文字 */
    --text: #1c1c1e;
    --text-secondary: #8e8e93;
    --text-on-glass: rgba(28, 28, 30, 0.9);

    /* 输入框 */
    --input-bg: rgba(255, 255, 255, 0.7);
    --input-border: rgba(0, 0, 0, 0.08);

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1), 0 24px 64px rgba(0, 0, 0, 0.1);

    /* 圆角 */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --sidebar-w: 230px;
    --topbar-h: 56px;
}

/* ========== 深色模式 ========== */
[data-theme="dark"] {
    --primary: #0A84FF;
    --primary-dark: #4DA3FF;
    --primary-light: #6EB9FF;

    --glass-bg: rgba(38, 38, 40, 0.6);
    --glass-bg-strong: rgba(48, 48, 52, 0.78);
    --glass-bg-thin: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);

    --app-bg: linear-gradient(135deg, #141416 0%, #1c1c1f 40%, #232326 100%);

    --text: #f5f5f7;
    --text-secondary: #98989e;
    --text-on-glass: rgba(245, 245, 247, 0.92);

    --input-bg: rgba(0, 0, 0, 0.25);
    --input-border: rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 24px 64px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background: var(--app-bg);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ========== 布局 ========== */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
    padding: 12px;
    gap: 12px;
}

/* ========== 侧边栏 - Liquid Glass ========== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px 16px;
}
.logo-icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 0 0 1px rgba(255,255,255,0.6);
    flex-shrink: 0;
}
.logo-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo-text h1 { font-size: 14px; font-weight: 600; color: var(--text-on-glass); letter-spacing: -0.02px; }
.logo-text p { font-size: 10px; color: var(--text-secondary); font-style: italic; margin-top: 1px; }

.nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    color: var(--text-on-glass);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.nav-item:hover {
    background: var(--glass-bg-thin);
}
.nav-item.active {
    background: rgba(10, 132, 255, 0.18);
    color: var(--primary-dark);
    box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.15);
}

.nav-bottom { padding: 8px 10px; }

/* ========== 主区 ========== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--input-border);
}
.week-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* 手机端主题切换按钮（电脑端隐藏） */
.theme-toggle-mobile {
    display: none;
    background: var(--glass-bg-thin);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.page {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: none;
}
.page.active { display: block; }

.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-header .muted { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ========== 卡片 - Glass ========== */
.card {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-highlight);
    padding: 18px 20px;
}

/* ========== 按钮 - Glass ========== */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 12px rgba(10, 132, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(10, 132, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
}
.btn-secondary {
    background: var(--glass-bg-thin);
    color: var(--text);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}
.btn-secondary:hover {
    background: var(--glass-bg);
}
.btn-secondary:active {
    transform: scale(0.97);
}
.btn-danger {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border: 1px solid rgba(255, 59, 48, 0.2);
}
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* ========== Badge ========== */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary);
    color: white;
}
.badge-stage { background: var(--primary); }
.badge-age { background: #30D158; margin-left: 4px; }
.badge-type { background: #BF5AF2; }
.badge-method { background: #FF9F0A; }

/* ========== 表单 ========== */
input[type="text"], input[type="datetime-local"], select, textarea {
    padding: 8px 14px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.15);
    background: var(--input-bg);
}
label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 4px; font-weight: 500; }
.form-group { margin-bottom: 14px; }
.muted { color: var(--text-secondary); font-size: 12px; }

/* ========== Drawer - 更强的 Glass ========== */
.drawer-mask {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 90;
}
.drawer {
    position: fixed; top: 12px; right: 12px;
    width: 580px; max-width: 92vw; height: calc(100vh - 24px);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateX(calc(100% + 24px));
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column;
    z-index: 100;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--input-border);
    display: flex; justify-content: space-between; align-items: center;
}
.drawer-header h3 { font-size: 16px; font-weight: 600; }
.drawer-close {
    background: rgba(0,0,0,0.06); border: none;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: 14px; cursor: pointer; color: var(--text-secondary);
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.drawer-close:hover { background: rgba(0,0,0,0.12); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }

/* ========== Modal ========== */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
}
.modal {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 480px; max-width: 92vw; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--input-border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: rgba(0,0,0,0.06); border: none;
    width: 30px; height: 30px; border-radius: 50%;
    cursor: pointer; font-size: 14px; color: var(--text-secondary);
}
.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--input-border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* ========== 首页统计卡 ========== */
.stat-row {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 14px; margin: 20px 0;
}
.stat-card {
    text-align: center; padding: 24px 16px;
    transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-num { font-size: 34px; font-weight: 700; color: var(--primary); letter-spacing: -0.03em; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.home-welcome {
    margin-bottom: 16px;
}
.home-logo-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.home-slogan {
    font-size: 15px;
    font-style: italic;
    font-weight: 300;
    letter-spacing: 0.5px;
    margin: 4px 0 0;
    background: linear-gradient(135deg, #0A84FF, #5E5CE6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.home-grid {
    display: grid; grid-template-columns: 3fr 2fr;
    gap: 14px; margin-bottom: 20px;
}
.home-grid h3 { margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.mini-class, .mini-lesson {
    padding: 10px 0;
    border-bottom: 1px solid var(--input-border);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mini-class:last-child, .mini-lesson:last-child { border-bottom: none; }
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========== 列表布局 ========== */
.library-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.filter-panel { padding: 18px; height: fit-content; }
.filter-group { margin-bottom: 14px; }
.filter-group > label { font-weight: 600; color: var(--text); margin-bottom: 8px; font-size: 12px; }
.checkbox {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 0; font-size: 12px; color: var(--text);
    cursor: pointer;
}
.list-header {
    display: flex; gap: 12px; align-items: center;
    margin-bottom: 12px;
}
.list-header input { flex: 1; }
.card-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-card-item {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.lesson-card-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.lesson-card-preview { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.empty-state { text-align: center; color: var(--text-secondary); padding: 60px 20px; font-size: 13px; }

/* ========== 本周计划 ========== */
.plan-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.plan-nav { display: flex; gap: 8px; align-items: center; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-col {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    min-height: 400px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.day-header {
    padding: 12px;
    background: var(--glass-bg-thin);
    border-bottom: 1px solid var(--input-border);
    font-weight: 600; font-size: 12px;
}
.day-cells { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.class-card {
    background: rgba(10, 132, 255, 0.08);
    border-left: 3px solid var(--primary);
    padding: 8px 10px; border-radius: 8px; font-size: 12px;
    transition: all 0.2s;
}
.class-card:hover { background: rgba(10, 132, 255, 0.14); }
.empty-day { text-align: center; color: var(--text-secondary); padding: 20px 0; font-size: 12px; }

/* ========== 教案生成 ========== */
.gen-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.gen-form { padding: 22px; }
.gen-result { padding: 26px; min-height: 500px; }
.editable-pre {
    white-space: pre-wrap; font-family: inherit;
    background: var(--glass-bg-thin);
    border: 1px solid var(--input-border);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin: 6px 0 14px;
    border-left: 3px solid var(--primary-light);
    min-height: 60px; line-height: 1.7;
    transition: all 0.2s;
}
.editable-pre:focus {
    outline: none;
    border-left-color: var(--primary);
    background: var(--glass-bg);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.1);
}
.gen-actions {
    display: flex; gap: 8px; margin-top: 20px;
    padding-top: 16px; border-top: 1px solid var(--input-border);
}

/* 竞赛和关联资料 */
.contest-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.contest-item {
    background: rgba(10, 132, 255, 0.08);
    border: 1px solid rgba(10, 132, 255, 0.12);
    border-left: 3px solid var(--primary);
    padding: 10px 14px; border-radius: 10px;
    display: flex; flex-direction: column; gap: 2px;
}
.related-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.related-item {
    padding: 8px 12px; background: var(--glass-bg-thin);
    border-radius: 8px; font-size: 12px;
}

/* ========== 详情 ========== */
.detail-section { margin: 18px 0 6px; color: var(--primary); font-size: 13px; font-weight: 600; }
.detail-pre {
    white-space: pre-wrap; font-family: inherit;
    background: var(--glass-bg-thin);
    border: 1px solid var(--input-border);
    padding: 12px 14px;
    border-radius: 10px; line-height: 1.7;
}
.hit-block { margin-bottom: 18px; }
.hit-block h4 { margin: 8px 0; color: var(--primary); font-size: 14px; }

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ========== 移动端底部 Tab 栏（默认隐藏） ========== */
.mobile-tabbar {
    display: none;
}

/* ========== 移动端响应式 ========== */
@media (max-width: 768px) {
    .app {
        padding: 0;
        gap: 0;
        flex-direction: column;
        height: 100vh;
    }
    .sidebar {
        display: none;
    }
    .main {
        border-radius: 0;
        border: none;
        height: 100vh;
    }
    .topbar {
        padding: 0 16px;
        height: 52px;
    }
    .theme-toggle-mobile {
        display: block;
    }
    .page {
        padding: 20px 16px 110px;
    }
    .page-header h2 { font-size: 22px; }

    /* 欢迎区 */
    .home-welcome {
        margin-bottom: 16px;
    }
    .home-welcome h2 { font-size: 22px; font-weight: 700; }

    /* 统计卡：手机上 2 列，但更大更精致 */
    .stat-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin: 16px 0;
    }
    .stat-card {
        padding: 20px 16px;
        text-align: left;
    }
    .stat-num { font-size: 32px; }
    .stat-label { font-size: 13px; }

    /* 首页网格单列 */
    .home-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* 快捷按钮：大按钮，方便手指点 */
    .quick-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 20px;
    }
    .quick-row .btn {
        padding: 14px;
        font-size: 14px;
        text-align: center;
    }

    /* 教学查阅布局单列 */
    .library-layout {
        grid-template-columns: 1fr;
    }
    .filter-panel {
        padding: 14px;
    }

    /* 本周计划：横向滚动 */
    .week-grid {
        grid-template-columns: repeat(7, 70px);
        overflow-x: auto;
        gap: 6px;
    }
    .day-col { min-height: 350px; }

    /* 教案生成单列 */
    .gen-layout {
        grid-template-columns: 1fr;
    }
    .gen-form { padding: 16px; }
    .gen-result { padding: 16px; min-height: auto; }

    /* 抽屉全屏 */
    .drawer {
        top: 0; right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    /* 弹窗全屏化一点 */
    .modal {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    /* 底部 Tab 栏：更强的 Liquid Glass */
    .mobile-tabbar {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 72px;
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(40px) saturate(200%);
        -webkit-backdrop-filter: blur(40px) saturate(200%);
        border-top: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
        z-index: 50;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    [data-theme="dark"] .mobile-tabbar {
        background: rgba(38, 38, 40, 0.6);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 14px;
        font-weight: 500;
        gap: 4px;
        transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
        border-radius: 12px;
        margin: 8px 4px;
    }
    .tab-item:active {
        transform: scale(0.92);
        background: rgba(10, 132, 255, 0.1);
    }
    .tab-item.active {
        color: var(--primary);
    }
    .tab-item span {
        font-size: 14px;
        font-weight: 500;
    }
}

/* ========== 打印 ========== */
@media print {
    .sidebar, .topbar, .drawer, .drawer-mask, .modal-mask, .mobile-tabbar { display: none !important; }
    .main { overflow: visible; background: white; border: none; }
    .page { display: block !important; padding: 0; }
    body { background: white; }
}
