/* --- Globalne --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

main {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

/* --- Nagłówek i Nawigacja --- */
header {
    background-color: #004a99;
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    position: relative;
}

.header-top h1 {
    margin: 0;
    font-size: 2em;
}

.theme-controls {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}

.theme-controls button {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-controls button:hover {
    background: rgba(255,255,255,0.3);
}

#contrast-toggle.active {
    background: rgba(255,255,255,0.5);
    font-weight: bold;
}

nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.nav-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

nav label {
    font-weight: 500;
}

nav select, nav button {
    padding: 8px 12px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    background-color: #f4f7f6;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
}

nav button:hover {
    background-color: #e0e0e0;
}

#multi-group-btn, #browse-btn, #compare-btn {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
}
#multi-group-btn:hover, #browse-btn:hover, #compare-btn:hover {
    background-color: rgba(255,255,255,0.35);
}

#ics-export, #today-btn, #sync-btn {
    background-color: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    font-size: 0.9em;
}
#ics-export:hover, #today-btn:hover, #sync-btn:hover {
    background-color: rgba(255,255,255,0.3);
}

/* --- Calendar Wrapper --- */
.calendar-wrapper {
    display: inline-flex;
    align-items: center;
}

.calendar-wrapper input[type="date"] {
    padding: 7px 10px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    background: rgba(255,255,255,0.9);
    color: #333;
    cursor: pointer;
}

.week-label {
    color: rgba(255,255,255,0.85);
    font-size: 0.9em;
    white-space: nowrap;
}

/* --- Search --- */
.search-wrapper {
    position: relative;
    display: inline-block;
}

.search-wrapper input[type="text"] {
    padding: 8px 12px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    width: 260px;
    background: rgba(255,255,255,0.9);
    color: #333;
}
.search-wrapper input[type="text"]::placeholder {
    color: #999;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
}

.search-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}
.search-item:last-child {
    border-bottom: none;
}
.search-item:hover {
    background: #f0f5ff;
}

.search-name {
    font-weight: 500;
    color: #222;
}

.search-cat {
    font-size: 0.8em;
    color: #888;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.search-empty {
    color: #999;
    font-style: italic;
    justify-content: center;
    cursor: default;
}
.search-empty:hover {
    background: white;
}

/* --- Filtry --- */
.filters {
    background-color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.filters > label:first-child {
    color: #004a99;
    font-weight: 600;
    margin-right: 4px;
}

.filter-chip {
    cursor: pointer;
}

.filter-chip input[type="checkbox"] {
    display: none;
}

.chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    border: 2px solid #ccc;
    background: #f9f9f9;
    transition: all 0.2s;
    user-select: none;
}

.filter-chip input:checked + .chip {
    border-color: currentColor;
    background: currentColor;
    color: white;
}

