@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------- RESET & BASE ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-body: #eef1f7;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #d1d9e6;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
    --shadow-md: 0 4px 16px rgba(15,23,42,0.10), 0 2px 6px rgba(15,23,42,0.06);
    --shadow-lg: 0 16px 48px rgba(15,23,42,0.14), 0 4px 16px rgba(15,23,42,0.06);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #080d1a;
        --bg-card: #111827;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #1f2d3d;
        --primary-light: #1e1b4b;
        color-scheme: dark;
    }
}

body.dark {
    --bg-body: #080d1a;
    --bg-card: #111827;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #1f2d3d;
    --primary-light: #1e1b4b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
    color-scheme: dark;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    padding: 16px;
    transition: background 0.3s, color 0.3s;
}

button {
    cursor: pointer;
    font: inherit;
}

input,
select,
textarea {
    font: inherit;
}

/* ---------- APP WRAPPER ---------- */
#app {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

/* ---------- HEADER ---------- */
.app-header {
    background: linear-gradient(135deg, #3730a3 0%, #4f46e5 50%, #7c3aed 100%);
    padding: 20px 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(79,70,229,0.3);
}

.app-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header h1 span {
    font-weight: 400;
    font-size: 14px;
    opacity: 0.8;
    margin-left: 4px;
}

.header-date {
    font-size: 15px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 16px;
    border-radius: 40px;
    backdrop-filter: blur(4px);
}

/* ---------- TAB NAV ---------- */
.tab-nav {
    display: flex;
    gap: 2px;
    padding: 0 20px;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.tab-nav button {
    background: transparent;
    border: none;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.01em;
}

.tab-nav button:hover {
    color: var(--text-main);
    background: var(--primary-light);
}

.tab-nav button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

.tab-nav button .badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    padding: 0 8px;
    border-radius: 20px;
    font-weight: 600;
}

.tab-nav button.active .badge {
    background: #4f46e5;
    color: #fff;
}

/* ---------- TAB CONTENT ---------- */
.tab-content {
    display: none;
    padding: 28px;
    flex: 1;
    animation: fadeIn 0.25s ease;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- TOAST ---------- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    width: 100%;
}

.toast {
    padding: 14px 20px;
    border-radius: 12px;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: #059669;
}

.toast.error {
    background: #dc2626;
}

.toast.info {
    background: #2563eb;
}

.toast.warning {
    background: #d97706;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- CARDS & UTILITY ---------- */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 22px 26px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.flex-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.flex-between {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gap-8 {
    gap: 8px;
}

.mt-12 {
    margin-top: 12px;
}

.mb-12 {
    margin-bottom: 12px;
}

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

.text-muted {
    color: #94a3b8;
    font-size: 14px;
}

.text-sm {
    font-size: 14px;
}

/* ---------- FORM ELEMENTS ---------- */
label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    display: block;
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}

::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-card);
    transition: border 0.2s, box-shadow 0.2s;
}

option {
    background-color: var(--bg-card);
    color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    background: var(--bg-card);
}

