/* Modern Premium CSS Theme for LOsys */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-color: #0d9488;
    --primary-hover: #0f766e;
    --primary-glow: rgba(13, 148, 136, 0.35);
    --secondary-color: #4f46e5;
    --secondary-hover: #4338ca;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-lg: 16px;
    --radius-md: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Newly added for light/dark theme compatibility */
    --bg-header: rgba(15, 23, 42, 0.8);
    --sidebar-bg: rgba(30, 41, 59, 0.4);
    --dropdown-bg: #1e293b;
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-focus-bg: rgba(15, 23, 42, 0.8);
    --item-bg: rgba(255, 255, 255, 0.02);
    --item-hover-bg: rgba(255, 255, 255, 0.05);
    --item-active-bg: rgba(99, 102, 241, 0.12);
    --item-active-color: #a5b4fc;
    --item-active-border: rgba(99, 102, 241, 0.3);
    --day-cell-bg: rgba(15, 23, 42, 0.6);
    --card-bg: rgba(99, 102, 241, 0.08);
    --card-hover-bg: rgba(99, 102, 241, 0.12);
    --card-border: rgba(99, 102, 241, 0.25);
    --card-hover-border: rgba(99, 102, 241, 0.45);
    --card-subject-color: #c7d2fe;
    --card-teacher-color: #86efac;
    --card-room-color: #fde68a;
    --title-gradient: linear-gradient(to right, #a5b4fc, #f8fafc);
}

.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.95);
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary-glow: rgba(13, 148, 136, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.06);

    /* Newly added for light/dark theme compatibility */
    --bg-header: rgba(255, 255, 255, 0.85);
    --sidebar-bg: rgba(241, 245, 249, 0.75);
    --dropdown-bg: #ffffff;
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-focus-bg: #ffffff;
    --item-bg: rgba(15, 23, 42, 0.02);
    --item-hover-bg: rgba(15, 23, 42, 0.04);
    --item-active-bg: rgba(13, 148, 136, 0.08);
    --item-active-color: #0f766e;
    --item-active-border: rgba(13, 148, 136, 0.25);
    --day-cell-bg: rgba(241, 245, 249, 0.9);
    --card-bg: rgba(13, 148, 136, 0.04);
    --card-hover-bg: rgba(13, 148, 136, 0.07);
    --card-border: rgba(13, 148, 136, 0.2);
    --card-hover-border: rgba(13, 148, 136, 0.35);
    --card-subject-color: #0f766e;
    --card-teacher-color: #4f46e5;
    --card-room-color: #b45309;
    --title-gradient: linear-gradient(to right, #0d9488, #4f46e5);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(13, 148, 136, 0.08) 0px, transparent 50%);
}

/* Header & Navigation */
header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    background: linear-gradient(135deg, #0d9488, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.school-logo-img {
    height: 1.25em;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.5rem;
}

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

.user-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--accent-red);
}

/* Main Container */
main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

main.wide-layout {
    max-width: 1200px;
}

.form-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
}

