/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #13c296;
    --warning-color: #ffc107;
    --danger-color: #ff6b6b;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Dark Theme */
html[data-theme="dark"] {
    --light-bg: #1e293b;
    --white: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.hidden {
    display: none !important;
}

/* Hard tab isolation guardrails */
body:not(.show-free-tasks) #freeTasksContent {
    display: none !important;
}

body.show-free-tasks #freeTasksContent {
    display: block !important;
}

body.show-free-tasks #dayContent,
body.show-free-tasks #chartsContainer {
    display: none !important;
}

body.show-free-tasks .sidebar {
    display: none !important;
}

body.show-free-tasks .main-content {
    grid-template-columns: minmax(0, 1fr) !important;
}

body.show-free-tasks .schedule-view {
    width: 100%;
}

.free-tasks-view {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.tasks-header {
    margin-bottom: 1.5rem;
}

.tasks-header h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.free-task-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.free-task-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.free-task-card-header h4 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.free-task-card-header p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 620px;
}

.free-task-toggle {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.free-task-toggle-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(15, 118, 110, 0.12);
    color: var(--secondary-color);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    transition: transform 0.2s ease, background 0.2s ease;
}

.free-task-card:not(.collapsed) .free-task-toggle-icon {
    transform: rotate(45deg);
    background: rgba(249, 115, 22, 0.14);
    color: var(--accent-color);
}

.free-task-form-wrap {
    display: block;
    margin-top: 1rem;
}

.free-task-card.collapsed .free-task-form-wrap {
    display: none;
}

.free-task-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: end;
}

.free-task-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.free-task-form label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.free-task-form input,
.free-task-form select {
    width: 100%;
    padding: 0.9rem 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.97rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--light-bg);
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.free-task-form input:focus,
.free-task-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    transform: none;
}

.free-task-form .form-actions {
    grid-column: span 4;
    display: flex;
    justify-content: flex-end;
}

.free-task-form button.submit-btn {
    padding: 0.9rem 1.4rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.free-task-form button.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.tasks-list-section {
    margin-top: 0.5rem;
}

.tasks-list-section h4 {
    margin-bottom: 0.5rem;
}

.free-tasks-chart-panel {
    margin-top: 0.75rem;
}

.free-tasks-chart-panel h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.free-tasks-chart-panel .chart-container {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.tasks-list {
    display: grid;
    gap: 1rem;
}

.task-card {
    background: var(--white);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    padding: 1.25rem;
    display: grid;
    gap: 0.85rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.task-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.task-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.task-card-tag {
    background: rgba(102, 126, 234, 0.12);
    color: var(--primary-color);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.task-card-time,
.task-card-day {
    font-weight: 700;
    color: var(--text-primary);
}

.empty-note {
    color: var(--text-secondary);
    padding: 1.2rem 1rem;
    background: rgba(102, 126, 234, 0.08);
    border: 1px dashed rgba(102, 126, 234, 0.35);
    border-radius: 16px;
}

@media (max-width: 980px) {
    .free-task-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .free-task-form {
        grid-template-columns: 1fr;
    }

    .free-task-form .form-actions {
        justify-content: stretch;
    }
}

.task-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.task-card-title {
    font-weight: 700;
    color: var(--text-primary);
}

.task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.task-card-tag {
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary-color);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.task-card-time {
    font-weight: 600;
}

.task-card-day {
    font-weight: 600;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1600px;
    margin: 0 auto;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    overflow-x: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-md);
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    color: var(--white);
    animation: pulse 2s infinite;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    -webkit-font-smoothing: antialiased;
}

.date-range {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 500;
}

/* Theme Toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--white);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.sun-icon,
.moon-icon {
    width: 1.3rem;
    height: 1.3rem;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

html[data-theme="dark"] .sun-icon {
    opacity: 0;
    transform: rotate(90deg);
    pointer-events: none;
}

.moon-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

html[data-theme="dark"] .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.header-subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* Navigation Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    padding: 0 2rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tabs-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.tab-btn:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: linear-gradient(to bottom, rgba(102, 126, 234, 0.05), transparent);
}

.day-name {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

/* Schedule View */
.schedule-view {
    background: var(--light-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.day-content {
    display: grid;
    gap: 1.5rem;
}

/* Event Card */
.event-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 5px solid;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: visible;
}

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

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.event-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    -webkit-font-smoothing: antialiased;
}

.event-time svg {
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.event-time i {
    color: var(--primary-color);
}

.event-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    -webkit-font-smoothing: antialiased;
}

.event-badge.deep-study {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.event-badge.revision {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.event-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
    -webkit-font-smoothing: antialiased;
}

.event-subject {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    margin-right: 0.5rem;
    -webkit-font-smoothing: antialiased;
}

.event-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.event-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.record-btn {
    border: 1px solid rgba(102, 126, 234, 0.35);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08));
    color: var(--primary-color);
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-btn:hover {
    transform: translateY(-1px);
    border-color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 3rem;
    height: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 120px;
}

.sidebar-section {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    font-weight: 600;
}

.sidebar-section h3 .icon-small {
    width: 1.2rem;
    height: 1.2rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-header-row h3 {
    margin-bottom: 0;
}

.header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.mini-btn {
    border: 1px solid var(--border-color);
    background: var(--light-bg);
    color: var(--text-primary);
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.mini-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Subjects List */
.subjects-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subject-item {
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.02), transparent);
    font-size: 0.9rem;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
}

.subject-item:hover {
    background: linear-gradient(to right, rgba(0, 0, 0, 0.08), transparent);
    transform: translateX(4px);
}

.subject-item-code {
    font-weight: 700;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.subject-item-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
}

/* Today's Focus */
.today-focus {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.progress-overview {
    display: grid;
    gap: 0.65rem;
}

.progress-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.08), rgba(0, 242, 254, 0.05));
}

.progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.progress-code {
    font-weight: 700;
    font-size: 0.85rem;
}

.progress-hours {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.weekly-summary {
    margin-top: 0.9rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.recommendations-list {
    display: grid;
    gap: 0.7rem;
}

.recommendation-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.7rem;
    background: var(--light-bg);
}

.recommendation-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}

.recommendation-tag {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    color: var(--white);
}

.recommendation-tag.tip {
    background: #0ea5e9;
}

.recommendation-tag.insight {
    background: #6366f1;
}

.recommendation-tag.improvement {
    background: #f59e0b;
}

.recommendation-tag.warning {
    background: #ef4444;
}

.recommendation-content {
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin-bottom: 0.55rem;
}

.recommendation-actions {
    display: flex;
    justify-content: flex-end;
}

.recommendations-list .empty-note,
.weekly-insights .empty-note,
#todayFocus .empty-note,
#progressOverview .empty-note {
    font-size: 0.84rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
}