textarea {
    resize: vertical;
    min-height: 50px;
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.input-group>div {
    flex: 1;
    min-width: 160px;
}

/* ---------- BUTTONS ---------- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #1e293b;
    letter-spacing: 0.01em;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    box-shadow: 0 4px 16px rgba(79,70,229,0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5,150,105,0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 4px 14px rgba(5,150,105,0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(220,38,38,0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 4px 14px rgba(220,38,38,0.35);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(217,119,6,0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 14px rgba(217,119,6,0.35);
}

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

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

.btn-outline-danger {
    color: #ef4444;
    border-color: #fca5a5;
}

.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ---------- CARDS (Daily Entry Mobile First) ---------- */
.period-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.period-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.period-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.period-badge {
    background: var(--primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
}

.period-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 13px;
    color: var(--text-muted);
}

.period-class {
    font-weight: 600;
    color: var(--text-main);
}


.period-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.autosave-indicator {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sticky Save (Mobile) */
.sticky-save {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

@media (min-width: 900px) {
    .sticky-save {
        display: none;
    }
}

/* ---------- VIEW ACTIVITIES ---------- */
.view-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.view-controls .search-box {
    flex: 2;
    min-width: 200px;
    position: relative;
}

.view-controls .search-box input {
    padding-left: 38px;
}

.view-controls .search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 18px;
}

.view-controls .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.view-controls .filter-group input,
.view-controls .filter-group select {
    width: auto;
    padding: 8px 12px;
    min-width: 120px;
}

.day-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.day-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 8px 24px rgba(79,70,229,0.12);
    transform: translateY(-2px);
}

.day-card .day-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.day-card .day-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.day-card .day-date {
    font-weight: 700;
    font-size: 18px;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.day-card .day-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.day-card .day-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f8fafc;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-icon.btn-edit:hover {
    background: #e0e7ff;
    color: #4f46e5;
}

.btn-icon.btn-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.chevron-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chevron-icon svg {
    width: 20px;
    height: 20px;
}

.day-card.expanded .chevron-icon {
    transform: rotate(180deg);
}

.day-card .period-list {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
    display: none;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.day-card.expanded .period-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.day-card .period-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
    gap: 16px;
}

.day-card .period-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.day-card .p-label {
    width: 48px;
    flex-shrink: 0;
}

.day-card .p-num {
    display: inline-block;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 8px;
}

.day-card .p-class {
    width: 120px;
    flex-shrink: 0;
}

.day-card .badge-class {
    display: inline-block;
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.day-card .p-work, .day-card .p-home {
    flex: 1;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.day-card .icon-label {
    opacity: 0.8;
    font-size: 16px;
}

.day-card .p-files {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.day-card .file-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 16px;
}

.day-card .file-link:hover {
    background: #cbd5e1;
    transform: translateY(-1px);
}

.day-card .empty-files {
    color: #cbd5e1;
}

.empty-state {
    text-align: center;
    padding: 64px 20px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px dashed var(--border);
}

.empty-state .emoji-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: #f8fafc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state .emoji {
    font-size: 40px;
    display: block;
}

.empty-state h3 {
    font-size: 18px;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ================================================================
   PHASE 3: APPROVAL WORKFLOW STYLES
   ================================================================ */

/* Submit Button */
.btn-submit {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

/* Approval Status Banner */
.approval-status-banner {
    margin-top: 16px;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1.5px solid transparent;
    transition: all 0.3s;
}

.approval-status-banner.status-submitted {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
}

.approval-status-banner.status-approved {
    background: #f0fdf4;
    border-color: #10b981;
}

.approval-status-banner.status-revision {
    background: rgba(244, 63, 94, 0.1);
    border-color: #f43f5e;
}

.approval-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.approval-status-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.approval-status-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.approval-status-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}

.approval-status-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* Revision Note Box */
.revision-note-box {
    background: rgba(252, 165, 165, 0.1);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-main);
}

.revision-note-box p {
    margin: 4px 0 0;
    line-height: 1.6;
}

/* Locked period cards */
.period-card input:disabled,
.period-card textarea:disabled,
.period-card select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-body);
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.status-draft {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-submitted {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid #fcd34d;
}

.status-approved {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid #6ee7b7;
}

.status-revision {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border: 1px solid #fda4af;
}

/* ----------------------------------------------------------------
   PRINCIPAL DASHBOARD
   ---------------------------------------------------------------- */
.principal-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.principal-subtabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #f1f5f9;
    padding: 0 24px;
    margin-top: 16px;
}

.principal-subtab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: none;
    cursor: pointer;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.principal-subtab.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.principal-content {
    padding: 24px;
    min-height: 300px;
}

.principal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 0;
    color: #94a3b8;
}

.principal-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.principal-empty-state span {
    font-size: 48px;
}

.principal-empty-state h3 {
    color: #1e293b;
    font-size: 18px;
    margin: 0;
}

/* Submission List */
.submission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.submission-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.submission-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 6px 20px rgba(79,70,229,0.12);
    transform: translateY(-1px);
}

.submission-card.approved {
    cursor: default;
}

.submission-card.approved:hover {
    transform: none;
    box-shadow: none;
}

