/* Base styles */
:root {
    /* Premium Green & Blue Theme */
    --brand-primary: #059669;       /* Emerald 600 */
    --brand-primary-dark: #047857;  /* Emerald 700 */
    --brand-primary-soft: #ecfdf5;  /* Emerald 50 */
    --brand-secondary: #2563eb;     /* Blue 600 */
    --brand-secondary-dark: #1d4ed8;/* Blue 700 */
    --brand-secondary-soft: #eff6ff;/* Blue 50 */
    
    --brand-tertiary: #f59e0b;      /* Amber 500 */
    --brand-danger: #ef4444;        /* Red 500 */
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-secondary: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    --gradient-surface: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    
    /* Surface & Backgrounds */
    --surface-base: #f8fafc;        /* Slate 50 */
    --surface-card: rgba(255, 255, 255, 0.8);
    --surface-glass: rgba(255, 255, 255, 0.7);
    
    /* Borders & Shadows */
    --border-soft: rgba(226, 232, 240, 0.8);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    
    /* Typography */
    --text-main: #0f172a;           /* Slate 900 */
    --text-secondary: #64748b;      /* Slate 500 */
    
    /* Dimensions */
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Legacy aliases compatibility */
    --primary-color: var(--brand-primary);
    --secondary-color: var(--surface-base);
    --accent-color: var(--brand-tertiary);
    --text-color: var(--text-main);
    --bg-color: var(--surface-base);
    --card-bg: var(--surface-card);
    --border-color: var(--border-soft);
}

/* Learning Module Cards */
.learning-module-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s ease;
}

.learning-module-link:hover {
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.learning-module-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 1.8rem 1.2rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(41, 63, 136, 0.08);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    height: 100%;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.learning-module-card:hover {
    box-shadow: 0 12px 32px rgba(74, 144, 226, 0.12);
    border-color: var(--brand-primary);
}

.learning-module-icon {
    background: linear-gradient(135deg, var(--brand-primary), #64b5f6);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    font-size: 1.4rem;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.25);
    flex-shrink: 0;
}

.learning-module-card h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.4rem 0;
    color: var(--text-color);
    line-height: 1.3;
}

.learning-module-card small {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.4;
}

/* 快捷功能卡片横向布局 */
.quick-actions-grid {
    display: grid;
    /* 自适应列数：桌面可排成一行5个，平板3-4个，手机2个 */
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.quick-actions-grid > a {
    display: block;
    height: 100%;
}

/* ========== Mobile Bottom Sheet (More) ========== */
.bottom-sheet {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1050;
}
.bottom-sheet.show { display: block; }
.bottom-sheet__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.35);
}
.bottom-sheet__panel {
    position: absolute; inset-inline: 0; bottom: 0;
    background: #fff;
    border-top-left-radius: 16px; border-top-right-radius: 16px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.25s ease;
    padding: 12px 16px 16px 16px;
}
.bottom-sheet.show .bottom-sheet__panel { transform: translateY(0); }
.bottom-sheet__handle {
    width: 40px; height: 4px; border-radius: 999px;
    background: #e0e0e0; margin: 6px auto 10px auto;
}
.bottom-sheet__title { font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.bottom-sheet__list { display: flex; flex-direction: column; gap: 8px; }
.bottom-sheet__item {
    display: flex; align-items: center;
    padding: 12px; border: 1px solid #eee; border-radius: 12px;
    color: #333; text-decoration: none; background: #fff;
}
.bottom-sheet__item:active { background: #f8f9fa; }

/* 按钮式的学习模块卡片 */
button.learning-module-card {
    border: 1px solid rgba(41, 63, 136, 0.1);
    background: var(--surface-card);
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

button.learning-module-card:hover {
    box-shadow: 0 12px 32px rgba(74, 144, 226, 0.12);
    border-color: var(--brand-primary);
    transform: translateY(-2px);
}

button.learning-module-card:focus {
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.25);
    outline: none;
}

button.learning-module-card:active {
    transform: translateY(0);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .learning-module-card {
        padding: 1rem 0.5rem;
        min-height: 100px;
    }
    
    .learning-module-icon {
        width: 40px;
        height: 40px;
        margin: 0 auto 0.5rem auto;
        font-size: 1rem;
    }
    
    .learning-module-card h5 {
        font-size: 0.8rem;
        margin: 0 0 0.2rem 0;
    }
    
    .learning-module-card small {
        font-size: 0.7rem;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--surface-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-base), color var(--transition-base);
}

.nav-links a:hover {
    background-color: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.nav-auth {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.25);
    transition: background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.btn-primary:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    box-shadow: 0 10px 24px rgba(25, 118, 210, 0.28);
    transform: translateY(-1px);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.25);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    background-color: var(--brand-primary-soft);
    transition: background-color var(--transition-base), color var(--transition-base), box-shadow var(--transition-base);
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary);
    color: #fff;
    box-shadow: 0 6px 18px rgba(74, 144, 226, 0.2);
}