.chip-wyk { color: #4a90d9; }
.filter-chip input:checked + .chip-wyk { background: #4a90d9; border-color: #4a90d9; color: white; }

.chip-cw { color: #5cb85c; }
.filter-chip input:checked + .chip-cw { background: #5cb85c; border-color: #5cb85c; color: white; }

.chip-klin { color: #d9534f; }
.filter-chip input:checked + .chip-klin { background: #d9534f; border-color: #d9534f; color: white; }

.chip-lang { color: #f0ad4e; }
.filter-chip input:checked + .chip-lang { background: #f0ad4e; border-color: #f0ad4e; color: white; }

.chip-other { color: #777; }
.filter-chip input:checked + .chip-other { background: #777; border-color: #777; color: white; }

.chip-inne { color: #999; }
.filter-chip input:checked + .chip-inne { background: #999; border-color: #999; color: white; }

/* --- Kontener Planu --- */
#plan-title {
    text-align: center;
    color: #004a99;
    margin-bottom: 20px;
    font-weight: 600;
}

#plan-container {
    display: grid;
    gap: 15px;
}

.plan-grid-days {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.plan-grid-groups {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    overflow-x: auto;
    padding-bottom: 20px;
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    min-width: 1500px;
}

.plan-column {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

.plan-column h3 {
    background-color: #eef2f5;
    color: #004a99;
    padding: 12px 15px;
    margin: 0;
    font-size: 1.1em;
    border-bottom: 1px solid #ddd;
}

/* --- Kafelek Zajęć --- */
.course-card {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    background-color: white;
    transition: background-color 0.2s;
    border-left: 4px solid transparent;
}
.course-card:last-child {
    border-bottom: none;
}
.course-card:hover {
    background-color: #fafafa;
}

.course-card-empty {
    padding: 12px 15px;
    font-style: italic;
    color: #999;
    text-align: center;
}

/* Kolorystyka typów zajęć */
.card-type-wyk {
    border-left-color: #4a90d9;
    background-color: #f8fbff;
}
.card-type-ćw, .card-type-cw {
    border-left-color: #5cb85c;
    background-color: #f8fff8;
}
.card-type-klin {
    border-left-color: #d9534f;
    background-color: #fff8f8;
}
.card-type-j--obcy {
    border-left-color: #f0ad4e;
    background-color: #fffdf5;
}
.card-type-pł, .card-type-gim, .card-type-gry, .card-type-punm {
    border-left-color: #777;
    background-color: #fafafa;
}
.card-type-inne {
    border-left-color: #bbb;
}

/* Nagłówek karty */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.card-time {
    font-weight: bold;
    font-size: 1.05em;
    color: #333;
}

.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-wyk { background-color: #4a90d9; }
.badge-ćw, .badge-cw { background-color: #5cb85c; }
.badge-klin { background-color: #d9534f; }
.badge-j--obcy { background-color: #f0ad4e; }
.badge-pł, .badge-gim, .badge-gry, .badge-punm { background-color: #777; }
.badge-inne { background-color: #999; }

.card-subject {
    font-weight: 600;
    font-size: 1.05em;
    color: #222;
    margin: 4px 0;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 4px;
}

.card-field, .card-teacher, .card-room {
    font-size: 0.9em;
    color: #555;
}

.card-field:empty, .card-teacher:empty, .card-room:empty {
    display: none;
}

.card-abbr {
    font-size: 0.8em;
    color: #999;
    margin-top: 3px;
    font-style: italic;
}

.card-source {
    font-size: 0.75em;
    color: #888;
    background: #f0f0f0;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 4px;
}

/* Linki w kafelku */
.course-card a {
    color: #004a99;
    text-decoration: underline;
    text-decoration-color: #b0c4de;
    transition: color 0.2s, text-decoration-color 0.2s;
    cursor: pointer;
}
.course-card a:hover {
    color: #002d5e;
    text-decoration-color: #004a99;
}

/* --- Nakładające się zajęcia --- */
.course-card-overlapping {
    border-left-color: #ff0000 !important;
}

.overlap-group {
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    margin: 4px 0;
    overflow: hidden;
}

.overlap-toggle {
    background: #fff0f0;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85em;
    color: #cc3333;
    font-weight: 500;
    text-align: center;
    transition: background 0.2s;
}
.overlap-toggle:hover {
    background: #ffe0e0;
}

.overlap-group .course-card {
    border-bottom: 1px solid #ffcccc;
}

.overlap-group:not(.overlap-expanded) .overlap-hidden {
    display: none;
}

.overlap-expanded .overlap-hidden {
    display: block;
}

/* --- Error message --- */
.error-msg {
    text-align: center;
    color: #d9534f;
    font-size: 1.1em;
    padding: 20px;
}

/* --- Ładowanie --- */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #004a99;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Filtry dnia --- */
#day-filter-controls {
    background-color: #eef2f5;
    justify-content: flex-start;
}
#day-filter-controls > label:first-child {
    font-weight: 600;
    color: #004a99;
}
.day-filter-btn {
    padding: 6px 12px;
    font-size: 0.9em;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.day-filter-btn:hover {
    background-color: #f0f0f0;
}
.day-filter-btn.active {
    background-color: #004a99;
    color: white;
    border-color: #004a99;
    font-weight: bold;
}

/* --- Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-content.modal-wide {
    max-width: 750px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: #004a99;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}
.modal-close:hover {
    color: #333;
}

/* --- Compare Modal --- */
.compare-setup {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.compare-setup > p {
    margin-top: 0;
    color: #555;
}

.compare-slot {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.compare-label {
    flex: 0 0 140px;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
}

.compare-source, .compare-manual {
    flex: 1;
    min-width: 150px;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
}

.compare-remove {
    background: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1.2em;
    cursor: pointer;
    color: #999;
    padding: 4px 8px;
    transition: all 0.2s;
}
.compare-remove:hover {
    color: #d9534f;
    border-color: #d9534f;
}

.compare-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

.compare-hint {
    font-size: 0.85em;
    color: #999;
    font-style: italic;
    margin-top: 8px;
}

.btn-secondary {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:hover {
    background: #e0e0e0;
}

/* --- Drzewo przeglądania --- */
.tree-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    padding: 0 16px;
}

.tree-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}
.tree-tab:hover {
    color: #004a99;
}
.tree-tab.active {
    color: #004a99;
    border-bottom-color: #004a99;
}

.tree-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    max-height: 50vh;
}

.tree-hint {
    color: #999;
    font-style: italic;
    text-align: center;
}

.tree-list {
    list-style: none;
    padding-left: 16px;
    margin: 4px 0;
}

.tree-item {
    margin: 2px 0;
}

.tree-branch-toggle {
    cursor: pointer;
    font-weight: 500;
    color: #333;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-block;
    transition: background 0.2s;
}
.tree-branch-toggle:hover {
    background: #eef2f5;
    color: #004a99;
}

.tree-leaf {
    color: #004a99;
    text-decoration: none;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-block;
    transition: background 0.2s;
}
.tree-leaf:hover {
    background: #eef2f5;
    text-decoration: underline;
}

.tree-children {
    margin-left: 8px;
    border-left: 1px solid #e0e0e0;
    padding-left: 4px;
}

.tree-loading {
    color: #999;
    font-style: italic;
}

.tree-error {
    color: #d9534f;
}

/* --- Połącz grupy modal --- */
.multi-groups {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 40vh;
    overflow-y: auto;
}

.multi-group-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.multi-group-option:hover {
    background: #f0f5ff;
}

.multi-group-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #004a99;
}

.btn-primary {
    margin: 0 20px 20px;
    padding: 10px 20px;
    background: #004a99;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover {
    background: #003570;
}

/* ============================================= */
/* === CIEMNY MOTYW (Dark Mode) === */
/* ============================================= */
body.dark-theme {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-theme header {
    background-color: #16213e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-theme .search-wrapper input[type="text"] {
    background: rgba(255,255,255,0.1);
    color: #e0e0e0;
}
body.dark-theme .search-wrapper input[type="text"]::placeholder {
    color: #888;
}

body.dark-theme .search-dropdown {
    background: #2a2a4a;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
body.dark-theme .search-item {
    border-bottom-color: #3a3a5a;
}
body.dark-theme .search-item:hover {
    background: #3a3a5a;
}
body.dark-theme .search-name {
    color: #e0e0e0;
}
body.dark-theme .search-cat {
    background: #3a3a5a;
    color: #aaa;
}

body.dark-theme .calendar-wrapper input[type="date"] {
    background: rgba(255,255,255,0.1);
    color: #e0e0e0;
}

body.dark-theme nav select {
    background-color: #2a2a4a;
    color: #e0e0e0;
    border: 1px solid rgba(255,255,255,0.2);
}
body.dark-theme nav select option {
    background-color: #1e1e3a;
    color: #e0e0e0;
}

body.dark-theme .filters {
    background-color: #2a2a4a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
body.dark-theme .filters > label:first-child {
    color: #7eb5ff;
}

body.dark-theme .chip {
    background: #2a2a4a;
    border-color: #555;
}

body.dark-theme #day-filter-controls {
    background-color: #2a2a4a;
}
body.dark-theme #day-filter-controls > label:first-child {
    color: #7eb5ff;
}
body.dark-theme .day-filter-btn {
    background-color: #333355;
    color: #ccc;
    border-color: #555;
}
body.dark-theme .day-filter-btn:hover {
    background-color: #3a3a5a;
}
body.dark-theme .day-filter-btn.active {
    background-color: #4a90d9;
    border-color: #4a90d9;
    color: white;
}

body.dark-theme #plan-title {
    color: #7eb5ff;
}

body.dark-theme .plan-column {
    background-color: #2a2a4a;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-theme .plan-column h3 {
    background-color: #1e1e3a;
    color: #7eb5ff;
    border-bottom-color: #444;
}

body.dark-theme .course-card {
    background-color: #2a2a4a;
    border-bottom-color: #3a3a5a;
}
body.dark-theme .course-card:hover {
    background-color: #333355;
}

body.dark-theme .card-type-wyk { background-color: #1e2a40; }
body.dark-theme .card-type-ćw, body.dark-theme .card-type-cw { background-color: #1e301e; }
body.dark-theme .card-type-klin { background-color: #301e1e; }
body.dark-theme .card-type-j--obcy { background-color: #302a1e; }
body.dark-theme .card-type-pł, body.dark-theme .card-type-gim,
body.dark-theme .card-type-gry, body.dark-theme .card-type-punm { background-color: #2a2a2a; }

body.dark-theme .card-time { color: #e0e0e0; }
body.dark-theme .card-subject { color: #e8e8e8; }
body.dark-theme .card-field, body.dark-theme .card-teacher, body.dark-theme .card-room { color: #b0b0b0; }
body.dark-theme .card-abbr { color: #777; }
body.dark-theme .card-source { background: #3a3a5a; color: #aaa; }

body.dark-theme .course-card a {
    color: #7eb5ff;
    text-decoration-color: #5577aa;
}
body.dark-theme .course-card a:hover {
    color: #a0cfff;
    text-decoration-color: #7eb5ff;
}

body.dark-theme .course-card-empty { color: #666; }

body.dark-theme .overlap-group { border-color: #ff6b6b; }
body.dark-theme .overlap-toggle { background: #3a1a1a; color: #ff8888; }
body.dark-theme .overlap-toggle:hover { background: #4a2020; }

body.dark-theme .modal-content {
    background: #2a2a4a;
}
body.dark-theme .modal-header {
    border-bottom-color: #444;
}
body.dark-theme .modal-header h2 { color: #7eb5ff; }
body.dark-theme .modal-close { color: #777; }
body.dark-theme .modal-close:hover { color: #ddd; }

body.dark-theme .tree-tab { color: #999; }
body.dark-theme .tree-tab:hover { color: #7eb5ff; }
body.dark-theme .tree-tab.active {
    color: #7eb5ff;
    border-bottom-color: #7eb5ff;
}
body.dark-theme .tree-tabs { border-bottom-color: #444; }
body.dark-theme .tree-branch-toggle { color: #ccc; }
body.dark-theme .tree-branch-toggle:hover { background: #3a3a5a; color: #7eb5ff; }
body.dark-theme .tree-leaf { color: #7eb5ff; }
body.dark-theme .tree-leaf:hover { background: #3a3a5a; }
body.dark-theme .tree-children { border-left-color: #555; }

body.dark-theme .compare-setup > p { color: #aaa; }
body.dark-theme .compare-label,
body.dark-theme .compare-source,
body.dark-theme .compare-manual {
    background: #333355;
    color: #e0e0e0;
    border-color: #555;
}
body.dark-theme .compare-remove { color: #999; border-color: #555; }
body.dark-theme .compare-remove:hover { color: #ff6b6b; border-color: #ff6b6b; }
body.dark-theme .compare-hint { color: #777; }

body.dark-theme .btn-secondary {
    background: #333355;
    color: #ccc;
    border-color: #555;
}
body.dark-theme .btn-secondary:hover {
    background: #3a3a5a;
}

body.dark-theme .btn-primary {
    background: #4a90d9;
}
body.dark-theme .btn-primary:hover {
    background: #3570b0;
}

body.dark-theme .multi-group-option:hover { background: #3a3a5a; }

body.dark-theme .plan-grid-groups {
    background: #2a2a4a;
}

body.dark-theme .loader {
    border-color: #3a3a5a;
    border-top-color: #7eb5ff;
}

/* ============================================= */
/* === WYSOKI KONTRAST (High Contrast) === */
/* ============================================= */
body.high-contrast {
    font-weight: 500;
}

body.high-contrast .card-subject {
    font-size: 1.15em;
    font-weight: 700;
}

body.high-contrast .card-time {
    font-size: 1.15em;
}

body.high-contrast .card-field,
body.high-contrast .card-teacher,
body.high-contrast .card-room {
    font-size: 0.95em;
    color: #333;
    font-weight: 500;
}

body.high-contrast .card-abbr {
    font-size: 0.85em;
    color: #666;
}

body.high-contrast .type-badge {
    font-size: 0.8em;
    padding: 3px 10px;
}

body.high-contrast .plan-column h3 {
    font-size: 1.2em;
    font-weight: 700;
}

body.high-contrast .course-card {
    border-left-width: 6px;
}

body.high-contrast .chip {
    font-size: 0.9em;
    font-weight: 600;
    padding: 5px 12px;
}

body.high-contrast .course-card a {
    font-weight: 600;
    text-decoration-thickness: 2px;
}

/* Dark + High Contrast combined */
body.dark-theme.high-contrast .card-field,
body.dark-theme.high-contrast .card-teacher,
body.dark-theme.high-contrast .card-room {
    color: #d0d0d0;
}

body.dark-theme.high-contrast .card-abbr {
    color: #999;
}

/* --- Responsywność --- */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 10px;
    }

    .header-top h1 {
        font-size: 1.4em;
    }

    .theme-controls {
        position: static;
        transform: none;
    }

    .nav-row {
        flex-direction: column;
        gap: 6px;
    }

    nav select {
        width: 100%;
        max-width: 300px;
    }

    .search-wrapper {
        width: 100%;
        max-width: 300px;
    }
    .search-wrapper input[type="text"] {
        width: 100%;
    }

    .plan-grid-days {
        grid-template-columns: 1fr;
    }

    /* Chips wrap horizontally on mobile (don't stack into column) */
    .filters {
        gap: 6px;
        padding: 10px 12px;
    }

    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .card-meta {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .compare-slot {
        flex-direction: column;
    }
    .compare-label {
        flex: none;
        width: 100%;
    }
    .compare-search-wrapper {
        width: 100%;
    }
}

/* --- Compare Tree Browse Button --- */
.btn-browse {
    background: rgba(0,74,153,0.08);
    border: 1px solid #c0cfe8;
    border-radius: 5px;
    color: #004a99;
    cursor: pointer;
    font-size: 1.1em;
    padding: 5px 8px;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-browse:hover {
    background: rgba(0,74,153,0.16);
    border-color: #004a99;
}

/* Compare tree modal above compare modal */
#compare-tree-modal {
    z-index: 1100;
}

/* Dark mode browse button */
body.dark-theme .btn-browse {
    background: rgba(126,181,255,0.1);
    border-color: #446;
    color: #7eb5ff;
}
body.dark-theme .btn-browse:hover {
    background: rgba(126,181,255,0.2);
    border-color: #7eb5ff;
}

/* --- Compare Modal Search Autocomplete --- */
.compare-search-wrapper {
    flex: 1;
    min-width: 150px;
    position: relative;
}

.compare-search-wrapper .compare-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
    background: white;
    color: #333;
}
.compare-search-wrapper .compare-search-input:focus {
    outline: none;
    border-color: #004a99;
    box-shadow: 0 0 0 2px rgba(0,74,153,0.1);
}

.compare-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 3000;
    max-height: 220px;
    overflow-y: auto;
}

/* Dark mode compare search */
body.dark-theme .compare-search-wrapper .compare-search-input {
    background: #333355;
    color: #e0e0e0;
    border-color: #555;
}
body.dark-theme .compare-search-dropdown {
    background: #2a2a4a;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
body.dark-theme .compare-search-dropdown .search-item {
    border-bottom-color: #3a3a5a;
}
body.dark-theme .compare-search-dropdown .search-item:hover {
    background: #3a3a5a;
}

/* --- Settings Modal --- */
.settings-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 65vh;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    color: #004a99;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.settings-hint {
    font-size: 0.85em;
    color: #888;
    margin: 0 0 10px 0;
}
.settings-hint code {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
}

.settings-actions {
    margin-top: 10px;
}

.settings-fav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 5px;
    margin-bottom: 4px;
    background: #f9f9f9;
    border: 1px solid #eee;
}

.settings-fav-btns {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-fav-move {
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
    font-size: 0.8em;
    line-height: 1.4;
    transition: all 0.2s;
}
.settings-fav-move:hover {
    color: #004a99;
    border-color: #004a99;
}

.settings-fav-label {
    flex: 1;
    font-size: 0.95em;
    color: #333;
}

.settings-fav-type {
    font-size: 0.78em;
    color: #aaa;
    font-family: monospace;
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
}

.settings-fav-remove {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #bbb;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 1em;
    transition: all 0.2s;
}
.settings-fav-remove:hover {
    color: #d9534f;
    border-color: #d9534f;
}

.settings-search-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.settings-search-wrapper input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
}

.settings-manual-add {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-manual-add input {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
}

/* Dark mode settings */
body.dark-theme .settings-section h3 {
    color: #7eb5ff;
    border-bottom-color: #444;
}
body.dark-theme .settings-hint {
    color: #888;
}
body.dark-theme .settings-hint code {
    background: #333355;
    color: #aaa;
}
body.dark-theme .settings-fav-item {
    background: #333355;
    border-color: #444;
}
body.dark-theme .settings-fav-label {
    color: #e0e0e0;
}
body.dark-theme .settings-fav-type {
    background: #2a2a4a;
    color: #888;
}
body.dark-theme .settings-fav-move {
    border-color: #555;
    color: #777;
}
body.dark-theme .settings-fav-move:hover {
    color: #7eb5ff;
    border-color: #7eb5ff;
}
body.dark-theme .settings-fav-remove {
    border-color: #555;
    color: #777;
}
body.dark-theme .settings-fav-remove:hover {
    color: #ff6b6b;
    border-color: #ff6b6b;
}
body.dark-theme .settings-search-wrapper input[type="text"],
body.dark-theme .settings-manual-add input {
    background: #333355;
    color: #e0e0e0;
    border-color: #555;
}


/* Empty plan message */
.empty-plan-msg {
    grid-column: 1 / -1;
    padding: 2rem;
    text-align: center;
    color: #555;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ccc;
    margin: 1rem 0;
}
.empty-plan-msg p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}
.empty-plan-msg p:first-child {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}
body.dark-theme .empty-plan-msg {
    background: #1e1e3a;
    border-color: #444;
    color: #aaa;
}
body.dark-theme .empty-plan-msg p:first-child {
    color: #ddd;
}


/* === Subgroup filter row === */
#subgroup-filter-row {
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.subgroup-filter-label {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}
.subgroup-filter-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.subgroup-filter-type {
    font-size: 0.78rem;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
    cursor: default;
    padding: 0.1rem 0;
    margin-right: 0.2rem;
}
.subgroup-filter-sep {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 0.3rem;
}
/* Subgroup chips — override the global checked/unchecked mechanism */
.chip-subgrp-a {
    background: #28a745;
    color: #fff;
    border: 2px solid #28a745;
    font-weight: 700;
    min-width: 3.5rem;
    text-align: center;
}
.chip-subgrp-b {
    background: #007bff;
    color: #fff;
    border: 2px solid #007bff;
    font-weight: 700;
    min-width: 3.5rem;
    text-align: center;
}
.chip-subgrp-c {
    background: #e6a800;
    color: #fff;
    border: 2px solid #e6a800;
    font-weight: 700;
    min-width: 3.5rem;
    text-align: center;
}
/* Checked = opaque (full color), unchecked = faded with strikethrough */
/* NOTE: must explicitly set background here — the general input:checked+.chip rule sets
   background:currentColor which equals #fff (white) for these chips (color:#fff). */
.filter-chip input.subgroup-lang-cb:checked + .chip-subgrp-a,
.filter-chip input.subgroup-klin-cb:checked + .chip-subgrp-a { background: #28a745; color: #fff; opacity: 1; text-decoration: none; }
.filter-chip input.subgroup-lang-cb:not(:checked) + .chip-subgrp-a,
.filter-chip input.subgroup-klin-cb:not(:checked) + .chip-subgrp-a { background: #28a745; color: #fff; opacity: 0.35; text-decoration: line-through; }
.filter-chip input.subgroup-lang-cb:checked + .chip-subgrp-b,
.filter-chip input.subgroup-klin-cb:checked + .chip-subgrp-b { background: #007bff; color: #fff; opacity: 1; text-decoration: none; }
.filter-chip input.subgroup-lang-cb:not(:checked) + .chip-subgrp-b,
.filter-chip input.subgroup-klin-cb:not(:checked) + .chip-subgrp-b { background: #007bff; color: #fff; opacity: 0.35; text-decoration: line-through; }
.filter-chip input.subgroup-lang-cb:checked + .chip-subgrp-c,
.filter-chip input.subgroup-klin-cb:checked + .chip-subgrp-c { background: #e6a800; color: #fff; opacity: 1; text-decoration: none; }
.filter-chip input.subgroup-lang-cb:not(:checked) + .chip-subgrp-c,
.filter-chip input.subgroup-klin-cb:not(:checked) + .chip-subgrp-c { background: #e6a800; color: #fff; opacity: 0.35; text-decoration: line-through; }

/* Zaliczenia chip */
.chip-zal { background: #f8d7da; color: #721c24; }
/* Explicit checked state: background:currentColor in general rule resolves to white
   because color:white is set in the same rule — must override explicitly */
.filter-chip input:checked + .chip-zal { background: #dc3545; border-color: #dc3545; color: white; }

/* Badge for new types */
.badge-fit { background: #17a2b8; color: #fff; }
.badge-sił { background: #6f42c1; color: #fff; }
.badge-sp-róż { background: #fd7e14; color: #fff; }
.badge-zal { background: #dc3545; color: #fff; }

/* Card colors for new types */
.card-type-fit { border-left-color: #17a2b8; }
.card-type-sił { border-left-color: #6f42c1; }
.card-type-sp-róż { border-left-color: #fd7e14; }
.card-type-zal { border-left-color: #dc3545; }

/* === Back button === */
#back-btn {
    background: transparent;
    border: 1.5px solid #aaa;
    color: #555;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
#back-btn:hover {
    background: #f0f0f0;
    border-color: #666;
    color: #222;
}
body.dark-theme #back-btn {
    border-color: #555;
    color: #bbb;
}
body.dark-theme #back-btn:hover {
    background: #333355;
    border-color: #99aaff;
    color: #e0e0e0;
}

/* Dark mode subgroup filters */
body.dark-theme .subgroup-filter-sep { background: #444; }
body.dark-theme .subgroup-filter-label { color: #aaa; }
body.dark-theme .subgroup-filter-type { color: #bbb; }
/* Dark mode: chips keep their color but slightly brighter */
body.dark-theme .chip-subgrp-a { background: #28a745; color: #fff; border-color: #4ccc6a; }
body.dark-theme .chip-subgrp-b { background: #007bff; color: #fff; border-color: #4da6ff; }
body.dark-theme .chip-subgrp-c { background: #e6a800; color: #fff; border-color: #ffc430; }

/* ============================================= */
/* === COMPARE: układ po dniach              === */
/* ============================================= */
.plan-grid-compare {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.compare-day-group {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

.compare-day-header {
    background-color: #dce8f5;
    color: #004a99;
    padding: 10px 15px;
    margin: 0;
    font-size: 1.05em;
    font-weight: 700;
    border-bottom: 2px solid #b8d0ed;
}

.compare-day-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compare-day-columns > .plan-column {
    border-radius: 0;
    box-shadow: none;
    border-right: 1px solid #eee;
}
.compare-day-columns > .plan-column:last-child {
    border-right: none;
}
.compare-day-columns > .plan-column > h3 {
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    background: #f0f5ff;
    padding: 8px 14px;
    border-bottom-color: #dde;
}

/* Dark mode compare layout */
body.dark-theme .compare-day-group { background: #2a2a4a; }
body.dark-theme .compare-day-header { background: #1a2744; color: #7eb5ff; border-bottom-color: #2d4a80; }
body.dark-theme .compare-day-columns > .plan-column { border-right-color: #3a3a5a; }
body.dark-theme .compare-day-columns > .plan-column > h3 { background: #22223a; color: #9ab; }

/* ============================================= */
/* === MOBILNE: zwijalne dni                 === */
/* ============================================= */
@media (max-width: 768px) {
    /* Collapsible single-plan day columns */
    .plan-grid-days .plan-column > h3.day-header-toggle {
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        user-select: none;
    }
    .plan-grid-days .plan-column > h3.day-header-toggle::after {
        content: '▼';
        font-size: 0.75em;
        flex-shrink: 0;
        margin-left: 6px;
        opacity: 0.6;
    }
    .plan-grid-days .plan-column.day-collapsed > h3.day-header-toggle::after {
        content: '▶';
    }
    /* Hide all course cards when day is collapsed (allow applyFilters() to control per-card) */
    .plan-grid-days .plan-column.day-collapsed > .course-card,
    .plan-grid-days .plan-column.day-collapsed > .course-card-empty,
    .plan-grid-days .plan-column.day-collapsed > .overlap-group {
        display: none !important;
    }

    /* Compare: narrower columns, scroll within day group if many plans */
    .compare-day-columns {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        overflow-x: auto;
    }
    .compare-day-columns > .plan-column > h3 {
        font-size: 0.82em;
        padding: 6px 10px;
    }
}

/* ============================================= */
/* === GDPR Cookie Consent Banner            === */
/* ============================================= */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid #004a99;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.13);
    z-index: 9999;
    padding: 14px 20px;
    animation: cookieBannerIn 0.35s ease;
}

@keyframes cookieBannerIn {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-banner-text {
    flex: 1;
    min-width: 200px;
}

.cookie-banner-text strong {
    display: block;
    font-size: 0.95em;
    font-weight: 700;
    margin-bottom: 4px;
    color: #004a99;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.78em;
    color: #555;
    line-height: 1.45;
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
}

/* Dark mode */
body.dark-theme .cookie-banner {
    background: #1e1e3a;
    border-top-color: #3a5a99;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}
body.dark-theme .cookie-banner-text strong { color: #7eb5ff; }
body.dark-theme .cookie-banner-text p      { color: #aaa; }

/* Mobile */
@media (max-width: 600px) {
    .cookie-banner { padding: 12px 14px; }
    .cookie-banner-content { gap: 12px; }
    .cookie-banner-actions { width: 100%; justify-content: flex-end; }
}