.submission-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.submission-avatar.approved {
    background: linear-gradient(135deg, #059669, #10b981);
}

.submission-info {
    flex: 1;
    min-width: 0;
}

.submission-teacher {
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
}

.submission-date {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.submission-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.submission-action {
    flex-shrink: 0;
}

/* ----------------------------------------------------------------
   REVIEW MODAL (PRINCIPAL)
   ---------------------------------------------------------------- */
.review-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    padding: 16px;
}

.review-modal {
    background: var(--bg-card);
    border-radius: 20px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.review-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-radius: 20px 20px 0 0;
}

.review-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.review-modal-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 4px 0 0;
}

.review-modal-periods {
    padding: 16px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-period-row {
    display: flex;
    gap: 16px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.review-period-row:hover {
    border-color: #e2e8f0;
}

.review-period-num {
    flex-shrink: 0;
    padding-top: 2px;
}

.review-period-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.review-field {
    font-size: 14px;
    color: #475569;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.review-field-label {
    font-weight: 600;
    color: #94a3b8;
    font-size: 12px;
    min-width: 70px;
    flex-shrink: 0;
}

.revision-note-input {
    margin: 0 24px;
    padding: 16px;
    background: rgba(254, 215, 170, 0.1);
    border: 1px solid #fed7aa;
    border-radius: 12px;
}

.revision-note-input label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #9a3412;
    margin-bottom: 8px;
}

.revision-note-input textarea {
    width: 100%;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-main);
    resize: vertical;
    box-sizing: border-box;
}

.review-modal-actions {
    display: flex;
    gap: 10px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    border-radius: 0 0 20px 20px;
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* ---------- SETTINGS ---------- */

.settings-group {
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.settings-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-group .group-title {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.settings-row>div {
    flex: 1;
    min-width: 180px;
}

.settings-row .btn {
    flex-shrink: 0;
}

.settings-row label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.settings-row input {
    padding: 8px 12px;
}

.settings-help {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ---------- LANDING PAGE ---------- */
.landing-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-body);
}

/* Landing Navbar */
.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: var(--bg-card);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.landing-logo {
    font-size: 24px;
    font-weight: 700;
    color: #4f46e5;
}

.landing-nav-links {
    display: flex;
    gap: 16px;
}

/* Landing Hero */
.landing-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    flex: 1;
}

.landing-hero-content {
    max-width: 800px;
    margin-bottom: 60px;
}

.landing-title {
    font-size: 52px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 24px;
    letter-spacing: -1.5px;
    line-height: 1.15;
}

.landing-subtitle {
    font-size: 20px;
    color: var(--text-muted);
    margin-bottom: 40px;
    line-height: 1.6;
}

.landing-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

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

/* Features Section */
.landing-features {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1000px;
    margin-top: 40px;
}

.feature-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    flex: 1;
    min-width: 250px;
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    transform: translateY(-6px);
    border-color: #a5b4fc;
    box-shadow: 0 16px 40px rgba(79,70,229,0.15);
}