.form-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.form-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 2rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.field-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.form-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--input-focus-bg);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Meta Grid Layout */
.meta-section {
    background: var(--item-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    border-left: 3px solid var(--primary-color);
    padding-left: 0.5rem;
    line-height: 1;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.meta-grid .form-group {
    margin-bottom: 0;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-card {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.checkbox-card:hover {
    border-color: var(--primary-color);
    background: var(--input-focus-bg);
}

.checkbox-card input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-card input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-card input[type="checkbox"]:checked::before {
    content: "✓";
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.checkbox-card input[type="checkbox"]:focus {
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.checkbox-card.checked {
    border-color: var(--primary-color);
    background: rgba(13, 148, 136, 0.1);
}

/* Actions Section */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    margin-top: 2.5rem;
    gap: 1rem;
}

.btn {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 14px 0 rgba(13, 148, 136, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(13, 148, 136, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Notifications / Alerts */
.alert {
    background: rgba(13, 148, 136, 0.15);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.4s ease;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--accent-green);
    color: #86efac;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
    color: #fca5a5;
}

/* Auto-save status indicator */
.autosave-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.autosave-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.autosave-dot.saving {
    background-color: #eab308;
    animation: pulse 1s infinite alternate;
}

.autosave-dot.saved {
    background-color: var(--accent-green);
}

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

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Responsive Styles (Tablets, Mobiles, and Small Displays) */

/* 1. Tablet Viewports (max-width: 1024px) */
@media (max-width: 1024px) {
    main {
        margin: 1.5rem auto;
        padding: 0 1.25rem;
    }
    .form-card {
        padding: 2rem;
    }
    .meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 2. Small Tablets & Landscape Mobiles (max-width: 768px) */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    .form-card {
        padding: 1.75rem;
    }
    .meta-section {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-actions {
        flex-direction: column-reverse;
        gap: 1rem;
        align-items: stretch;
    }
    .form-actions > div {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    .form-actions > div > .btn,
    .form-actions > div > button {
        width: 100% !important;
        margin-left: 0 !important;
        justify-content: center;
    }
}

/* 3. Portrait Mobiles & Small Displays (max-width: 480px) */
@media (max-width: 480px) {
    main {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }
    .form-card {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }
    .form-title {
        font-size: 1.4rem;
    }
    .meta-grid {
        grid-template-columns: 1fr;
    }
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    .section-title {
        font-size: 1rem;
    }
    label {
        font-size: 0.95rem;
    }
}

/* PRINT MEDIA INSTRUCTIONS */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-family: "Times New Roman", Times, serif;
    }
    header, .form-actions, .field-hint, .autosave-status, button {
        display: none !important;
    }
    main {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .form-card {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .form-title {
        color: black !important;
        -webkit-text-fill-color: initial !important;
        text-align: center;
        font-size: 24pt;
        margin-bottom: 5px;
    }
    .form-subtitle {
        color: black !important;
        text-align: center;
        margin-bottom: 30px;
    }
    .form-group {
        margin-bottom: 20px;
        page-break-inside: avoid;
    }
    label {
        color: black !important;
        font-size: 12pt;
        font-weight: bold;
        border-bottom: 1px solid black;
        padding-bottom: 3px;
        margin-bottom: 8px;
    }
    .form-control {
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
        font-size: 11pt;
        color: black !important;
        line-height: 1.6;
        min-height: auto !important;
    }
    /* Value check marks for print */
    .checkbox-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
    }
    .checkbox-card {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        display: inline-flex;
    }
    .checkbox-card input[type="checkbox"] {
        border: 1px solid black !important;
        width: 12px;
        height: 12px;
    }
    .checkbox-card input[type="checkbox"]:checked {
        background: black !important;
    }
    .checkbox-card.checked {
        font-weight: bold;
    }
}

/* Global Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}
.status-draft { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.status-submitted { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.status-resubmitted { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.3); }
.status-revision { background: rgba(234, 179, 8, 0.15); color: #fef08a; border: 1px solid rgba(234, 179, 8, 0.3); }
.status-approved { background: rgba(34, 197, 94, 0.15); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.3); }

/* Aqua Theme Custom Styles (Optimized for the requested design) */
.aqua-theme {
    --bg-dark: #000c1e;
    --bg-card: rgba(0, 18, 38, 0.75);
    --border-color: rgba(0, 229, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #00e5ff; /* Vibrant light cyan/teal */
    --text-muted: rgba(0, 229, 255, 0.6);
    --primary-color: #00b0ff; /* Light blue primary */
    --primary-hover: #00e5ff;
    --primary-glow: rgba(0, 229, 255, 0.25);
    --secondary-color: #00bcd4; /* Aqua/Cyan secondary */
    --secondary-hover: #0097a7;
    --card-shadow: 0 12px 32px 0 rgba(0, 12, 30, 0.6);
    --bg-header: rgba(0, 12, 30, 0.85);
    --sidebar-bg: rgba(0, 18, 38, 0.5);
    --dropdown-bg: #001226;
    --input-bg: rgba(0, 12, 30, 0.7);
    --input-focus-bg: rgba(0, 12, 30, 0.9);
    --item-bg: rgba(0, 229, 255, 0.02);
    --item-hover-bg: rgba(0, 229, 255, 0.06);
    --item-active-bg: rgba(0, 229, 255, 0.12);
    --item-active-color: #00e5ff;
    --item-active-border: rgba(0, 229, 255, 0.35);
    --day-cell-bg: rgba(0, 12, 30, 0.7);
    --card-bg: rgba(0, 229, 255, 0.08);
    --card-hover-bg: rgba(0, 229, 255, 0.12);
    --card-border: rgba(0, 229, 255, 0.25);
    --card-hover-border: rgba(0, 229, 255, 0.5);
    --card-subject-color: #00e5ff;
    --card-teacher-color: #f59e0b; /* Gold highlights for text */
    --card-room-color: #00bcd4;
    --title-gradient: linear-gradient(to right, #00e5ff, #ffffff);
}

body.aqua-theme {
    background-color: #005288 !important;
    background-image: linear-gradient(135deg, #005288 0%, #007fa9 50%, #00b4d8 100%) !important;
    background-attachment: fixed !important;
}

/* Specific elements adjustments for the premium dashboard look in the image */
.aqua-theme .welcome-card {
    background: linear-gradient(135deg, rgba(0, 82, 136, 0.4), rgba(0, 0, 0, 0.6)) !important;
    border-color: rgba(0, 229, 255, 0.15) !important;
}

.aqua-theme .logo {
    color: #ffffff !important;
}

.aqua-theme .logo span {
    color: #eab308 !important; /* Gold logo span (sys) */
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
}

.aqua-theme .section-title {
    border-left: 3px solid #eab308 !important; /* Gold vertical bar */
    color: #ffffff !important;
}

.aqua-theme .function-card {
    background: linear-gradient(135deg, #020401 0%, #020401 40%, #025380 100%) !important;
    border: 1px solid rgba(0, 229, 255, 0.15) !important;
    box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.05), 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
}

.aqua-theme .function-card:hover {
    border-color: rgba(0, 229, 255, 0.45) !important;
    box-shadow: 0 12px 24px -10px rgba(0, 229, 255, 0.35), inset 0 0 20px rgba(0, 229, 255, 0.1) !important;
}

.aqua-theme .function-icon-wrapper {
    color: #eab308 !important; /* Gold outline icons */
    background: rgba(234, 179, 8, 0.03) !important;
    border: 1px solid rgba(234, 179, 8, 0.15) !important;
}

.aqua-theme .function-card:hover .function-icon-wrapper {
    background: rgba(234, 179, 8, 0.1) !important;
    border-color: rgba(234, 179, 8, 0.35) !important;
}

.aqua-theme .function-title {
    color: #eab308 !important; /* Gold card title */
}

.aqua-theme .function-desc {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Header buttons: translucent/white borders, gold icons, matching the reference image */
.aqua-theme .user-badge {
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.aqua-theme .user-badge:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.aqua-theme .dashboard-dropdown-btn {
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.aqua-theme .dashboard-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.aqua-theme .dashboard-dropdown-btn svg,
.aqua-theme .user-badge svg {
    color: #eab308 !important; /* Gold icons inside buttons */
}

.aqua-theme .logout-btn:hover {
    color: #ef4444 !important;
}
