/* Student Plan - Mobile-first, Compact Layout */

:root {
    --forest-dark: #2d5016;
    --forest-medium: #3d6b1f;
    --olive-green: #6b7d3a;
    --beige-cell: #c9a877;
    --brown-button: #4a3728;
    --brown-hover: #5c4833;
    --paper-light: #e8d4b8;
    --accent: #f1c40f;
    --danger: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2d5016;
    background-image: url('assets/textures/bg-dark-wood.png');
    background-repeat: repeat;
    min-height: 100vh;
}

/* Login Screen (reused from planer) */
#login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest-medium) 100%);
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1em;
}

.login-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: var(--accent);
    color: #2d2416;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: #f39c12;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.4);
}

#login-error {
    color: #e74c3c;
    margin-top: 10px;
    text-align: center;
}

/* Main Container */
.student-plan-container {
    max-width: 100vw;
    min-height: 100vh;
    background: url('assets/textures/bg-parchment.png') repeat;
    background-color: #f5ead3;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
}

/* Header */
.student-plan-header {
    background: linear-gradient(135deg, var(--olive-green) 0%, var(--forest-medium) 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--forest-dark);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.student-plan-header h1 {
    font-size: 1.5em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 15px;
    font-size: 0.9rem;
    font-weight: bold;
    background: var(--brown-button);
    color: white;
    border: 2px solid var(--brown-hover);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.btn:hover {
    background: var(--brown-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.logout-btn {
    background: var(--danger);
    border-color: var(--danger);
}

.logout-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

/* Student Selector */
.student-selector {
    padding: 8px 12px;
    font-size: 1em;
    border-radius: 6px;
    border: 2px solid white;
    background: white;
    color: #2d2416;
    font-weight: bold;
    cursor: pointer;
    min-width: 150px;
}

/* Week Navigation */
.week-navigation {
    background: var(--paper-light);
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid var(--olive-green);
}

.week-nav-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    background: var(--brown-button);
    color: white;
    border: 2px solid var(--brown-hover);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.week-nav-btn:hover {
    background: var(--brown-hover);
    transform: translateY(-2px);
}

.week-display {
    font-size: 1.1em;
    font-weight: bold;
    color: #2d2416;
    min-width: 200px;
    text-align: center;
}

/* Schedule Grid Wrapper */
.schedule-grid-wrapper {
    padding: 20px;
    padding-bottom: 100px;
    overflow-x: auto;
    background: transparent;
    min-height: calc(100vh - 200px);
}

/* Schedule Table */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    background-color: #f5ead3;
    background-image: url('assets/textures/bg-parchment.png');
    background-repeat: repeat;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border: 4px solid #5d4037;
}

.schedule-table th,
.schedule-table td {
    border: 2px solid #a08560;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
    line-height: 1.2;
}

.schedule-table th {
    background-color: #5a6d2e;
    background-image: url('assets/textures/bg-paper-light.png');
    background-repeat: repeat;
    color: #2d2416;
    font-weight: bold;
    font-size: 1em;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid #5d4037;
}

.schedule-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
}

.time-cell {
    background: var(--paper-light);
    font-weight: bold;
    font-size: 1em;
    color: #2d2416;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 3px solid var(--olive-green);
}

.lesson-cell {
    background: var(--beige-cell);
    padding: 4px 6px;
    min-width: 120px;
    white-space: nowrap;
}

.lesson-cell:hover {
    background: #d4b388;
    cursor: pointer;
}

/* Non-standard time lessons - highlighted with different background */
.lesson-cell.non-standard-time {
    background: #fff3cd;
    border-left: 3px solid #f39c12;
}

.lesson-cell.non-standard-time:hover {
    background: #ffe8a8;
}

/* Actual time display for non-standard lessons */
.actual-time {
    display: block;
    font-size: 0.75em;
    color: #5d4037;
    font-weight: bold;
    margin-bottom: 2px;
}

.empty-cell {
    background-color: #f5ead3;
    background-image: url('assets/textures/bg-parchment.png');
    background-repeat: repeat;
    color: #ccc;
    min-width: 120px;
}

/* Lesson Content - Horizontal Layout */
.subject {
    font-weight: bold;
    color: #4a3728;
    font-size: 1em;
}

.teacher {
    font-size: 0.9em;
    color: #5d4037;
}

.room {
    font-size: 0.9em;
    color: #6d5242;
}

/* Separator between items */
.lesson-cell span:not(:last-child)::after {
    content: " | ";
    color: #888;
    font-weight: normal;
}

/* Toggle Panel Button */
.btn-toggle {
    background: var(--accent);
    color: #2d2416;
    border-color: var(--accent);
    font-weight: bold;
}

.btn-toggle:hover {
    background: #f39c12;
}

/* Print Styles */
@media print {
    /* Hide buttons and controls */
    .student-plan-header,
    .week-navigation,
    .btn,
    .student-selector {
        display: none !important;
    }
    
    /* Optimize table for printing */
    .schedule-table {
        width: 100%;
        page-break-inside: avoid;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 4px;
        font-size: 10pt;
    }
    
    /* Remove shadows and backgrounds for clean print */
    body {
        background: white;
    }
    
    .lesson-cell {
        background: #f0f0f0 !important;
    }
    
    .schedule-grid-wrapper {
        padding: 0;
    }
}

/* Responsive - Mobile Portrait */
@media (max-width: 768px) {
    .student-plan-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .student-plan-header h1 {
        font-size: 1.2em;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .week-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .schedule-table {
        font-size: 0.8em;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 4px 3px;
    }
    
    .lesson-cell,
    .empty-cell {
        min-width: 100px;
    }
}

/* Responsive - Mobile Landscape (optimized for phone horizontal) */
@media (max-width: 900px) and (orientation: landscape) {
    .student-plan-header {
        padding: 8px 15px;
    }
    
    .student-plan-header h1 {
        font-size: 1em;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .week-navigation {
        padding: 8px;
        gap: 10px;
    }
    
    .week-nav-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .week-display {
        font-size: 0.9em;
        min-width: 150px;
    }
    
    .schedule-grid-wrapper {
        padding: 10px;
    }
    
    .schedule-table {
        font-size: 0.75em;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 6px 4px;
    }
    
    .lesson-cell,
    .empty-cell {
        min-width: 80px;
    }
    
    .subject {
        font-size: 0.95em;
        margin-bottom: 2px;
    }
    
    .teacher {
        font-size: 0.8em;
    }
    
    .room {
        font-size: 0.75em;
    }
}

/* Start Overlay - Fullscreen Prompt */
#start-overlay-student {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest-medium) 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.start-content {
    text-align: center;
    color: white;
    padding: 30px;
}

.start-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.start-subtitle {
    font-size: 1.2em;
    margin-bottom: 20px;
    opacity: 0.9;
}

.start-info {
    font-size: 1em;
    margin-bottom: 30px;
    opacity: 0.8;
}

.btn-enter-fullscreen {
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    background: var(--accent);
    color: #2d2416;
    border: 3px solid #f39c12;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(241, 196, 15, 0.4);
}

.btn-enter-fullscreen:hover {
    background: #f39c12;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(241, 196, 15, 0.6);
}

/* Exit Virtual Fullscreen Button */
#exit-virtual-fullscreen-student {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#exit-virtual-fullscreen-student:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

/* Virtual Fullscreen Mode */
body.virtual-fullscreen-student {
    overflow: hidden;
}

body.virtual-fullscreen-student .student-plan-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    z-index: 9990;
}

/* Responsive for fullscreen prompt on mobile */
@media (max-width: 768px) {
    .start-title {
        font-size: 2em;
    }
    
    .btn-enter-fullscreen {
        padding: 12px 24px;
        font-size: 1em;
    }
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: #666;
}

/* ============================================================================
   WIRTUALNY FULLSCREEN DLA STUDENT PLAN (iOS FALLBACK)
   ============================================================================ */

body.virtual-fullscreen-student .student-plan-header,
body.virtual-fullscreen-student .week-navigation {
    position: fixed !important;
}

/* ============================================================================
   MOBILE OPTIMIZATIONS - Ultra cienkie nagłówki
   ============================================================================ */

@media (max-width: 768px) {
    /* HEADER - EKSTREMALNIE cienki */
    .student-plan-header {
        padding: 2px 4px !important;
        min-height: 32px !important;
    }
    
    .student-plan-header h1 {
        font-size: 12px !important;
        margin: 0 !important;
        line-height: 1 !important;
        padding: 0 !important;
    }
    
    .student-plan-header .header-buttons {
        gap: 2px !important;
    }
    
    .student-plan-header button {
        padding: 3px 6px !important;
        font-size: 9px !important;
        min-height: 24px !important;
        border-radius: 3px !important;
    }
    
    /* WEEK NAVIGATION - MINIMALNA */
    .week-navigation {
        padding: 2px 4px !important;
        gap: 2px !important;
        min-height: 28px !important;
    }
    
    .week-navigation button {
        padding: 3px 6px !important;
        font-size: 10px !important;
        min-height: 22px !important;
    }
    
    .week-navigation .current-week {
        font-size: 11px !important;
        padding: 2px 4px !important;
    }
    
    /* GRID - mniejsze fonty */
    .student-schedule-grid {
        font-size: 10px !important;
    }
    
    .student-day-header {
        font-size: 11px !important;
        padding: 3px 1px !important;
    }
    
    .student-lesson-cell {
        font-size: 9px !important;
        padding: 2px !important;
    }
    
    /* Time slots */
    .time-slot {
        font-size: 9px !important;
        padding: 1px !important;
    }
    
    /* Przycisk toggle panel - mniejszy */
    #toggle-panel-btn {
        padding: 3px 6px !important;
        font-size: 9px !important;
    }
}