.feature-card h3 {
    font-size: 20px;
    color: var(--text-main);
    margin-bottom: 12px;
    font-weight: 700;
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    #app {
        border-radius: 0;
        margin: 0;
        width: 100%;
        min-height: 100vh;
        box-shadow: none;
    }
    .landing-title {
        font-size: 32px;
    }
    .landing-subtitle {
        font-size: 16px;
    }
    .app-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .app-header h1 {
        font-size: 19px;
        justify-content: center;
    }

    .header-date {
        text-align: center;
    }

    .tab-nav {
        padding: 0 12px;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: none;
    }
    
    /* Hide scrollbar for tab nav but keep it scrollable */
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    .tab-nav {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .tab-nav button {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .tab-nav button {
        padding: 10px 14px;
        font-size: 13px;
    }

    .tab-content {
        padding: 16px;
    }

    .card {
        padding: 16px;
    }

    .period-table th,
    .period-table td {
        padding: 4px 6px;
        font-size: 13px;
    }

    .period-table .period-num {
        width: 40px;
        font-size: 13px;
    }

    .period-table input,
    .period-table textarea {
        font-size: 13px;
        padding: 6px 8px;
    }

    .day-card .period-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .day-card .p-label, .day-card .p-class, .day-card .p-files {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
    
    .day-card .p-files {
        justify-content: flex-start;
        margin-top: 4px;
    }

    .settings-row {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-row>div {
        min-width: unset;
    }

    .view-controls {
        flex-direction: column;
    }

    .view-controls .filter-group {
        width: 100%;
    }

    .view-controls .filter-group input,
    .view-controls .filter-group select {
        flex: 1;
        min-width: 0;
    }

    #toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .tab-nav button {
        font-size: 12px;
        padding: 8px 10px;
    }

    .tab-nav button .badge {
        font-size: 10px;
        padding: 0 6px;
    }

    .period-table th,
    .period-table td {
        font-size: 12px;
        padding: 3px 4px;
    }

    .period-table input,
    .period-table textarea {
        font-size: 12px;
        padding: 4px 6px;
    }

    .period-table .period-num {
        width: 30px;
        font-size: 12px;
    }
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- LOADING SPINNER ---------- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

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

/* ---------- MISC ---------- */
.chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
}

.chip-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.chip-green {
    background: #d1fae5;
    color: #065f46;
}

.highlight-match {
    background: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}

/* ---------- PHOTO UPLOAD & PREVIEW ---------- */
.photo-cell {
    text-align: center;
    vertical-align: middle;
    position: relative;
}
.photo-preview-container {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    background: #f8fafc;
}
.photo-preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    display: block;
}
.photo-remove-btn {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #dc2626;
    color: #fff;
    border: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}
.photo-remove-btn:hover {
    transform: scale(1.15);
    background: #b91c1c;
}

.p-photo {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.view-photo-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    cursor: zoom-in;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s;
}
.view-photo-thumb:hover {
    transform: scale(1.05);
}

/* ---------- LIGHTBOX ---------- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}
.lightbox-container {
    position: relative;
    max-width: 90%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lightbox-overlay.active .lightbox-image {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    user-select: none;
}
.lightbox-close:hover {
    color: #ef4444;
    transform: scale(1.1);
}

/* ---------- AUTHENTICATION PORTAL ---------- */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(-45deg, #0f172a, #1e1b4b, #2e1065, #020617);
    background-size: 400% 400%;
    animation: authGradient 15s ease infinite;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.auth-overlay.active {
    display: flex;
    opacity: 1;
}
.auth-card {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1), 
                inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    text-align: center;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: #f1f5f9;
}
.auth-overlay.active .auth-card {
    transform: translateY(0) scale(1);
}
.auth-logo {
    font-size: 42px;
    margin-bottom: 12px;
    display: inline-block;
    filter: drop-shadow(0 0 12px rgba(129, 140, 248, 0.3));
    animation: floatLogo 3s ease-in-out infinite;
}
@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}
.auth-subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 28px;
}
.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
    position: relative;
}
.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.25s ease;
}
.auth-tab.active {
    color: #a5b4fc;
    border-bottom-color: #818cf8;
}
.auth-form-group {
    text-align: left;
    margin-bottom: 18px;
}
.auth-form-group label {
    margin-bottom: 6px;
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
}
.auth-form-group input {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #0f172a;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}
.auth-form-group input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.3);
}
.auth-form-group input::placeholder {
    color: #94a3b8;
}
.auth-btn-submit {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}
.auth-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
}
.auth-btn-submit:active {
    transform: translateY(0);
}

.auth-local-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 13px;
    color: #94a3b8;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}
.auth-local-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

/* ---------- GOOGLE OAUTH BUTTON ---------- */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #475569;
    font-size: 13px;
    margin: 18px 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-divider:not(:empty)::before {
    margin-right: .5em;
}
.auth-divider:not(:empty)::after {
    margin-left: .5em;
}
.auth-divider span {
    color: #64748b;
    font-weight: 500;
}

.auth-btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}
.auth-btn-google:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
.auth-btn-google:focus-visible {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
}
.auth-btn-google:active:not(:disabled) {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.03);
}
.auth-btn-google:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.google-icon {
    flex-shrink: 0;
}

/* ---------- USER HEADER BANNER ---------- */
.header-user-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 40px;
    backdrop-filter: blur(4px);
    font-size: 14px;
}
.header-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}
.header-user-email {
    font-weight: 500;
    color: #fff;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-signout {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-signout:hover {
    background: rgba(239, 68, 68, 0.4);
}

/* ---------- SQL HELPER UI ---------- */
.sql-helper-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sql-helper-header {
    padding: 14px 20px;
    background: #f1f5f9;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background 0.2s;
}

.sql-helper-header:hover {
    background: #e2e8f0;
}

