:root {
    --sidebar-width: 250px;
    --navbar-height: 56px;
    --primary: #2c5f8a;
    --primary-dark: #1e4466;
    --bg-light: #f0f2f5;
}

body {
    background-color: var(--bg-light);
    padding-top: var(--navbar-height);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1040;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid #dee2e6;
    z-index: 1030;
    overflow-y: auto;
}

.sidebar-nav {
    padding: 0.5rem 0;
}

.sidebar-heading {
    padding: 1rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8898aa;
}

.sidebar .nav-link {
    padding: 0.5rem 1rem;
    color: #525f7f;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar .nav-link:hover {
    color: var(--primary);
    background-color: #f6f9fc;
    border-left-color: var(--primary);
}

.sidebar .nav-link.active {
    color: var(--primary);
    background-color: #e8f0fe;
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar .nav-link i {
    width: 1.25rem;
    margin-right: 0.5rem;
    text-align: center;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.15s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
}

/* Stats cards */
.stat-card {
    border-left: 4px solid var(--primary);
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--primary);
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #32325d;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8898aa;
}

/* Timetable grid */
.timetable-grid {
    font-size: 0.8rem;
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.timetable-grid th {
    background: var(--primary);
    color: #FFD600;
    font-weight: 700;
    text-align: center;
    padding: 0.6rem 0.5rem;
    white-space: nowrap;
    border: 2px solid #1e4466;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    text-transform: uppercase;
}

.timetable-grid th[data-day] {
    cursor: pointer;
}

/* Per-day header colors */
.timetable-grid th.day-color-1 { background: #1E88E5; border-color: #1565C0; }
.timetable-grid th.day-color-2 { background: #43A047; border-color: #2E7D32; }
.timetable-grid th.day-color-3 { background: #8E24AA; border-color: #6A1B9A; }
.timetable-grid th.day-color-4 { background: #8D6E63; border-color: #6D4C41; }
.timetable-grid th.day-color-5 { background: #00ACC1; border-color: #00838F; }
.timetable-grid th.day-color-6 { background: #5C6BC0; border-color: #3F51B5; }

/* Day status overrides */
.timetable-grid th.day-status-neradni { background: #dc3545 !important; border-color: #a71d2a !important; }
.timetable-grid th.day-status-praznik { background: #dc3545 !important; border-color: #a71d2a !important; }
.timetable-grid th.day-status-nenastavni { background: #dc3545 !important; border-color: #a71d2a !important; }

.day-status-badge {
    font-size: 0.65rem;
    white-space: normal;
}

.timetable-grid td {
    vertical-align: middle;
    padding: 0.35rem;
    border: 2px solid #b0bec5;
}

.timetable-grid td.entry-cell {
    padding: 0;
    vertical-align: middle;
}

.timetable-grid .time-cell {
    background: #f8f9fa;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    min-width: 90px;
    white-space: nowrap;
    color: #525f7f;
}

.timetable-entry {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 0.25rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.35;
    cursor: grab;
    word-break: break-word;
}

.timetable-entry:active {
    cursor: grabbing;
}


/* Drag & drop */
.timetable-grid td.drag-over {
    background: #d4edfa !important;
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}

.timetable-entry {
    user-select: none;
}

/* Split cell - više stavki u istoj ćeliji side by side */
.entry-split {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0;
}

.entry-split .timetable-entry {
    flex: 1;
    min-width: 0;
    font-size: 0.7rem;
    padding: 0.25rem 0.3rem;
    line-height: 1.25;
    border-radius: 0;
    align-self: stretch;
    word-break: break-word;
}

.entry-split .timetable-entry .entry-course {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.entry-split .timetable-entry .entry-time,
.entry-split .timetable-entry .entry-professor,
.entry-split .timetable-entry .entry-room,
.entry-split .timetable-entry .entry-teaching-form {
    font-size: 0.65rem;
}

.entry-split .timetable-entry .entry-group,
.entry-split .timetable-entry .entry-week {
    font-size: 0.6rem;
}

.timetable-entry .entry-course {
    font-weight: 700;
    font-size: 0.85rem;
    color: #0d2137;
}

.timetable-entry .entry-time {
    color: #1a4d75;
    font-size: 0.75rem;
    font-weight: 600;
}

.timetable-entry .entry-professor {
    color: #2d3748;
    font-weight: 500;
    font-size: 0.75rem;
}

.timetable-entry .entry-room {
    color: #4a5568;
    font-weight: 500;
    font-size: 0.75rem;
}

.timetable-entry .entry-group {
    display: inline-block;
    width: fit-content;
    background: #1e4d6e;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.05rem 0.35rem;
    border-radius: 0.2rem;
    font-weight: 600;
}

.timetable-entry .entry-week {
    display: inline-block;
    width: fit-content;
    font-size: 0.7rem;
    padding: 0.05rem 0.35rem;
    border-radius: 0.2rem;
    font-weight: 600;
}

.week-1 { background: #86efac; color: #14532d; }
.week-2 { background: #fdba74; color: #7c2d12; }
.week-continuous { background: #e2e8f0; color: #4a5568; }

/* Day-off cells (neradni/praznik/nenastavni) */
.timetable-grid td.day-off-cell {
    background: #ffcdd2 !important;
}

/* Forms */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #525f7f;
}

/* Table styles */
.table:not(.timetable-grid) th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8898aa;
    border-top: none;
}

/* Filter bar */
.filter-bar {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-bar .form-select, .filter-bar .form-control {
    font-size: 0.85rem;
}

/* Delete button */
.btn-delete {
    border: none;
    background: none;
    color: #e53e3e;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.btn-delete:hover {
    color: #c53030;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        width: 280px;
        z-index: 1045;
    }

    .main-content {
        margin-left: 0;
    }
}

/* Print-only title (hidden on screen) */
.print-title {
    display: none;
}

/* Print styles */
@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    .sidebar, .navbar, .filter-bar, .no-print, .alert {
        display: none !important;
    }

    .print-title {
        display: block !important;
        font-size: 9pt;
        font-weight: 700;
        text-align: center;
        margin: 0 0 2px 0;
        color: #2c5f8a;
    }

    /* Reset all elements to allow page-break */
    html, body, main, .main-content, .container-fluid {
        overflow: visible !important;
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        position: static !important;
        float: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    body {
        padding: 0.7cm;
        font-size: 6pt;
    }

    .container-fluid {
        padding: 0 !important;
        margin: 0 !important;
    }

    .d-flex.mb-4 {
        display: none !important;
    }

    .py-3 {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .card {
        display: block !important;
        overflow: visible !important;
        box-shadow: none;
        border: none;
        margin: 0 !important;
    }

    .card-body {
        display: block !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .card-header {
        display: block !important;
        background: none !important;
        border: none !important;
        padding: 4px 0 2px 0 !important;
    }

    .card-header h5 {
        font-size: 8pt;
        margin: 0;
    }

    /* Skupni ispis učionica: sakrij kombiniranu tablicu, svaka učionica na svom listu */
    .print-hide-combined {
        display: none !important;
    }

    .classroom-page,
    .semester-page {
        display: block !important;
        page-break-before: always !important;
        break-before: page !important;
    }

    .classroom-page .card-header,
    .semester-page .card-header {
        padding-top: 0.5cm !important;
    }

    .table-responsive {
        overflow: visible !important;
    }

    .timetable-grid {
        width: 100%;
        table-layout: fixed;
    }

    .timetable-grid th {
        padding: 2px 1px;
        font-size: 6pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        white-space: normal;
        text-shadow: none;
    }

    .timetable-grid .time-cell {
        min-width: auto;
        font-size: 5pt;
        padding: 1px;
    }

    .timetable-grid {
        table-layout: fixed;
    }

    .timetable-grid td {
        padding: 1px;
        font-size: 5.5pt;
        min-width: auto;
        height: auto;
        word-break: break-word;
    }

    .timetable-grid td.entry-cell,
    .timetable-grid td.day-off-cell {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .timetable-entry {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 5.5pt;
        padding: 1px 2px;
        line-height: 1.2;
    }

    .timetable-entry .entry-course { font-size: 6pt; }
    .timetable-entry .entry-time { font-size: 5pt; }
    .timetable-entry .entry-professor { font-size: 5pt; }
    .timetable-entry .entry-room { font-size: 5pt; }
    .timetable-entry .entry-group { font-size: 4.5pt; padding: 0 2px; }
    .timetable-entry .entry-week { font-size: 4.5pt; padding: 0 2px; }

    .entry-split {
        display: flex;
        flex-direction: row;
        gap: 0;
        padding: 0;
    }

    .entry-split .timetable-entry {
        flex: 1;
        min-width: 0;
        font-size: 4.5pt;
        padding: 1px;
        line-height: 1.15;
    }

    .entry-split .timetable-entry .entry-course { font-size: 5pt; }
    .entry-split .timetable-entry .entry-time { font-size: 4pt; }
    .entry-split .timetable-entry .entry-professor { font-size: 4pt; }
    .entry-split .timetable-entry .entry-room { font-size: 4pt; }
    .entry-split .timetable-entry .entry-group { font-size: 3.5pt; padding: 0 1px; }
    .entry-split .timetable-entry .entry-week { font-size: 3.5pt; padding: 0 1px; }

    .day-status-badge { font-size: 5pt; }

    h5, .h5 { font-size: 9pt; margin: 0 0 2px 0; }
}
