/* ========== 全局重置与基础 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #4F7EF6;
    --primary-light: #E8EEFC;
    --success: #52C41A;
    --warning: #FAAD14;
    --danger: #FF4D4F;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --bg-page: #F5F7FA;
    --bg-card: #FFFFFF;
    --border: #E5E7EB;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
}

body {
    min-height: 100vh;
    padding-bottom: 72px;
}

/* ========== 应用布局 ========== */
.app {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-page);
    position: relative;
}

.app-header {
    background: linear-gradient(135deg, #4F7EF6 0%, #6B9BFF 100%);
    color: white;
    padding: 24px 16px 28px;
    text-align: center;
}

.app-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
}

/* ========== 底部导航 ========== */
.tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
    gap: 2px;
}

.tab-btn .tab-icon {
    font-size: 20px;
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active .tab-label {
    font-weight: 600;
}

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

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.module-header {
    margin-bottom: 16px;
}

.module-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.module-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========== 模块1：速记卡片 ========== */
.subject-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: var(--bg-page);
    padding: 4px 0;
    z-index: 10;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.note-card:active {
    transform: scale(0.98);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-subject {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 4px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.card-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.note-card.expanded .card-content {
    display: block;
}

.card-hint {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 6px;
}

/* 不同科目的左边框颜色 */
.note-card[data-subject="语文"] { border-left-color: #FF6B6B; }
.note-card[data-subject="语文"] .card-subject { color: #FF6B6B; background: #FFE5E5; }
.note-card[data-subject="数学"] { border-left-color: #4F7EF6; }
.note-card[data-subject="数学"] .card-subject { color: #4F7EF6; background: var(--primary-light); }
.note-card[data-subject="英语"] { border-left-color: #36CFC9; }
.note-card[data-subject="英语"] .card-subject { color: #36CFC9; background: #E5F7F6; }
.note-card[data-subject="物理"] { border-left-color: #722ED1; }
.note-card[data-subject="物理"] .card-subject { color: #722ED1; background: #F1E8FF; }
.note-card[data-subject="化学"] { border-left-color: #52C41A; }
.note-card[data-subject="化学"] .card-subject { color: #52C41A; background: #E6F7E6; }
.note-card[data-subject="生物"] { border-left-color: #FAAD14; }
.note-card[data-subject="生物"] .card-subject { color: #FAAD14; background: #FFF7E6; }
.note-card[data-subject="历史"] { border-left-color: #FA541C; }
.note-card[data-subject="历史"] .card-subject { color: #FA541C; background: #FFEFE5; }
.note-card[data-subject="地理"] { border-left-color: #13C2C2; }
.note-card[data-subject="地理"] .card-subject { color: #13C2C2; background: #E5F7F6; }
.note-card[data-subject="政治"] { border-left-color: #EB2F96; }
.note-card[data-subject="政治"] .card-subject { color: #EB2F96; background: #FFE8F2; }

/* ========== 模块2：学习计划 ========== */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group select,
.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
    border-color: var(--primary);
}

.range-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:active {
    background: #3D6BDB;
}

.plan-result {
    animation: fadeIn 0.3s ease;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.btn-reset {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.plan-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.plan-day {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.plan-body {
    flex: 1;
}

.plan-task {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

/* ========== 模块3：公告 ========== */
.notice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notice-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}

.notice-card:active {
    transform: scale(0.98);
}

.notice-top {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
}

.notice-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.notice-tag.type-notice { background: #E8EEFC; color: var(--primary); }
.notice-tag.type-activity { background: #FFF7E6; color: var(--warning); }
.notice-tag.type-honor { background: #E6F7E6; color: var(--success); }
.notice-tag.type-exam { background: #FFE5E5; color: var(--danger); }

.notice-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notice-summary {
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notice-date {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
}

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

.modal-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
}

.modal-body {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-light);
    font-size: 14px;
}

/* ========== 适配桌面大屏 ========== */
@media (min-width: 641px) {
    body {
        background: #e8e8e8;
    }
    .app {
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    }
}
