/**
 * MOBILE-FIRST CSS ARCHITECTURE
 * 
 * UX Decisions:
 * 1. Deep Space Theme: High contrast dark mode (#0f172a / slate-900 base). Easier on the eyes, saves battery on OLED phones, offers excellent contrast for colored cards in sunlight.
 * 2. Mobile-First Media Queries: Base styles are for mobile.
 * 3. Typography: Uses 'Inter' which is highly legible on small screens. Large, bold subject names (Info Hierarchy).
 * 4. Card Timeline: Completely eliminates the need for horizontal scrolling in the main view.
 * 5. Horizontal Tabs: Smooth swiping between days instead of a dropdown menu, requiring fewer taps.
 */

:root {
    /* Color Palette - Slate Dark Mode (Default) */
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --header-bg: rgba(15, 23, 42, 0.95);
    --border-color: #334155;
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    /* Brand & Accents */
    --brand-color: #3b82f6; /* Blue 500 */
    --brand-color-dim: rgba(59, 130, 246, 0.15);
    
    /* Subject Colors */
    --color-math: #a78bfa; /* Violet 400 */
    --bg-math: rgba(167, 139, 250, 0.1);
    
    --color-lang: #60a5fa; /* Blue 400 */
    --bg-lang: rgba(96, 165, 250, 0.1);
    
    --color-science: #34d399; /* Emerald 400 */
    --bg-science: rgba(52, 211, 153, 0.1);
    
    --color-art: #f472b6; /* Pink 400 */
    --bg-art: rgba(244, 114, 182, 0.1);
    
    --color-sport: #fbbf24; /* Amber 400 */
    --bg-sport: rgba(251, 191, 36, 0.1);
    
    --color-eng: #38bdf8; /* Sky 400 */
    --bg-eng: rgba(56, 189, 248, 0.1);
    
    --color-empty: #475569; /* Slate 600 */
    --bg-empty: rgba(71, 85, 105, 0.05);

    /* Layout variables */
    --header-height: 120px;
    --safe-area-padding: env(safe-area-inset-bottom, 20px);
}

[data-theme="light"], body.light-theme {
    /* Slate Light Mode */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #e2e8f0;
    --header-bg: rgba(255, 255, 255, 0.95);
    --border-color: #cbd5e1;
    
    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    /* Brand & Accents */
    --brand-color: #2563eb;
    --brand-color-dim: rgba(37, 99, 235, 0.1);
    
    /* Subject Colors for Light Theme */
    --color-math: #7c3aed;
    --bg-math: rgba(124, 58, 237, 0.08);
    
    --color-lang: #2563eb;
    --bg-lang: rgba(37, 99, 235, 0.08);
    
    --color-science: #059669;
    --bg-science: rgba(5, 150, 105, 0.08);
    
    --color-art: #db2777;
    --bg-art: rgba(219, 39, 119, 0.08);
    
    --color-sport: #d97706;
    --bg-sport: rgba(217, 119, 6, 0.08);
    
    --color-eng: #0284c7;
    --bg-eng: rgba(2, 132, 199, 0.08);
    
    --color-empty: #94a3b8;
    --bg-empty: rgba(148, 163, 184, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent; /* Remove blue flash on mobile tap */
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden; /* Strict no horizontal scroll */
    min-height: 100vh;
    font-size: 16px; /* Base size for mobile legibility */
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* -------------------------------------
 * FIXED HEADER 
 * ------------------------------------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-surface);
    padding-top: env(safe-area-inset-top, 10px); /* For iOS notch */
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.portal-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}
.portal-back-btn:hover {
    background: var(--brand-color);
    color: white;
    transform: scale(1.05);
}
.portal-back-btn .material-icons-round {
    font-size: 20px;
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
}

.brand h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Styled Mobile Select */
.class-selector-wrapper {
    position: relative;
}

.class-selector-wrapper::after {
    content: "expand_more";
    font-family: 'Material Icons Round';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-color);
    pointer-events: none;
}