.sql-helper-header .chevron {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.sql-helper-box.expanded .sql-helper-header .chevron {
    transform: rotate(180deg);
}

.sql-helper-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sql-helper-box.expanded .sql-helper-content {
    max-height: 1000px;
}

.sql-helper-body {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.sql-helper-body ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.sql-helper-body li {
    margin-bottom: 6px;
}

.code-container {
    position: relative;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 8px;
    padding: 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    margin: 12px 0;
    overflow-x: auto;
    white-space: pre;
}

.copy-sql-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-sql-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- AUTOCOMPLETE DROPDOWN ---------- */
.autocomplete-dropdown {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    z-index: 10000;
    max-height: 220px;
    overflow-y: auto;
    width: 220px;
}

.autocomplete-item {
    padding: 10px 14px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s, color 0.2s;
}

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

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(99, 102, 241, 0.8);
    color: #ffffff;
}

/* ---------- CURRICULUM STATUS BANNER ---------- */
.curriculum-status-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}
.curriculum-status-banner.loading {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.05);
    color: #818cf8;
}
.curriculum-status-banner.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
    color: #f87171;
}
.curriculum-status-banner.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
    color: #4ade80;
}
.curriculum-status-banner.hidden {
    display: none;
}
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}
.status-icon {
    font-size: 16px;
}

/* Disable tab animations and stacking contexts during active tour to allow proper Intro.js highlighting */
body.tour-active .tab-content,
body.tour-active .card,
body.tour-active .period-table-wrap {
    animation: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    overflow: visible !important;
}

/* ---------- PHASE 2: FILE UPLOADS ---------- */
.file-attach-zone {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 12px;
    position: relative;
    overflow: hidden;
}

.file-item-icon {
    font-size: 16px;
    margin-right: 8px;
}

.file-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    font-weight: 500;
}

.file-item-name a {
    color: var(--primary);
    text-decoration: none;
}

.file-item-name a:hover {
    text-decoration: underline;
}

.file-item-size {
    color: var(--text-muted);
    font-size: 11px;
    margin-right: 12px;
    margin-left: 8px;
}

.file-item-remove {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    flex-shrink: 0;
}

.file-item-remove:hover {
    background: #dc2626;
}

