@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========== Layout Variables ========== */

:root {
    --primary: #0d6efd;
    --primary-hover: #0b5ed7;
    --primary-active: #0a58ca;
    --primary-light: #e8f0fe;
    --primary-rgb: 13, 110, 253;
    --sidebar-width: 260px;
    --sidebar-bg: #0d6efd;
    --content-bg: #f5f6fa;
    --nav-link-color: rgba(255, 255, 255, 0.8);
    --nav-active-bg: rgba(255, 255, 255, 0.18);
    --nav-active-color: #ffffff;
}

[data-bs-theme="dark"] {
    --sidebar-bg: #0a58ca;
    --content-bg: #16181d;
    --nav-link-color: rgba(255, 255, 255, 0.75);
    --nav-active-bg: rgba(255, 255, 255, 0.15);
    --nav-active-color: #ffffff;
    --primary-light: rgba(13, 110, 253, 0.12);
}

/* ========== Global ========== */

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--content-bg);
    min-height: 100vh;
}

/* ========== Cards ========== */

.card {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
}

[data-bs-theme="dark"] .card {
    box-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}

/* ========== Sidebar ========== */

.sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding: 20px 16px;
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease;
}

/* Sidebar Brand / Logo */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 18px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.sidebar-brand:hover {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

/* Sidebar Nav Links */

.sidebar .nav-link {
    color: var(--nav-link-color);
    border-radius: 10px;
    margin-bottom: 3px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    background: var(--nav-active-bg);
    color: var(--nav-active-color);
}

.sidebar .nav-link.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-color);
    font-weight: 500;
}

/* Sidebar section toggle */
.sidebar .nav-section-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    padding: 14px 12px 4px;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
}
.sidebar .nav-section-toggle:hover {
    color: rgba(255, 255, 255, 0.75);
}
.sidebar .nav-section-chevron {
    font-size: 0.7rem;
    transition: transform 0.25s linear;
}
.sidebar .nav-section-toggle.collapsed .nav-section-chevron {
    transform: rotate(-90deg);
}
.sidebar .collapsing {
    transition-duration: 0.25s;
    transition-timing-function: linear;
}

/* Sidebar Nav grows to push footer down */
.sidebar > .nav.flex-column {
    flex: 1;
    overflow-y: auto;
}

/* Sidebar Footer */

.sidebar-footer {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.sidebar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

/* ========== Content Area ========== */

.content {
    padding: 24px;
    min-height: 100vh;
    font-size: 0.875rem;
    font-family: 'Inter', system-ui, sans-serif;
}

.content h1 { font-size: 1.5rem; }
.content h2 { font-size: 1.25rem; }
.content h3 { font-size: 1.1rem; }
.content h4 { font-size: 1rem; }
.content h5, .content .card-title { font-size: 0.9375rem; }
.content h6 { font-size: 0.875rem; }

body.has-sidebar .content {
    margin-left: var(--sidebar-width);
}

.content-footer {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    margin-top: 2rem;
    border-top: 1px solid var(--bs-border-color);
}

/* ========== Mobile Topbar ========== */

.mobile-topbar {
    display: flex;
    align-items: center;
    background: var(--sidebar-bg);
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ========== Sidebar Overlay (mobile) ========== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1039;
}

.sidebar-overlay.show {
    display: block;
}

/* ========== Theme Toggle ========== */

.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.55);
}

/* ========== Responsive (mobile) ========== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    body.has-sidebar .content {
        margin-left: 0;
    }
}

@media (min-width: 992px) {
    .mobile-topbar {
        display: none !important;
    }
    .sidebar {
        transform: none !important;
    }
}

/* ========== Dark mode overrides ========== */

[data-bs-theme="dark"] .mobile-topbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

/* ========== Responsive tweaks ========== */

@media (max-width: 768px) {
    .content {
        padding: 16px;
    }
}

/* ========== Kalendarz jazd ========== */

/* Wrapper z poziomym scrollem */
.cal-scroll {
    overflow-x: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
}

[data-bs-theme="dark"] .cal-scroll {
    box-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}

/* ── Widok tygodniowy ── */

.cal-week {
    display: flex;
    flex-direction: column;
    min-width: 800px;
}

.cal-week-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

.cal-corner {
    width: 48px;
    flex-shrink: 0;
}

.cal-day-head {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.78rem;
    font-weight: 600;
    border-left: 1px solid var(--bs-border-color);
    line-height: 1.4;
}

.cal-day-head.today {
    background: var(--primary);
    color: #fff;
}

.cal-week-body {
    display: flex;
}

.cal-time-axis {
    width: 48px;
    flex-shrink: 0;
    border-right: 1px solid var(--bs-border-color);
}

.cal-hour-label {
    height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 3px 6px 0;
    font-size: 0.6rem;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.cal-day-col {
    flex: 1;
    position: relative;
    height: 1020px;  /* 17 godzin × 60px (6:00–23:00) */
    border-left: 1px solid var(--bs-border-color);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 59px,
        var(--bs-border-color) 59px,
        var(--bs-border-color) 60px
    );
}

/* Blok jazdy */
.cal-lesson {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 6px;
    padding: 3px 5px;
    font-size: 0.7rem;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none !important;
    z-index: 1;
    border-left: 3px solid transparent;
    transition: filter 0.15s;
    line-height: 1.35;
    min-height: 22px;
}

.cal-lesson:hover {
    filter: brightness(0.93);
    z-index: 2;
}

.cal-lesson-primary  { background: rgba(13, 110, 253, .14); border-color: #0d6efd; color: #0a58ca; }
.cal-lesson-success  { background: rgba(25, 135, 84,  .14); border-color: #198754; color: #146c43; }
.cal-lesson-danger   { background: rgba(220, 53,  69,  .14); border-color: #dc3545; color: #b02a37; }
.cal-lesson-warning  { background: rgba(255, 193, 7,   .18); border-color: #e0a800; color: #7d6608; }

[data-bs-theme="dark"] .cal-lesson-primary  { background: rgba(13, 110, 253, .28); color: #6ea8fe; }
[data-bs-theme="dark"] .cal-lesson-success  { background: rgba(25, 135, 84,  .28); color: #75b798; }
[data-bs-theme="dark"] .cal-lesson-danger   { background: rgba(220, 53,  69,  .28); color: #ea868f; }
[data-bs-theme="dark"] .cal-lesson-warning  { background: rgba(255, 193, 7,   .28); color: #ffda6a; }

/* ── Widok miesięczny ── */

.cal-month th {
    text-align: center;
    padding: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bs-tertiary-bg);
}

.cal-month-cell {
    vertical-align: top;
    min-height: 110px;
    width: calc(100% / 7);
    padding: 6px;
}

.cal-month-other {
    opacity: 0.4;
}

.cal-month-day-num {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 3px;
    display: inline-block;
    min-width: 22px;
    text-align: center;
}

.cal-month-today-num {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
}

.cal-month-lesson {
    display: block;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    padding: 1px 5px;
    border-radius: 4px;
    margin-bottom: 2px;
    text-decoration: none !important;
    color: inherit;
}
