/* ==========================================================================
   КОНСТРУКТОР РОЗКЛАДУ УРОКІВ - ПРЕМІУМ ВЕРСТКА
   ========================================================================== */

/* ЖОРСТКА СІТКА ЕКРАНУ */
.schedule-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    gap: 20px; 
    width: 100%; 
    align-items: flex-start;
}

/* Адаптивність області попереднього перегляду для телефонів */
.schedule-preview-container { 
    width: 100%; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
    background-color: #cbd5e1; 
    border-radius: 12px; 
    padding: 10px; 
    display: flex; 
    justify-content: center; 
}

@media (max-width: 1024px) { 
    .schedule-layout { grid-template-columns: 1fr; } 
    .schedule-preview-container { justify-content: flex-start; } /* Зручний скрол зліва-направо */
}

.landscape-scroll-wrapper {
    min-width: 297mm;
    padding: 5px;
}

/* Контейнер налаштувань */
.schedule-controls-container { width: 100%; }

/* ПРИГЛУШЕННЯ ДИЗАЙНУ ДИПЛОМІВ ДЛЯ РОЗКЛАДУ */
.a4-page-landscape { 
    /* Фіксуємо розміри, щоб таблиця не виштовхувала рамку */
    width: 297mm;
    height: 210mm;
    max-height: 210mm;
    border-width: 4mm !important; 
    outline-offset: -2mm !important; 
    box-shadow: inset 0 0 0 2mm rgba(255,255,255,0.5) !important; 
    box-sizing: border-box;
    overflow: hidden;
}

.frame-decor-top-left::after, .frame-decor-top-right::after, .frame-decor-bottom-left::after, .frame-decor-bottom-right::after { 
    font-size: 20pt !important; 
    top: 2mm !important; 
    left: 3mm !important; 
    right: 3mm !important; 
    bottom: 2mm !important; 
}

/* САМ РОЗКЛАД */
.schedule-content { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    z-index: 5; 
    position: relative; 
    padding: 2mm 10mm 5mm 10mm; 
    box-sizing: border-box; 
}

.schedule-title { 
    font-family: 'Comfortaa', cursive, sans-serif; 
    font-size: 26pt; 
    font-weight: 700; 
    color: #1e293b; 
    margin: 0 0 4mm 0; 
    text-shadow: 2px 2px 0px rgba(255,255,255,0.8); 
    text-align: center; 
}

.schedule-table-wrapper { 
    width: 100%; 
    background-color: rgba(255, 255, 255, 0.92); 
    border-radius: 12px; 
    padding: 4mm; 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(5px); 
    margin-bottom: auto; 
}

.schedule-table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0; 
    font-family: 'Inter', sans-serif; 
}

.schedule-table th { 
    color: #475569; 
    font-size: 11pt; 
    font-weight: 700; 
    padding: 0 0 2mm 0; 
    text-transform: uppercase; 
    border-bottom: 2px solid #cbd5e1; 
}

/* ФІКС ВЕРТИКАЛЬНОГО ЦЕНТРУВАННЯ ТА ВИСОТИ */
.schedule-table td {
    border-bottom: 1px dashed #cbd5e1;
    border-right: 1px dashed #e2e8f0;
    text-align: center;
    vertical-align: middle !important; 
    height: 11.5mm !important;
    padding: 1.5mm;
}
.schedule-table td:last-child { border-right: none; }
.schedule-table tr:last-child td { border-bottom: none; }

.schedule-table td:first-child { width: 14%; border-right: 1px dashed #e2e8f0; background-color: rgba(248, 250, 252, 0.4); }
.schedule-table td:nth-child(2) { width: 5%; border-right: none; background-color: transparent; }

.lesson-number { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 24px; 
    height: 24px; 
    background-color: #f1f5f9; 
    color: #475569; 
    border-radius: 50%; 
    font-size: 10pt; 
    font-weight: 700; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03); 
}