.class-select {
    appearance: none;
    background-color: var(--brand-color-dim);
    color: var(--brand-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.class-select:focus {
    border-color: var(--brand-color);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    background-color: var(--brand-color);
    color: #ffffff;
}
.theme-toggle-btn .material-icons-round {
    font-size: 18px;
}

/* -------------------------------------
 * DAY TABS 
 * ------------------------------------- */
.day-tabs-container {
    padding: 0 0.5rem 0.5rem;
}

.day-tabs {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none; /* Auto-hide scrollbar Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 0 0.75rem;
}

.day-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tab {
    flex: 1 0 auto; /* Allow tabs to size naturally but not shrink below content */
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    user-select: none;
}

/* Active tab style */
.tab.active {
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: var(--brand-color);
    border-radius: 3px 3px 0 0;
}

/* Truncate tabs on very small screens (show only E, T, K, N, R) */
@media (max-width: 360px) {
    .tab span { display: none; }
    .tab { padding: 0.75rem; }
}

/* -------------------------------------
 * MAIN TIMELINE CONTENT
 * ------------------------------------- */
.timeline-container {
    flex-grow: 1;
    padding: 1.25rem 1.25rem;
    overflow-y: auto;
}

.day-summary {
    margin-bottom: 1.5rem;
}

.day-summary h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.lesson-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* -------------------------------------
 * LESSON CARDS
 * ------------------------------------- */
.lesson-card {
    display: flex;
    background-color: var(--bg-surface);
    border-radius: 16px;
    overflow: hidden;
    /* Box shadow for depth without clutter */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Thicker color accent bar on the left */
.lesson-card::before {
    content: '';
    width: 6px;
    flex-shrink: 0;
    background-color: var(--color-empty); /* default */
}

.time-column {
    padding: 1rem 0.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Right align the times toward the content */
    justify-content: center;
    min-width: 85px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.time-primary {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.time-secondary {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

.lesson-number {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-color);
    margin-top: 0.5rem;
    font-weight: 700;
}

.info-column {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Typography Hierarchy inside card */
.subject {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.details {
    display: flex;
    flex-direction: column; /* Stacked on mobile */
    gap: 0.35rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-item .material-icons-round {
    font-size: 16px;
    color: var(--text-muted);
}

/* Empty State / Free period */
.lesson-card.is-empty {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    opacity: 0.9;
}
.lesson-card.is-empty::before {
    background-color: var(--color-empty);
    opacity: 0.35;
}
.lesson-card.is-empty .time-column {
    border-right: 1px solid var(--border-color);
}
.lesson-card.is-empty .free-period-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
}
.lesson-card.is-empty .free-period-icon {
    font-size: 1.35rem;
    opacity: 0.7;
}
.lesson-card.is-empty .free-period-text {
    color: var(--text-muted);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.badge-empty {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* Subject Modifiers */
.sub-math::before { background-color: var(--color-math); }
.sub-math .subject { color: var(--color-math); }

.sub-lang::before { background-color: var(--color-lang); }
.sub-lang .subject { color: var(--color-lang); }

.sub-science::before { background-color: var(--color-science); }
.sub-science .subject { color: var(--color-science); }

.sub-art::before { background-color: var(--color-art); }
.sub-art .subject { color: var(--color-art); }

.sub-sport::before { background-color: var(--color-sport); }
.sub-sport .subject { color: var(--color-sport); }

.sub-eng::before { background-color: var(--color-eng); }
.sub-eng .subject { color: var(--color-eng); }

/* Duration Badges */
.badge-duration {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 6px;
    margin-top: 0.4rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge-long {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-short {
    background: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

/* Group Pills / Väikerühm ja grupitähised */
.group-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.group-pill-accent {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.35);
}

/* Söögivahetunni infoplokk ajateljel */
.meal-break-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(217, 119, 6, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 14px;
    padding: 0.7rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.meal-icon {
    font-size: 1.4rem;
    line-height: 1;
}
.meal-info {
    display: flex;
    flex-direction: column;
}
.meal-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #fbbf24;
}
.meal-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fcd34d;
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.9;
}

/* Weekly View Badges */
.wl-badge {
    font-size: 0.65rem;
    font-weight: 800;
    margin-bottom: 3px;
    color: #38bdf8;
}
.wl-long {
    border-left: 3px solid #10b981;
}
.wl-short {
    border-left: 3px solid #818cf8;
}

/* Current time/day highlighting */
.lesson-card.is-current {
    box-shadow: 0 0 0 2px var(--brand-color);
    background-color: rgba(59, 130, 246, 0.05); /* Slight blue tint */
}
.lesson-card.is-current .lesson-number {
    color: var(--text-primary);
    background-color: var(--brand-color);
    padding: 2px 6px;
    border-radius: 4px;
}

.bottom-spacer {
    height: var(--safe-area-padding);
}

/* -------------------------------------
 * DESKTOP ADAPTATION (Tablet and up)
 * ------------------------------------- */
@media (min-width: 768px) {
    body {
        /* Restrict max width and center it on large screens making it feel like an app */
        display: flex;
        justify-content: center;
        background-color: #020617; /* Even darker outer background */
    }
    
    .app-wrapper {
        width: 100%;
        max-width: 600px; /* Constraints width for comfortable reading */
        background-color: var(--bg-base);
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
        position: relative;
    }
    
    .details {
        flex-direction: row; /* Horizontal details on tablet */
        gap: 1.5rem;
    }
}

/* -------------------------------------
 * WEEKLY VIEW & FAB
 * ------------------------------------- */

.floating-action-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--brand-color);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, background-color 0.2s;
    font-family: 'Inter', sans-serif;
}
.floating-action-btn:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

.weekly-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background-color: rgba(0, 0, 0, 0.6); /* backdrop */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.weekly-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.weekly-modal-content {
    background-color: #ffffff;
    color: #1e293b; /* Dark text for light theme */
    width: 100%;
    max-width: 1200px;
    height: 100%;
    max-height: 90vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

.weekly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.weekly-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.close-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}
.close-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.weekly-grid-container {
    padding: 1rem;
    overflow: auto;
    flex-grow: 1;
    background-color: #f1f5f9; /* sleek light background for the grid area */
}

/* Custom Scrollbar for the table */
.weekly-grid-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.weekly-grid-container::-webkit-scrollbar-track {
    background: #f1f5f9; 
}
.weekly-grid-container::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 4px;
}
.weekly-grid-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

.weekly-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 900px; /* Force minimum width to show all columns clearly */
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.weekly-table th, .weekly-table td {
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px;
    vertical-align: top;
    text-align: left;
    width: 16.666%; /* 1 col for time, 5 config days = 6 cols */
}

.weekly-table th:last-child, .weekly-table td:last-child {
    border-right: none;
}

.weekly-table th {
    background-color: #f8fafc;
    font-weight: 700;
    color: #334155;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #cbd5e1;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.weekly-table .time-cell {
    font-weight: 600;
    color: #475569;
    background-color: #f8fafc;
    text-align: center;
    vertical-align: middle;
}

.weekly-lesson {
    background-color: #e0f2fe;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.1s;
}

.weekly-lesson:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.weekly-lesson:last-child {
    margin-bottom: 0;
}

.wl-subject {
    font-weight: 800;
    color: #0c4a6e;
    font-size: 0.95rem;
    margin-bottom: 4px;
    line-height: 1.2;
}

.wl-detail {
    font-size: 0.8rem;
    color: #0369a1;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    font-weight: 500;
}

.wl-detail .material-icons-round {
    font-size: 14px;
    opacity: 0.8;
}

.wl-empty {
    color: #94a3b8;
    text-align: center;
    font-size: 0.82rem;
    padding: 12px 6px;
    font-weight: 600;
    background-color: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.wl-empty.wl-empty-gap {
    color: #b45309;
    background-color: rgba(245, 158, 11, 0.08);
    border: 1px dashed rgba(245, 158, 11, 0.4);
    font-weight: 700;
}

.wl-empty-half {
    color: #64748b;
    text-align: center;
    font-size: 0.75rem;
    padding: 5px 4px;
    font-weight: 600;
    background-color: rgba(248, 250, 252, 0.8);
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

/* Weekly View Subject Modifiers (Light Theme Adaptations) */
.wl-sub-math { background-color: rgba(139, 92, 246, 0.12); border-left-color: #8b5cf6; }
.wl-sub-math .wl-subject { color: #6d28d9; }
.wl-sub-math .wl-detail { color: #5b21b6; }

.wl-sub-lang { background-color: rgba(59, 130, 246, 0.12); border-left-color: #3b82f6; }
.wl-sub-lang .wl-subject { color: #1d4ed8; }
.wl-sub-lang .wl-detail { color: #1e40af; }

.wl-sub-science { background-color: rgba(16, 185, 129, 0.12); border-left-color: #10b981; }
.wl-sub-science .wl-subject { color: #047857; }
.wl-sub-science .wl-detail { color: #065f46; }

.wl-sub-art { background-color: rgba(236, 72, 153, 0.12); border-left-color: #ec4899; }
.wl-sub-art .wl-subject { color: #be185d; }
.wl-sub-art .wl-detail { color: #9d174d; }

.wl-sub-sport { background-color: rgba(245, 158, 11, 0.12); border-left-color: #f59e0b; }
.wl-sub-sport .wl-subject { color: #b45309; }
.wl-sub-sport .wl-detail { color: #92400e; }

.wl-sub-eng { background-color: rgba(14, 165, 233, 0.12); border-left-color: #0ea5e9; }
.wl-sub-eng .wl-subject { color: #0369a1; }
.wl-sub-eng .wl-detail { color: #075985; }

/* -------------------------------------------------------------
 * PRINT & A4 LANDSCAPE STYLES
 * ------------------------------------------------------------- */
.btn-print-weekly {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    border: none;
    padding: 7px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.25);
    transition: all 0.2s ease;
}

.btn-print-weekly:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.btn-print-weekly .material-icons-round {
    font-size: 18px;
}

.weekly-print-header {
    display: none;
    padding: 6px 10px 8px 10px;
    border-bottom: 2px solid #0f172a;
    margin-bottom: 8px;
    background: #ffffff;
}

.print-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.print-school-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.1;
}

.print-entity-name {
    font-size: 1.3rem;
    font-weight: 900;
    color: #1e3a8a;
    margin: 0;
    line-height: 1.2;
}

.print-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.print-badge {
    display: inline-block;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-date-str {
    font-size: 0.75rem;
    color: #475569;
    font-weight: 600;
}

@page {
    size: A4 landscape;
    size: landscape;
    margin: 5mm 8mm;
}

@media print {
    html, body {
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #0f172a !important;
        overflow: hidden !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .app-header,
    .navigation-wrapper,
    .timeline-container,
    .floating-action-btn,
    .bottom-spacer,
    .weekly-header,
    .no-print {
        display: none !important;
    }

    .weekly-modal {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
        break-inside: avoid !important;
    }

    .weekly-modal-content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 100vh !important;
        height: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        overflow: hidden !important;
        background: #ffffff !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .weekly-print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: flex-end;
        padding: 0 0 3px 0 !important;
        margin: 0 0 4px 0 !important;
        border-bottom: 1.5px solid #0f172a !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    .print-school-title {
        font-size: 1.05rem !important;
        margin: 0 !important;
    }

    .print-entity-name {
        font-size: 1.25rem !important;
        margin: 0 !important;
    }

    .weekly-grid-container {
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    .weekly-table {
        min-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
        border: 1.5px solid #334155 !important;
        border-collapse: collapse !important;
        table-layout: fixed !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: avoid !important;
    }

    .weekly-table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .weekly-table th, .weekly-table td {
        border: 1px solid #94a3b8 !important;
        padding: 2px 4px !important;
        vertical-align: top !important;
    }

    .weekly-table th {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
        border-bottom: 2px solid #334155 !important;
        font-size: 0.78rem !important;
        padding: 3px 2px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .weekly-table .time-cell {
        background-color: #f8fafc !important;
        border-right: 2px solid #334155 !important;
        font-size: 0.68rem !important;
        padding: 2px 3px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .weekly-lesson {
        padding: 2px 4px !important;
        margin-bottom: 2px !important;
        box-shadow: none !important;
        border-radius: 3px !important;
        border-left-width: 3px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        page-break-inside: avoid !important;
    }

    .wl-subject {
        font-size: 0.74rem !important;
        font-weight: 800 !important;
        margin-bottom: 0px !important;
        line-height: 1.1 !important;
    }

    .wl-detail {
        font-size: 0.64rem !important;
        font-weight: 600 !important;
        margin-bottom: 0px !important;
        line-height: 1.05 !important;
    }

    .wl-badge {
        display: none !important; /* Peida taustapildid/märgised prindil kõrguse säästmiseks */
    }

    .wl-period-tag {
        font-weight: 700 !important;
        color: #1e40af !important;
        font-size: 0.68rem !important;
    }

    .wl-empty {
        padding: 2px !important;
        font-size: 0.64rem !important;
        border: 1px dashed #cbd5e1 !important;
        background-color: #fafafa !important;
    }

    .wl-empty-half {
        padding: 1px 2px !important;
        font-size: 0.6rem !important;
        border: 1px dashed #e2e8f0 !important;
        margin-top: 1px !important;
    }
}