.file-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface-hover, #f8fafc);
    border: 1.5px dashed var(--border-color, #e2e8f0);
    color: var(--text-secondary, #64748b);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    transition: all 0.2s ease;
}

.file-add-btn:hover {
    background: rgba(79, 70, 229, 0.05);
    border-color: var(--primary, #4f46e5);
    color: var(--primary, #4f46e5);
}

.file-add-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.file-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border-color, #e2e8f0);
    color: var(--text-muted, #94a3b8);
    background: var(--surface, #ffffff);
}

.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-hover, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-primary, #1e293b);
    text-decoration: none;
    transition: all 0.2s ease;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-pill:hover {
    background: rgba(79, 70, 229, 0.05);
    border-color: var(--primary, #4f46e5);
    color: var(--primary, #4f46e5);
}

.file-pill svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ==========================================================================
   HISTORY MODAL & VERSION TIMELINE
   ========================================================================== */

.history-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.history-panel {
    background: white;
    width: 90%;
    max-width: 800px;
    height: 90vh;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.history-panel-header h2 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-panel-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    background: var(--bg-card);
}

/* Timeline */
.history-view-section {
    margin-bottom: 24px;
}

.history-view-section h3 {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: #0f172a;
}

.history-period-group {
    margin-bottom: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}

.history-period-group h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #475569;
}

.version-timeline {
    position: relative;
    padding-left: 20px;
}

.version-timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 0;
    left: 23px;
    width: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.version-step {
    position: relative;
    margin-bottom: 24px;
    padding-left: 24px;
}

.version-step:last-child {
    margin-bottom: 0;
}

.step-dot {
    position: absolute;
    left: -4px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8;
    z-index: 2;
    border: 2px solid #f8fafc;
}

.version-step.current .step-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

.step-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.step-title {
    font-weight: 600;
    font-size: 13px;
    color: #0f172a;
}

.step-meta {
    font-size: 12px;
    color: #475569;
}

.step-details {
    font-size: 13px;
    color: #0f172a;
}

.diff-chip {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}
.diff-chip.added { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.diff-chip.neutral { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.diff-chip.edited { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

.diff-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.diff-block-row {
    margin-bottom: 16px;
}
.diff-block-row:last-child {
    margin-bottom: 0;
}

.diff-field-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.diff-compare {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.diff-before, .diff-after {
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    border: 1px solid transparent;
}

.diff-before {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
    text-decoration: line-through;
    opacity: 0.8;
}

.diff-after {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.diff-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

.before-label { background: #fee2e2; color: #991b1b; }
.after-label { background: #d1fae5; color: #065f46; }

.diff-row {
    margin-bottom: 6px;
    line-height: 1.5;
}
.diff-row:last-child { margin-bottom: 0; }

.diff-field { font-weight: 600; color: #475569; }
.diff-new-val { color: #10b981; font-weight: 500; }


/* Audit Log Table */
.audit-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.audit-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.audit-log-table th, .audit-log-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.audit-log-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.audit-log-table tbody tr:last-child td {
    border-bottom: none;
}

.audit-log-table tbody tr {
    transition: background-color 0.15s;
}

.audit-log-table tbody tr:hover {
    background-color: #f8fafc;
}

.badge-role {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    margin-left: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid #e2e8f0;
}

.audit-action {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.audit-action.create {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

.audit-action.approve {
    background: #fdf4ff;
    color: #c026d3;
    border-color: #f5d0fe;
}

.audit-action.submit {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

.audit-action.revise {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

/* Teacher Analytics Bar Chart */
.analytics-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow-x: auto;
    padding-top: 10px;
}

.analytics-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 20px;
    position: relative;
    height: 100%;
    justify-content: flex-end;
}

.analytics-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    min-height: 4px; /* for days with 0 */
    transition: height 0.3s ease, background-color 0.2s;
    cursor: pointer;
}

.analytics-bar:hover {
    filter: brightness(0.9);
}

.analytics-bar.status-approved { background-color: #10b981; }
.analytics-bar.status-submitted { background-color: #f59e0b; }
.analytics-bar.status-revision { background-color: #ef4444; }
.analytics-bar.status-missing { background-color: #e2e8f0; }

.analytics-bar-label {
    font-size: 9px;
    color: var(--text-muted);
    position: absolute;
    bottom: -18px;
    white-space: nowrap;
    transform: translateX(-50%);
    left: 50%;
}

/* ==========================================
   NOTIFICATIONS
   ========================================== */
.notification-card {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    background: var(--bg-card);
}

.notification-card:hover {
    background: var(--bg-main);
}

.notification-card.unread {
    background: #f0fdf4;
}

body.dark .notification-card.unread {
    background: rgba(16, 185, 129, 0.1);
}

.notification-icon {
    font-size: 24px;
    margin-right: 16px;
    background: var(--bg-main);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.notification-content {
    flex: 1;
}

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

.notification-message {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.notification-time {
    font-size: 11px;
    color: #94a3b8;
}

.notification-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: 6px;
}

.notification-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.audit-log-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.audit-log-table tbody tr:last-child td {
    border-bottom: none;
}

.audit-log-table tbody tr {
    transition: background-color 0.15s;
}

.audit-log-table tbody tr:hover {
    background-color: #f8fafc;
}

.badge-role {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    margin-left: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid #e2e8f0;
}

.audit-action {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.audit-action.create {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

.audit-action.approve {
    background: #fdf4ff;
    color: #c026d3;
    border-color: #f5d0fe;
}

.audit-action.submit {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

.audit-action.revise {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

/* Teacher Analytics Bar Chart */
.analytics-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow-x: auto;
    padding-top: 10px;
}

.analytics-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 20px;
    position: relative;
    height: 100%;
    justify-content: flex-end;
}

.analytics-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    min-height: 4px; /* for days with 0 */
    transition: height 0.3s ease, background-color 0.2s;
    cursor: pointer;
}

.analytics-bar:hover {
    filter: brightness(0.9);
}

.analytics-bar.status-approved { background-color: #10b981; }
.analytics-bar.status-submitted { background-color: #f59e0b; }
.analytics-bar.status-revision { background-color: #ef4444; }
.analytics-bar.status-missing { background-color: #e2e8f0; }

.analytics-bar-label {
    font-size: 9px;
    color: var(--text-muted);
    position: absolute;
    bottom: -18px;
    white-space: nowrap;
    transform: translateX(-50%);
    left: 50%;
}

/* ==========================================
   NOTIFICATIONS
   ========================================== */
.notification-card {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    background: var(--bg-card);
}

.notification-card:hover {
    background: var(--bg-main);
}

.notification-card.unread {
    background: #f0fdf4;
}

body.dark .notification-card.unread {
    background: rgba(16, 185, 129, 0.1);
}

.notification-icon {
    font-size: 24px;
    margin-right: 16px;
    background: var(--bg-main);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.notification-content {
    flex: 1;
}

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

.notification-message {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.notification-time {
    font-size: 11px;
    color: #94a3b8;
}

.notification-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: 6px;
}

.notification-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* ==========================================
   INTRO.JS THEME INTEGRATION
   ========================================== */
.introjs-tooltip {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border) !important;
}
.introjs-tooltip .introjs-tooltip-title {
    color: var(--text-main) !important;
}
.introjs-arrow.top {
    border-bottom-color: var(--bg-card) !important;
}
.introjs-arrow.bottom {
    border-top-color: var(--bg-card) !important;
}
.introjs-arrow.left {
    border-right-color: var(--bg-card) !important;
}
.introjs-arrow.right {
    border-left-color: var(--bg-card) !important;
}
.introjs-button {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border) !important;
    text-shadow: none !important;
}
.introjs-button:hover,
.introjs-button:focus {
    background-color: var(--primary) !important;
    color: #fff !important;
}
.introjs-skipbutton {
    color: var(--text-muted) !important;
}
.introjs-tooltiptext {
    color: var(--text-main) !important;
}
.introjs-bullets ul li a {
    background: var(--border) !important;
}
.introjs-bullets ul li a.active {
    background: var(--primary) !important;
}

/* ================================================================
   VIEW MODES (Cards, Compact, Focus)
   ================================================================ */

.daily-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-body);
    padding: 12px 0 8px 0;
    border-bottom: 1px solid var(--border);
}

.completion-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.stats-bar-container {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.stats-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.floating-save-status {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.floating-save-status.visible {
    opacity: 1;
    transform: translateY(0);
}


/* View Mode Switcher (Segmented Control) */
.view-mode-switcher {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}
.view-mode-switcher .view-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.view-mode-switcher .view-btn:hover {
    color: var(--text-main);
    background: rgba(0,0,0,0.03);
}
body.dark .view-mode-switcher .view-btn:hover {
    background: rgba(255,255,255,0.05);
}
.view-mode-switcher .view-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

/* Status Bar */
.period-status-bar {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
}
.period-status-bar::-webkit-scrollbar {
    height: 4px;
}
.period-status-bar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s;
    white-space: nowrap;
}
.status-pill:hover {
    border-color: var(--text-muted);
}
.status-pill.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.status-num {
    opacity: 0.8;
}

/* View Behaviors */

/* 1. Cards Mode (Default) */
.view-cards .period-card { display: flex; transition: all 0.2s; }
.view-cards .period-card-header { cursor: pointer; }
.view-cards .period-card.collapsed .period-body { display: none; }
.view-cards .compact-chevron { transition: transform 0.2s; }
.view-cards .period-card.collapsed .compact-chevron { transform: rotate(-90deg); }

/* 2. Compact Mode (Accordion) */
.view-compact .period-card { display: flex; }
.view-compact .period-card-header { cursor: pointer; }
.view-compact .period-body { display: none; }
.view-compact .period-card.active .period-body { display: block; }
.view-compact .period-card .compact-chevron { transition: transform 0.2s; }
.view-compact .period-card.active .compact-chevron { transform: rotate(180deg); }

/* 3. Focus Mode */
.view-focus .period-card { 
    display: none; 
    opacity: 0;
    transform: translateX(15px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.view-focus .period-card.focused { 
    display: flex; 
    opacity: 1;
    transform: translateX(0);
}
.view-focus .compact-chevron { display: none; }
.view-focus .period-card-header { cursor: default !important; }

/* Focus Nav (Prev/Next) */
.focus-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-top: -12px;
}
.focus-nav-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
}