/* ПОЛЯ ВВОДУ: БЕЗ FLEXBOX, ЗАХИСТ ВІД БАГІВ ТА РОЗТЯГУВАННЯ */
.time-input, .subject-input {
    width: 100%;
    max-height: 10.5mm; 
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    outline: none;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden !important; 
    line-height: 1.15;
    word-break: break-word; 
    white-space: pre-wrap;
    display: inline-block; 
    vertical-align: middle;
}
.subject-input { font-size: 12pt; font-weight: 600; }
.time-input { font-size: 10.5pt; font-weight: 500; color: #64748b; white-space: nowrap; }

.time-input:focus, .subject-input:focus { 
    background-color: #f8fafc; 
    border-radius: 6px; 
    box-shadow: inset 0 0 0 2px #3b82f6; 
}

.schedule-notes { 
    width: 100%; 
    margin-top: 4mm; 
    background-color: rgba(255, 255, 255, 0.95); 
    padding: 3mm 5mm; 
    border-radius: 10px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
    display: flex; 
    flex-direction: column; 
    gap: 1mm; 
    font-family: 'Inter', sans-serif; 
    color: #334155; 
    z-index: 10; 
}
.notes-input { 
    width: 100%; 
    border: none; 
    background: transparent; 
    font-family: 'Inter', sans-serif; 
    font-size: 11pt; 
    color: #1e293b; 
    resize: none; 
    outline: none; 
}

/* ПАНЕЛЬ КЕРУВАННЯ ТА ТИПОГРАФІКА */
.modern-input-wrapper { position: relative; display: flex; align-items: center; width: 100%; margin-bottom: 15px; }
.modern-input-wrapper .input-icon { position: absolute; left: 12px; font-size: 16px; color: #94a3b8; pointer-events: none; }
.modern-input { width: 100%; padding: 10px 10px 10px 38px !important; border-radius: 8px !important; border: 1.5px solid #cbd5e1 !important; background: #f8fafc !important; font-weight: 600 !important; color: #1e293b !important; }
.modern-input:focus { background: #ffffff !important; border-color: #3b82f6 !important; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important; }

.typography-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; width: 100%; align-items: center; }
.toolbar-select { height: 38px !important; padding: 0 8px !important; border-radius: 8px !important; border: 1.5px solid #cbd5e1 !important; background-color: #f8fafc !important; font-weight: 500; font-size: 14px !important; }
.font-picker { flex: 1; min-width: 100px; }
.size-picker { width: 70px; }
.color-picker-wrapper { width: 38px; height: 38px; border-radius: 8px; border: 1.5px solid #cbd5e1; overflow: hidden; position: relative; cursor: pointer; flex-shrink: 0; }
.color-picker-wrapper input[type="color"] { position: absolute; top: -10px; left: -10px; width: 60px; height: 60px; border: none; cursor: pointer; background: none; }

/* ТЕМНІ ТЕМИ */
.theme-blackboard .schedule-title { color: #ffffff; text-shadow: none; } 
.theme-space .schedule-title { color: #38bdf8; text-shadow: none; }
.theme-blackboard .schedule-table-wrapper, .theme-blackboard .schedule-notes, .theme-space .schedule-table-wrapper, .theme-space .schedule-notes { background-color: rgba(15, 23, 42, 0.85); border: 1px solid rgba(255,255,255,0.1); }
.theme-blackboard .schedule-table th, .theme-blackboard .lesson-number, .theme-blackboard .notes-input, .theme-blackboard .schedule-notes strong, .theme-space .schedule-table th, .theme-space .notes-input, .theme-space .schedule-notes strong { color: #f8fafc; }
.theme-blackboard .lesson-number { background-color: rgba(255,255,255,0.1); } 
.theme-space .lesson-number { background-color: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.theme-blackboard .schedule-table td, .theme-space .schedule-table td { border-bottom-color: rgba(255,255,255,0.1); border-right-color: rgba(255,255,255,0.1); }
.theme-blackboard .time-input, .theme-space .time-input { color: #94a3b8; }
.theme-blackboard .subject-input, .theme-space .subject-input { color: #f8fafc; }

/* ==========================================================================
   ЗАХИСТ ЕКСПОРТУ ВІД ПОРОЖНІХ СТОРІНОК
   ========================================================================== */
@media print {
    @page { 
        size: A4 landscape; 
        margin: 0 !important; 
    }
    html, body { 
        margin: 0 !important; 
        padding: 0 !important; 
        height: 210mm !important; 
        max-height: 210mm !important; 
        overflow: hidden !important; 
        background: #fff !important; 
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact; 
    }
    .notes-input::placeholder { color: transparent; }
    .a4-page-landscape { 
        margin: 0 !important; 
        box-shadow: none !important; 
        border: none !important; 
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
    }
    .app-header, .schedule-controls-container, .ad-placeholder, .seo-text-block, .btn, .divider { 
        display: none !important; 
    }
    .main-layout, .schedule-preview-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }
}