.btn-outline-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.18);
}

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

.btn-login {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

/* Cards */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.topic-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.topic-card:hover {
    transform: translateY(-5px);
}

.topic-card h2 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.topic-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Subject container */
.subject-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.subject-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

/* Footer */
footer {
    background-color: var(--card-bg);
    padding: 3rem 2rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Messages */
.message {
    position: fixed;
    top: 1rem;
    inset-inline-end: 1rem;
    padding: 1rem 2rem;
    border-radius: 4px;
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

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

.message-error {
    background-color: var(--accent-color);
    color: white;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    z-index: 1000;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-inline-start: 1rem;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s;
}

/* Mobile navigation styles */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-brand {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .nav-links {
        display: none;
        width: 100%;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .main-nav {
        flex-direction: column;
        padding: 1rem;
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
        text-align: center;
        margin: 1rem 0;
    }
    
    .nav-auth {
        width: 100%;
        justify-content: center;
    }
    
    .topic-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* 导航栏样式 */
.navbar {
    padding: 0.5rem 1rem;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-nav {
    display: flex;
    justify-content: center !important;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    gap: 0.5rem;
}

.navbar-nav .nav-item {
    text-align: center;
    margin: 0 0.15rem;
}

.navbar-brand {
    font-weight: bold;
    color: var(--primary-color) !important;
}

/* 卡片样式 */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-5px);
}

/* 表单样式 */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

/* 学科卡片样式 */
.subject-card {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.subject-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.subject-card .card-body {
    padding: 1.5rem;
}

.subject-card .card-title {
    color: var(--primary-color);
    font-weight: bold;
}

/* 进度条样式 */
.progress {
    height: 10px;
    border-radius: 5px;
}

.progress-bar {
    background-color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .subject-card .card-img-top {
        height: 150px;
    }
}

/* 动画效果 */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 300ms ease-in;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: darken(var(--primary-color), 10%);
}

/* OCR结果显示样式 */
.ocr-content {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ocr-text {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    white-space: pre-wrap;
    font-family: var(--bs-font-sans-serif);
    line-height: 1.6;
}

.content-line {
    margin-bottom: 0.5rem;
}

.content-line:last-child {
    margin-bottom: 0;
}

.section-title {
    color: #0d6efd;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.section-title:first-child {
    margin-top: 0;
}

/* 调整容器宽度和间距 */
.container-fluid {
    max-width: 1400px;
}

.alert-success {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.alert-heading {
    color: #198754;
}

/* 按钮样式优化 */
.btn-outline-primary:hover {
    background-color: #0d6efd;
    color: #ffffff;
}

.btn-back {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* 状态提示样式 */
.ocr-status {
    transition: all 0.3s ease;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* AI助手移动端适配 */
.note-widget {
    max-height: calc(100vh - 40px);
    overflow: hidden;
    flex-direction: column;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .note-widget {
        inset-inline-end: 10px !important;
        bottom: 10px !important;
        inset-inline-start: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 20px) !important;
        max-height: calc(100svh - 20px) !important; /* 支持新的视窗单位 */
    }
    
    .note-widget-header {
        padding: 10px 12px !important;
    }
    
    .note-widget textarea {
        min-height: 60px !important;
    }
    
    .button-group {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .button-group button {
        padding: 10px 12px !important;
    }
    
    .chat-container {
        max-height: calc(50vh - 100px) !important;
        max-height: calc(50svh - 100px) !important;
        flex: 1 !important;
        overflow-y: auto !important;
    }
}

/* 移动端安全区域适配 */
@media (max-width: 768px) {
    @supports (padding: max(0px)) {
        .note-widget {
            bottom: max(10px, env(safe-area-inset-bottom)) !important;
            right: max(10px, env(safe-area-inset-right)) !important;
            left: max(10px, env(safe-area-inset-left)) !important;
        }
    }
}

/* AI流式响应打字指示器 */
.typing-indicator {
    color: var(--primary-color);
    animation: typing-blink 0.8s infinite;
    font-weight: bold;
    display: inline-block;
    margin-inline-start: 2px;
}

@keyframes typing-blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.3;
    }
}

/* 流式响应消息样式 */
.message.assistant .content {
    position: relative;
}

.message.assistant.streaming {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 50%, #f8f9fa 100%);
    background-size: 200% 100%;
    animation: streaming-bg 2s ease-in-out infinite;
}

@keyframes streaming-bg {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 导航栏链接样式 */
.app-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.35rem;
    font-size: 0.85rem;
    color: #555;
    text-decoration: none !important;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer !important;
}

/* Notes page - lighten cards and chips */
.notes-page .note-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    box-shadow: none;
    border-radius: 8px;
}

.clickable-card {
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.clickable-card:hover {
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.notes-page .note-header {
    background: transparent;
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 12px;
}

.notes-page .note-header .timestamp { color: var(--text-secondary); }

.notes-page .note-actions .btn {
    border: 1px solid var(--border-soft);
    background: #fff;
    color: var(--text-secondary);
}

.notes-page .note-actions .btn:hover {
    border-color: rgba(45,108,223,0.35);
    color: var(--brand-primary);
}

.notes-page .subject-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    color: var(--text-secondary);
    background: transparent;
}

.notes-page .knowledge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.notes-page .knowledge-card { background: #fff; border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px; }
.notes-page .knowledge-card-header { display:flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.notes-page .knowledge-badge { border: 1px solid var(--border-soft); background: transparent; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 500; }
.notes-page .knowledge-badge.mastered { color: #1b8a5a; border-color: rgba(27,138,90,0.35); }
.notes-page .knowledge-badge.basic { color: var(--brand-primary); border-color: rgba(45,108,223,0.35); }
.notes-page .knowledge-badge.partial { color: #b8860b; border-color: rgba(255,193,7,0.4); }
.notes-page .knowledge-badge.not-mastered { color: #c0323a; border-color: rgba(220,53,69,0.35); }

.notes-page .deep-learning-section { background: #fff; border: 1px solid var(--border-soft); border-radius: 8px; }
.notes-page .deep-learning-header { background: var(--brand-primary-soft); border-radius: 8px; }
.notes-page .deep-learning-content-wrapper { border: 1px dashed var(--border-soft); }
.notes-page .deep-ai-study-btn { background: #fff; color: var(--brand-primary); border: 1px solid rgba(45,108,223,0.35); box-shadow: none; }
.notes-page .deep-ai-study-btn:hover { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

.note-detail-page .deep-learning-content-wrapper {
    width: 100%;
}

.note-detail-page .deep-learning-content-wrapper.collapsed {
    display: none;
}

.note-detail-page .deep-learning-content {
    width: 100%;
}

.note-detail-page .deep-learning-svg-viewer {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 320px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
}

.note-detail-page .deep-learning-svg-controls {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 10px;
    pointer-events: none;
}

.note-detail-page .deep-learning-svg-fullscreen-btn {
    pointer-events: auto;
    min-width: 64px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.92);
    color: #1f2933;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.note-detail-page .deep-learning-svg-fullscreen-btn:hover {
    background: #fff;
}

.note-detail-page .deep-learning-svg-fullscreen-btn:focus {
    outline: none;
    border-color: rgba(45, 108, 223, 0.5);
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.25), 0 8px 18px rgba(0, 0, 0, 0.12);
}

.note-detail-page .deep-learning-svg-iframe {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

.note-detail-page .deep-learning-svg-viewer:fullscreen,
.note-detail-page .deep-learning-svg-viewer:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    min-height: 0 !important;
    border-radius: 0 !important;
}

body.deep-learning-pseudo-fullscreen-open {
    overflow: hidden;
}

.note-detail-page .deep-learning-svg-viewer.deep-learning-pseudo-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    z-index: 1060;
}

.app-nav-item:hover {
    color: var(--brand-primary);
    background-color: var(--brand-primary-soft);
}

.app-nav-item.active {
    color: var(--brand-primary);
    background-color: var(--brand-primary-soft);
    border-color: var(--brand-primary);
}

.app-nav-item i {
    margin-inline-end: 2px !important;
    font-size: 0.9em;
}

/* AI聊天页面样式重置 */
.ai-chat-reset * {
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    line-height: normal !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.ai-chat-reset .message,
.ai-chat-reset .message.user,
.ai-chat-reset .message.assistant {
    display: none !important;
}

/* 确保在移动设备上也能居中 */
@media (max-width: 991.98px) {
    .navbar-collapse {
        text-align: center;
    }
    
    .navbar-nav {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
}

/* 作业任务按钮样式 */
.timer-btn.btn-outline-primary,
.timer-btn.btn-outline-danger,
.timer-btn.btn-outline-warning,
.timer-btn.btn-outline-info {
    border-width: 1px;
    font-weight: normal;
    opacity: 0.85;
}

.timer-btn.btn-outline-primary:hover,
.timer-btn.btn-outline-danger:hover,
.timer-btn.btn-outline-warning:hover,
.timer-btn.btn-outline-info:hover {
    opacity: 1;
    font-weight: 500;
}

/* ==================== 统计卡片样式 ==================== */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(74, 144, 226, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: white;
    font-size: 24px;
}

/* 特定图标样式 */
.stat-icon.homework-icon {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #90caf9 100%);
}

.stat-icon.correction-icon {
    background: linear-gradient(135deg, var(--brand-secondary) 0%, #81c784 100%);
}

.stat-icon.error-icon {
    background: linear-gradient(135deg, var(--brand-tertiary) 0%, #ff8a65 100%);
}

.stat-info h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.stat-info small {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* 可点击统计卡片样式 */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.stat-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.stat-card.clickable {
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.stat-card.clickable:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(74, 144, 226, 0.15);
}

.stat-card.clickable .stat-arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: var(--brand-primary);
    font-size: 1.2rem;
    margin-inline-start: 10px;
}

.stat-card.clickable:hover .stat-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* 确保统计信息和图标在左侧正确布局 */
.stat-card.clickable .stat-icon {
    flex-shrink: 0;
}

.stat-card.clickable .stat-info {
    flex: 1;
    margin-inline-start: 12px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .stat-card.clickable {
        padding: 16px;
    }
    
    .stat-card.clickable:hover {
        transform: translateY(-4px);
    }
    
    .stat-card.clickable .stat-arrow {
        opacity: 1; /* 移动端始终显示箭头 */
        font-size: 1rem;
    }
}

/* 今日统计横向布局 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.stats-grid-card {
    height: 100%;
}

.stats-grid .stat-card.clickable {
    justify-content: flex-start;
    gap: 0.75rem;
}

.stats-grid .stat-card.clickable .stat-info {
    margin-inline-start: 0;
}

@media (max-width: 992px) {
    .stats-grid .stat-card.clickable {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .quick-actions-grid {
        gap: 0.6rem;
        /* 使用 6 列网格：第一行三个卡片各占 2/6，第二行两个卡片各占 3/6（正好一半） */
        grid-template-columns: repeat(6, 1fr);
    }

    .quick-actions-grid .learning-module-card {
        min-height: 110px;
    }

    .stats-grid {
        gap: 0.6rem;
    }

    .stats-grid .stat-card.clickable {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .stats-grid .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        margin-bottom: 0;
    }

    .stats-grid .stat-info {
        margin-inline-start: 0;
    }

    .stats-grid .stat-info h3 {
        font-size: 1.6rem;
    }

    .stats-grid .stat-info p {
        font-size: 0.85rem;
    }

    .stats-grid .stat-info small {
        font-size: 0.7rem;
    }

    /* 调整手机端卡片顺序与占比：
       行1：作业/批改/错题 各占 2/6
       行2：预习/复习     各占 3/6（半屏） */
    .quick-actions-grid > a.qa-homework { order: 1; grid-column: span 2; }
    .quick-actions-grid > a.qa-correction { order: 2; grid-column: span 2; }
    .quick-actions-grid > a.qa-notes { order: 3; grid-column: span 2; }
    .quick-actions-grid > a.qa-study { order: 4; grid-column: span 3; }
    .quick-actions-grid > a.qa-review { order: 5; grid-column: span 3; }
}

@media (min-width: 769px) and (max-width: 1199.98px) {
    .stats-grid .stat-info h3 {
        font-size: 2.1rem;
    }
}

/* ==================== 学习统计卡片样式 ==================== */
.learning-stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
}

.learning-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: white;
}

.learning-stats-header h5 {
    color: white;
    font-weight: 600;
}

.learning-performance-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    min-height: auto;
}

.exam-performance-content {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(108, 117, 125, 0.15);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(52, 58, 64, 0.08);
    color: #212529;
}

.exam-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.exam-summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f1f3f5 100%);
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid rgba(108, 117, 125, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
}

.exam-summary-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    letter-spacing: 0.02em;
}

.exam-summary-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
}

.exam-summary-meta {
    font-size: 0.85rem;
    color: #868e96;
}

.exam-summary-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.exam-summary-trend.positive {
    color: #2f9e44;
}

.exam-summary-trend.negative {
    color: #d9480f;
}

.exam-summary-trend.neutral {
    color: #868e96;
}

.exam-summary-empty {
    border: 1px dashed rgba(134, 142, 150, 0.4);
    border-radius: 14px;
    padding: 1.5rem 1rem;
    margin-top: 1rem;
    text-align: center;
    color: #868e96;
    background: rgba(248, 249, 250, 0.8);
}

.recent-exams-section {
    margin-top: 1.5rem;
    border-top: 1px solid rgba(222, 226, 230, 0.7);
    padding-top: 1.5rem;
}

.recent-exams-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.recent-exams-header h6 {
    font-weight: 700;
    color: #343a40;
}

.recent-exam-item {
    border: 1px solid rgba(222, 226, 230, 0.8);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 16px rgba(52, 58, 64, 0.08);
    margin-bottom: 0.9rem;
}

.recent-exam-item:last-child {
    margin-bottom: 0;
}

.recent-exam-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.recent-exam-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #212529;
}

.recent-exam-score {
    font-weight: 700;
    color: #1c7ed6;
    font-size: 1rem;
}

.recent-exam-meta {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #868e96;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.exam-subject-list {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.exam-subject-pill {
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(33, 150, 243, 0.12);
    color: #1971c2;
    font-size: 0.8rem;
    font-weight: 600;
}

.subject-trend-divider {
    border-top: 1px dashed rgba(255, 255, 255, 0.3);
}

.subject-trend-placeholder {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 200px;
}

.subject-trend-heading h6 {
    font-weight: 600;
    color: #212529;
}

.subject-trend-heading small {
    color: #6c757d !important;
}

.trend-canvas {
    width: 100%;
}

/* 学科成绩统计特定样式 */
.subject-performance-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.subject-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.subject-card h6 {
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.subject-score {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.25rem;
}

.subject-trend {
    font-size: 0.9rem;
    opacity: 0.8;
}

.trend-up {
    color: #4ade80;
}

.trend-down {
    color: #f87171;
}

.trend-stable {
    color: #94a3b8;
}

/* 走势图容器样式 */
#performanceTrendChart {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    min-height: 250px;
}

/* 平板响应式优化 */
@media (max-width: 992px) and (min-width: 769px) {
    .subject-performance-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
    }
}

/* 手机响应式优化 */
@media (max-width: 768px) {
    .learning-stats-card {
        padding: 1rem;
        margin-bottom: 1rem;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    
    .subject-performance-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .subject-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.25);
    }
    
    .subject-info {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.15);
    }
    
    .subject-score {
        font-size: 1.5rem;
    }
    
    /* 移动端Chart.js优化 */
    #trendChart {
        will-change: auto;
        transform: translateZ(0);
        position: relative;
        width: 100% !important;
        max-height: 250px !important;
    }
    
    #performanceTrendChart {
        will-change: auto;
        transform: translateZ(0);
        position: relative;
        min-height: 200px;
    }
    
    /* 确保容器不重叠 */
    .learning-stats-card .card-body {
        position: relative;
        overflow: hidden;
    }

    .exam-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recent-exam-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* 时间筛选按钮样式 */
.time-filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.time-filter-btn {
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #6c757d;
}

.time-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.time-filter-btn.active {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    border-color: #0d6efd;
    color: #fff;
}

.time-filter-btn.active:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #520dc2 100%);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .time-filter-group {
        align-self: flex-end;
    }
    
    .time-filter-btn {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
}

/* 学科成绩项目样式 */
.subject-performance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.subject-info h4 {
    color: white;
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

.subject-stats {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-top: 2px;
}

.subject-performance-item .subject-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

/* 成绩等级颜色 */
.subject-performance-item.excellent,
.subject-score.excellent {
    color: #4ade80 !important;
}

.subject-performance-item.good,
.subject-score.good {
    color: #60a5fa !important;
}

.subject-performance-item.average,
.subject-score.average {
    color: #fbbf24 !important;
}

.subject-performance-item.poor,
.subject-score.poor {
    color: #f87171 !important;
} 