.focus-item {
    margin-bottom: 0.75rem;
}

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

.focus-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    -webkit-font-smoothing: antialiased;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.focus-time svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.focus-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Legend */
.legend {
    background: linear-gradient(135deg, rgba(245, 247, 250, 0.5), rgba(195, 207, 226, 0.2));
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.legend-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal-close svg {
    width: 1.5rem;
    height: 1.5rem;
}

.modal-close:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    font-weight: 700;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.modal-content > div {
    margin-top: 1.5rem;
}

.record-session-form {
    display: grid;
    gap: 0.6rem;
}

.record-session-form label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.record-session-form input,
.record-session-form textarea {
    border: 1px solid var(--border-color);
    background: var(--light-bg);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
}

.record-session-form input:focus,
.record-session-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.submit-btn {
    margin-top: 0.5rem;
    border: none;
    border-radius: 9px;
    padding: 0.7rem 0.9rem;
    font-weight: 700;
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    cursor: pointer;
}

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

.form-feedback {
    min-height: 1.1rem;
    font-size: 0.82rem;
    margin-top: 0.1rem;
}

.form-feedback.success {
    color: var(--success-color);
}

.form-feedback.error {
    color: var(--danger-color);
}

.form-feedback.info {
    color: var(--text-secondary);
}

.subject-ai-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.modal-ai-output {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--light-bg);
    padding: 0.85rem;
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.modal-outline {
    margin: 0.75rem 0;
    padding: 0.85rem;
    background: var(--light-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}

.formatted-list {
    margin: 0.5rem 0;
}

.formatted-list-item {
    margin-left: 0.8rem;
    padding: 0.15rem 0;
    color: var(--text-secondary);
}

/* Chart Styles */
.charts-container {
    background: var(--white);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.charts-container h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
}

.chart-section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

@media (max-width: 1120px) {
    .chart-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .chart-section {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
}

.chart-container h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.chart-container canvas {
    max-height: 280px;
    max-width: 100%;
    width: 100% !important;
    height: auto !important;
}

.weekly-summary {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    max-width: 100%;
    word-wrap: break-word;
}
.weekly-insights {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.weekly-insights p {
    margin: 0.5rem 0;
}

.insights-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.insights-stat:last-child {
    border-bottom: none;
}

.insights-stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.insights-stat-value {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.insights-summary {
    background: var(--white);
    border-left: 3px solid var(--primary-color);
    padding: 0.8rem;
    margin-top: 0.8rem;
    border-radius: 4px;
    font-size: 0.88rem;
    color: var(--text-primary);
    max-width: 100%;
    word-wrap: break-word;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: static;
    }

    .header-right {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
        padding: 0 0.5rem;
    }

    .header {
        padding: 1.5rem 1rem;
        text-align: center;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .header-right {
        width: 100%;
        justify-content: center;
        flex-direction: row;
        gap: 1rem;
    }

    .logo h1 {
        font-size: 1.4rem;
        text-align: center;
    }

    .main-content {
        padding: 1rem;
        gap: 1rem;
        text-align: center;
    }

    .schedule-view {
        padding: 1rem;
        text-align: left;
    }

    .nav-tabs {
        padding: 0 1rem;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .event-card {
        padding: 1rem;
        text-align: left;
    }

    .tabs-container {
        gap: 0.5rem;
        justify-content: center;
    }

    .tab-btn {
        padding: 0.5rem 1rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
        text-align: left;
    }

    .chart-section {
        grid-template-columns: 1fr;
        gap: 1rem;
        justify-items: center;
    }

    .chart-container {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
    }

    .chart-container h4 {
        font-size: 0.85rem;
        text-align: center;
    }

    .chart-container canvas {
        max-height: 250px;
        width: 100% !important;
        max-width: 100%;
    }

    .insights-stat {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        text-align: center;
    }

    .insights-summary {
        padding: 1rem;
        text-align: left;
    }

    .modal-ai-output {
        padding: 0.7rem;
        font-size: 0.8rem;
        text-align: left;
    }

    .modal-outline {
        padding: 0.7rem;
        font-size: 0.85rem;
        text-align: left;
    }

    .weekly-insights {
        text-align: center;
    }

    .progress-overview, .recommendations-list {
        text-align: left;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 2026 UI refresh overrides */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #3730a3;
    --secondary-color: #0f766e;
    --accent-color: #f97316;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-bg: #f3f7fb;
    --white: #ffffff;
    --surface: #ffffff;
    --surface-raised: rgba(255, 255, 255, 0.88);
    --surface-soft: #eef6f8;
    --text-primary: #172033;
    --text-secondary: #60708a;
    --border-color: #dce6ef;
    --ring-color: rgba(79, 70, 229, 0.16);
    --shadow-sm: 0 1px 2px rgba(23, 32, 51, 0.06);
    --shadow-md: 0 10px 26px rgba(23, 32, 51, 0.08);
    --shadow-lg: 0 18px 42px rgba(23, 32, 51, 0.12);
    --shadow-xl: 0 28px 70px rgba(23, 32, 51, 0.16);
}

html[data-theme="dark"] {
    --light-bg: #0f172a;
    --white: #111827;
    --surface: #111827;
    --surface-raised: rgba(17, 24, 39, 0.9);
    --surface-soft: #172033;
    --text-primary: #f8fafc;
    --text-secondary: #b6c2d1;
    --border-color: #263548;
    --ring-color: rgba(129, 140, 248, 0.22);
}

html,
body {
    min-height: 100%;
    background:
        linear-gradient(135deg, #eef6f8 0%, #f8fafc 46%, #fff4ec 100%);
}

html[data-theme="dark"] body {
    background: linear-gradient(135deg, #08111f 0%, #111827 54%, #102522 100%);
}

body {
    letter-spacing: 0;
}

.container {
    max-width: 1680px;
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(18px);
    box-shadow: none;
}

html[data-theme="dark"] .container {
    background: rgba(15, 23, 42, 0.78);
}

.header {
    color: #fff;
    padding: 2rem;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.96) 0%, rgba(15, 118, 110, 0.96) 62%, rgba(249, 115, 22, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 0 0 28px 28px;
    box-shadow: 0 22px 55px rgba(31, 41, 55, 0.18);
}

.logo-icon,
.theme-toggle,
.header .date-range {
    color: #fff;
}

.logo h1 {
    font-size: clamp(1.45rem, 2vw, 2.15rem);
    letter-spacing: 0;
}

.header-subtitle {
    max-width: 780px;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.55;
}

.date-range {
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: 999px;
}

.nav-tabs {
    margin: 1rem 2rem 0;
    padding: 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--surface-raised);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

.tabs-container {
    gap: 0.35rem;
    padding: 0;
}

.tab-btn {
    min-width: 68px;
    padding: 0.78rem 1rem;
    border-radius: 13px;
    border-bottom: 0;
    color: var(--text-secondary);
}

.tab-btn:hover {
    background: var(--surface-soft);
    transform: translateY(-1px);
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: transparent;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.22);
}

.tab-btn[data-day="FreeTasks"].active {
    background: linear-gradient(135deg, #0f766e, #f97316);
}

.main-content {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 1.5rem;
    padding: 1.5rem 2rem 2rem;
}

.schedule-view,
.sidebar-section,
.charts-container,
.free-tasks-view,
.modal-content {
    background: var(--surface-raised);
    border: 1px solid rgba(220, 230, 239, 0.86);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
}

html[data-theme="dark"] .schedule-view,
html[data-theme="dark"] .sidebar-section,
html[data-theme="dark"] .charts-container,
html[data-theme="dark"] .free-tasks-view,
html[data-theme="dark"] .modal-content {
    border-color: rgba(38, 53, 72, 0.9);
}

.schedule-view {
    padding: 1.35rem;
}

.day-content {
    gap: 1rem;
}

.event-card {
    display: grid;
    gap: 0.45rem;
    border: 1px solid var(--border-color);
    border-left: 0;
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(79, 70, 229, 0.09), transparent 48%),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.event-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--accent, var(--primary-color));
    border-radius: 18px 0 0 18px;
}

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

.event-title {
    font-size: 1.12rem;
}

.event-badge,
.event-subject,
.task-card-tag,
.recommendation-tag,
.insights-stat-value {
    border-radius: 999px;
}

.event-badge {
    color: #fff;
}

.event-subject {
    justify-self: start;
    align-self: start;
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
}

.event-badge.deep-study {
    background: linear-gradient(135deg, #f97316, #ef4444);
}

.event-badge.revision {
    background: linear-gradient(135deg, #0ea5e9, #0f766e);
}

.record-btn,
.mini-btn,
.btn-primary,
.btn-secondary,
.btn-admin {
    border-radius: 10px;
    font-weight: 700;
}

.record-btn,
.mini-btn {
    background: var(--surface);
}

.record-btn:hover,
.mini-btn:hover {
    background: var(--surface-soft);
    box-shadow: var(--shadow-sm);
}

.btn-primary,
.submit-btn,
.btn-admin {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border: 0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-secondary {
    background: var(--surface-soft);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.btn-primary,
.btn-secondary {
    padding: 0.7rem 1rem;
}

.btn-primary:hover,
.submit-btn:hover,
.btn-admin:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(79, 70, 229, 0.22);
}

.sidebar {
    gap: 1rem;
}

.sidebar-section {
    padding: 1.15rem;
}

.sidebar-section h3 {
    font-size: 0.98rem;
}

.subject-item,
.progress-item,
.recommendation-item,
.today-focus,
.weekly-insights,
.modal-outline,
.modal-ai-output,
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.subject-item {
    border-left-width: 5px;
    box-shadow: var(--shadow-sm);
}

.subject-item:hover {
    background: var(--surface-soft);
    transform: translateX(3px);
}

.today-focus {
    border-left: 5px solid var(--secondary-color);
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(79, 70, 229, 0.08)),
        var(--surface);
}

.progress-item {
    background:
        linear-gradient(135deg, rgba(14, 165, 233, 0.09), rgba(16, 185, 129, 0.07)),
        var(--surface);
}

.recommendation-item {
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(249, 115, 22, 0.06)),
        var(--surface);
}

.legend {
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(249, 115, 22, 0.08)),
        var(--surface-raised);
}

.free-tasks-view {
    padding: 1.25rem;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(249, 115, 22, 0.08)),
        var(--surface-raised);
}

.tasks-header {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.tasks-header h3 {
    font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.tasks-header p,
.free-task-card-header p {
    max-width: 760px;
    line-height: 1.55;
}

.free-task-card,
.free-tasks-chart-panel .chart-container,
.tasks-list-section {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
}

.free-task-card {
    padding: 1.15rem;
}

.tasks-list-section {
    padding: 1.15rem;
    margin-top: 1rem;
}

.free-tasks-chart-panel {
    margin-top: 1rem;
}

.free-task-form {
    grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.9fr) minmax(150px, 0.8fr) minmax(140px, 0.7fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.free-task-form .form-actions {
    grid-column: auto;
}

.free-task-form button.submit-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 0;
    white-space: nowrap;
    background: linear-gradient(135deg, #0f766e, #f97316);
    color: #fff;
}

.free-task-form input,
.free-task-form select,
.record-session-form input,
.record-session-form textarea,
.form-group input,
.form-group select,
.form-group textarea {
    border-radius: 12px;
    border-color: var(--border-color);
    background: var(--light-bg);
    color: var(--text-primary);
}

.free-task-form input:focus,
.free-task-form select:focus,
.record-session-form input:focus,
.record-session-form textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--ring-color);
}

.task-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(249, 115, 22, 0.06)),
        var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.task-card.completed {
    border-color: rgba(16, 185, 129, 0.34);
    background:
        linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(15, 118, 110, 0.08)),
        var(--surface);
}

.task-card-header {
    min-width: 0;
}

.task-card-title {
    font-size: 1.02rem;
}

.task-card-tag {
    background: rgba(15, 118, 110, 0.12);
    color: var(--secondary-color);
}

.task-card-time {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.12);
    color: #c2410c;
}

.task-card-done {
    background: rgba(16, 185, 129, 0.13);
    color: #047857;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.task-card-actions {
    display: flex;
    justify-content: flex-end;
}

.task-card-actions .record-btn {
    min-width: 112px;
}

html[data-theme="dark"] .task-card-time {
    color: #fdba74;
}

html[data-theme="dark"] .task-card-done {
    color: #86efac;
}

.empty-note {
    background: var(--surface-soft);
    border-color: rgba(15, 118, 110, 0.28);
}

.charts-container {
    padding: 1.15rem;
}

.chart-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.chart-container {
    background: var(--surface);
    border-radius: 16px;
}

.modal-content {
    position: relative;
}

.modal {
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(8px);
}

.admin-header,
.sessions-table,
.tasks-table,
.admin-task-card,
.admin-login {
    background: var(--surface-raised) !important;
    border: 1px solid var(--border-color);
    border-radius: 20px !important;
    box-shadow: var(--shadow-md) !important;
}

.sessions-table,
.tasks-table {
    overflow-x: auto;
}

@media (max-width: 1120px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .free-task-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .free-task-form .form-actions {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0;
    }

    .header {
        border-radius: 0 0 22px 22px;
    }

    .nav-tabs {
        margin: 0.8rem 0.8rem 0;
    }

    .main-content {
        padding: 1rem 0.8rem 1.5rem;
        text-align: left;
    }

    .schedule-view {
        padding: 0.85rem;
    }

    .tabs-container {
        justify-content: flex-start;
    }

    .tab-btn {
        min-width: 58px;
        padding: 0.7rem 0.78rem;
    }

    .event-header,
    .task-card-header,
    .section-header-row {
        align-items: flex-start;
    }

    .event-header,
    .task-card-header {
        flex-direction: column;
    }

    .event-actions {
        justify-content: stretch;
    }

    .record-btn {
        width: 100%;
    }

    .free-task-form,
    .chart-section {
        grid-template-columns: 1fr;
    }

    .free-task-form .form-actions {
        grid-column: auto;
    }
}

/* Mobile spacing polish */
@media (max-width: 820px) {
    .header,
    .nav-tabs,
    .main-content,
    .schedule-view,
    .free-tasks-view,
    .sidebar-section,
    .charts-container,
    .event-card,
    .free-task-card,
    .tasks-list-section,
    .chart-container {
        --mobile-gap: 0.85rem;
    }

    .container {
        width: 100%;
        overflow-x: hidden;
    }

    .header {
        padding: 1.25rem;
    }

    .header-content,
    .header-right,
    .logo {
        gap: var(--mobile-gap);
    }

    .date-range {
        max-width: 100%;
        text-align: center;
        line-height: 1.35;
    }

    .main-content {
        gap: var(--mobile-gap);
        padding: var(--mobile-gap);
    }

    .schedule-view,
    .free-tasks-view,
    .sidebar-section,
    .charts-container {
        padding: var(--mobile-gap);
        border-radius: 18px;
    }

    .day-content,
    .tasks-list,
    .progress-overview,
    .recommendations-list,
    .subjects-list {
        gap: 0.75rem;
    }

    .event-card,
    .task-card,
    .free-task-card,
    .tasks-list-section,
    .chart-container {
        padding: 0.9rem;
        border-radius: 16px;
    }

    .event-header {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.65rem;
        align-items: start;
        margin-bottom: 0.35rem;
    }

    .event-time,
    .focus-time {
        min-width: 0;
        line-height: 1.35;
    }

    .event-title {
        font-size: 1rem;
        line-height: 1.35;
        margin-bottom: 0.2rem;
    }

    .event-badge,
    .event-subject,
    .task-card-tag,
    .task-card-day,
    .task-card-done,
    .task-card-time {
        width: fit-content;
        max-width: 100%;
        padding: 0.35rem 0.65rem;
        line-height: 1.2;
        white-space: nowrap;
    }

    .event-subject {
        margin-right: 0;
    }

    .event-description,
    .tasks-header p,
    .free-task-card-header p,
    .weekly-summary,
    .recommendation-content {
        line-height: 1.5;
    }

    .event-actions,
    .task-card-actions,
    .form-actions {
        margin-top: 0.65rem;
    }

    .record-btn,
    .submit-btn,
    .mini-btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        min-height: 42px;
    }

    .free-task-card-header,
    .task-card-header,
    .section-header-row,
    .progress-head,
    .recommendation-head {
        gap: 0.65rem;
    }

    .free-task-form,
    .record-session-form,
    .admin-task-form {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .free-task-form .form-actions,
    .admin-task-form button {
        grid-column: auto !important;
        justify-self: stretch;
        width: 100%;
    }

    .free-task-form input,
    .free-task-form select,
    .record-session-form input,
    .record-session-form textarea,
    .admin-task-form input,
    .admin-task-form select,
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
        padding: 0.78rem 0.85rem;
    }

    .modal-content {
        width: calc(100% - 1.5rem);
        max-height: calc(100vh - 1.5rem);
        padding: 1.1rem;
        border-radius: 18px;
    }

    .chart-container canvas {
        min-height: 220px;
    }
}

@media (max-width: 560px) {
    .logo {
        align-items: flex-start;
    }

    .logo h1 {
        font-size: 1.2rem;
        line-height: 1.25;
    }

    .header-right {
        flex-wrap: wrap;
    }

    .tabs-container {
        gap: 0.35rem;
    }

    .tab-btn {
        min-width: 54px;
        padding: 0.62rem 0.7rem;
    }

    .event-header {
        grid-template-columns: 1fr;
    }

    .event-badge {
        justify-self: start;
    }

    .task-card {
        grid-template-columns: 1fr;
    }

    .task-card-header {
        display: grid;
        grid-template-columns: 1fr;
    }

    .task-card-meta {
        gap: 0.4rem;
    }

    .task-card-actions,
    .task-card-actions .record-btn,
    .record-btn {
        width: 100%;
    }

    .table-toolbar,
    .admin-actions,
    .selection-actions,
    .modal-actions,
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar {
        padding: 0.85rem;
    }

    .selection-count {
        text-align: left;
    }
}

/* ==================== 3RD YEAR 1ST SEMESTER STRATEGY & SESSION ENHANCEMENTS ==================== */

.event-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
    margin-bottom: 0.5rem;
}

.difficulty-pill {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.event-reason {
    margin-top: 0.6rem;
    padding: 0.65rem 0.85rem;
    background: rgba(239, 68, 68, 0.06);
    border-left: 3px solid #ef4444;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.event-reason .reason-label {
    font-weight: 700;
    color: #dc2626;
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.event-focus {
    margin-top: 0.6rem;
    padding: 0.65rem 0.85rem;
    background: rgba(59, 130, 246, 0.06);
    border-left: 3px solid #3b82f6;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.event-focus .focus-label {
    font-weight: 700;
    color: #2563eb;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.event-focus ul {
    margin: 0;
    padding-left: 1.2rem;
}

.event-focus li {
    margin-bottom: 0.2rem;
}

.today-day-banner {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: var(--primary-color);
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.subject-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.subject-item-diff {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Strategy & Rules Dashboard */
.strategy-view {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.strategy-hero {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.strategy-hero h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.35rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strategy-hero h2 svg {
    width: 24px;
    height: 24px;
    color: #10b981;
}

.strategy-hero p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.strategy-section {
    margin-bottom: 2.25rem;
}

.strategy-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strategy-section-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.rule-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.rule-header {
    margin-bottom: 0.4rem;
}

.rule-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rule-badge svg {
    width: 14px;
    height: 14px;
}

.rule-text {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.5;
    font-weight: 500;
}

.protocol-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.protocol-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.15rem;
}

.protocol-phase-header {
    margin-bottom: 0.75rem;
}

.protocol-phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
}

.protocol-phase-badge svg {
    width: 14px;
    height: 14px;
}

.protocol-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.55;
}

.protocol-list li {
    margin-bottom: 0.4rem;
}

.ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.ranking-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.ranking-rank {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
}

.ranking-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.ranking-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
}

.ranking-level {
    font-weight: 700;
    color: #dc2626;
}

.ranking-touchpoints {
    color: var(--text-secondary);
}

.resources-list {
    display: grid;
    gap: 0.75rem;
}

.resource-item {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.resource-code {
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.resource-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Enhanced Subject Modal */
.modal-subject-tag {
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.modal-diff-badge {
    display: inline-block;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.modal-strategy-box {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    display: grid;
    gap: 0.5rem;
}

.strategy-item-good {
    color: #059669;
    font-size: 0.9rem;
    line-height: 1.45;
}

.strategy-item-bad {
    color: #dc2626;
    font-size: 0.9rem;
    line-height: 1.45;
}

.modal-resources-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.modal-schedule-list {
    margin: 0.5rem 0 1rem 0;
    padding-left: 1.25rem;
    line-height: 1.6;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .rules-grid,
    .protocol-grid,
    .ranking-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== STUDY FOCUS TIMER ==================== */
.study-timer-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(15, 118, 110, 0.08) 100%), var(--surface);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.header-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    margin-top: 0.25rem;
    letter-spacing: 0.02em;
}

.timer-mode-badge {
    background: linear-gradient(135deg, #f97316, #ef4444);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timer-display-wrap {
    text-align: center;
    margin: 1rem 0 0.85rem 0;
}

.timer-digits {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.timer-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(100, 116, 139, 0.15);
    border-radius: 999px;
    overflow: hidden;
}

.timer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 999px;
    transition: width 1s linear;
}

.timer-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.preset-btn {
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.45rem 0.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

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

.preset-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.timer-controls {
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr;
    gap: 0.5rem;
}

.timer-btn {
    padding: 0.65rem 0.5rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: none;
}

.timer-start-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.timer-start-btn.running {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.timer-reset-btn {
    background: var(--surface-soft);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.timer-log-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
}

.timer-btn:hover {
    transform: translateY(-1px);
}

/* ==================== MOBILE BOTTOM NAVIGATION BAR ==================== */
.mobile-nav-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-raised);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 999;
    padding: 0.35rem 0.5rem;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: none;
    border: none;
    padding: 0.45rem 0.2rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.mobile-nav-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

.mobile-nav-btn.active {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.08);
}

/* Tab Today Indicator */
.tab-btn.today-tab::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px var(--surface);
}

/* Responsive Overrides for Mobile & Tablet */
@media (max-width: 1024px) {
    .container {
        padding-bottom: 70px;
    }

    .mobile-nav-bar {
        display: flex;
    }

    .main-content {
        grid-template-columns: 1fr;
        padding-bottom: 2rem;
    }

    /* Support mobile section view switching */
    body[data-mobile-view="today"] .schedule-view,
    body[data-mobile-view="timer"] .schedule-view,
    body[data-mobile-view="overview"] .schedule-view {
        display: none !important;
    }

    body[data-mobile-view="schedule"] .sidebar {
        display: none;
    }

    body[data-mobile-view="today"] .sidebar-section:not(:nth-child(2)),
    body[data-mobile-view="timer"] .sidebar-section:not(.study-timer-card),
    body[data-mobile-view="overview"] .sidebar-section:not(:nth-child(3)):not(:nth-child(4)):not(:nth-child(5)):not(:nth-child(6)) {
        display: none;
    }
}


