/* Vizuál převzatý z aplikace contracts (jednotný design obou aplikací):
   tmavě modré pozadí #0E2A47, bílé zaoblené karty, font Poppins.
   Při úpravách vzhledu měnit pokud možno OBĚ aplikace zároveň. */

:root {
  --navy: #0E2A47;
  --navy-light: #16406b;
  --text: #4a4a4a;
  --text-dark: #363636;
  --accent: #1d72b8;
  --card-radius: 12px;
}

* { box-sizing: border-box; }
/* rezervace místa pro svislý posuvník — logo v liště pak sedí na stejném
   místě jako na rozcestníku a v contracts (bez „scrollbar jump") */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: var(--navy);
  color: var(--text);
  font-size: 15px;
}

/* --- skip-link: schovaný nad stránkou, objeví se při fokusu (Tab) --- */
.skip-link {
  position: absolute;
  left: .75rem; top: .75rem;
  z-index: 3000;
  transform: translateY(-300%);
  background: var(--navy);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: .85rem;
  white-space: nowrap;
}
.skip-link:focus { transform: none; }
/* cíl skoku nemá mít vlastní fokusový rámeček */
#main:focus { outline: none; }

/* --- hlavička: loga + název aplikace v jedné bílé liště --- */
.logobar { background: #fff; padding: .6rem 1rem; }
.logobar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo-ujep, .logo-eu { width: 250px; height: auto; display: block; }
.logobar-right { display: flex; align-items: center; gap: .4rem; }
#help-toggle {
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  width: 2rem; height: 2rem;
  border: 1px solid #dbdbdb;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
#help-toggle:hover { background: #eef3f8; }
/* tlačítko „domů" (zpět na rozcestník) — stejné jako v contracts */
#home-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem;
  border: 1px solid #dbdbdb;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
}
#home-btn:hover { background: #eef3f8; }
#home-btn svg { width: 1.05rem; height: 1.05rem; display: block; }

.brand { text-align: center; flex: 1; }
.brand h1 {
  margin: 0;
  color: var(--navy);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}
.subtitle { color: #636c76; font-size: .85rem; font-weight: 300; }
@media (max-width: 900px) {
  .logo-ujep, .logo-eu { width: 160px; }
  .brand { flex-basis: 100%; order: 3; }
  .logobar-inner { justify-content: center; }
  .brand h1 { font-size: 1.2rem; }
}

/* --- rozvržení --- */
.content { max-width: 1200px; margin: 0 auto; padding: 0 1rem 2rem; }

.card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  margin-top: 1rem;
}

/* --- filtry --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem 1rem;
  padding: 1rem 1.2rem;
  align-items: flex-end;
}
.filter { display: flex; flex-direction: column; flex: 2 1 260px; min-width: 0; }
.filter-year   { flex: 1 1 170px; }
.filter-reset  { flex: 0 0 auto; }
.filter label, .filter .filter-caption {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: .25rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.filter select, .filter input[type="search"] {
  font-family: inherit;
  font-size: .9rem;
  color: var(--text-dark);
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: .45rem .6rem;
  background: #fff;
  width: 100%;
}
.filter select option, .head-filters select option { color: #2b2b2b; }
.filter select option:disabled, .head-filters select option:disabled {
  color: #9aa2ab; font-style: italic;
}
.filter select:focus, .filter input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#f-reset {
  font-family: inherit;
  font-size: .85rem;
  border: none;
  border-radius: 9999px;
  padding: .5rem 1.1rem;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}
#f-reset:hover { background: var(--navy-light); }

/* --- počty --- */
.counts {
  padding: .55rem 1.2rem;
  font-size: .85rem;
  color: var(--text-dark);
}

/* --- upozornění na stará data (běžně skryté) --- */
.stale-note {
  padding: .55rem 1.2rem;
  font-size: .82rem;
  color: #7a6420;
  background: #fff6dd;
}

/* --- tabulka --- */
.table-card { padding: .4rem 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
#tbl { table-layout: fixed; min-width: 860px; }
#tbl .head-labels th.col-fac  { width: 7%;  }
#tbl .head-labels th.col-dept { width: 6%;  }
#tbl .head-labels th.col-code { width: 7%;  }
#tbl .head-labels th.col-name { width: 34%; }
#tbl .head-labels th.col-term { width: 7%;  }
#tbl .head-labels th.col-cred { width: 8%;  }
#tbl .head-labels th.col-lang { width: 14%; }
#tbl .head-labels th.col-lvl  { width: 10%; }
#tbl td { overflow-wrap: break-word; }
/* úroveň (poslední sloupec) nezalamovat uprostřed slova (Bachelor) */
#tbl td:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* při výběru jedné fakulty se sloupec Faculty skrývá */
#tbl.hide-fac .col-fac { display: none; }
th, td {
  text-align: left;
  padding: .55rem .9rem;
  font-size: .85rem;
  vertical-align: top;
}
thead th {
  background: #fff;
  color: var(--text-dark);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
/* první řádek hlavičky (názvy sloupců) zůstává přilepený */
.head-labels th {
  position: sticky; top: 0;
  border-bottom: 1px solid #e5e9ee;
}
/* druhý řádek hlavičky: filtry sloupců (vzor: původní aplikace) */
.head-filters th { border-bottom: 2px solid var(--navy); padding: .3rem .5rem .55rem; }
.head-filters select {
  font-family: inherit;
  font-size: .8rem;
  color: var(--text-dark);
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: .3rem .35rem;
  background: #fff;
  width: 100%;
}
.head-filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.head-filters .cell-check { text-align: left; }
.head-filters input[type="checkbox"] {
  accent-color: var(--navy);
  width: 1.05rem; height: 1.05rem;
  cursor: pointer;
  margin: .25rem 0 0 .15rem;
}
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--accent); }
th .arrow { font-size: .7em; }
tbody tr { border-bottom: 1px solid #f0f0f0; cursor: pointer; }
tbody tr:hover { background: #f4f8fc; }
/* semestry: zelená fajfka / červený křížek (vzor: původní aplikace);
   platí v tabulce i v detailu předmětu */
.term-yes { color: #1c7c31; font-weight: 600; }
.term-no  { color: #c81e2e; font-weight: 600; }

.tag {
  display: inline-block;
  background: #eef3f8;
  color: var(--navy);
  border-radius: 6px;
  padding: .05rem .45rem;
  margin: .07rem .15rem .07rem 0;
  font-size: .78rem;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Fakultní barvy dle grafického manuálu JVS UJEP — stejné hodnoty
   jako v contracts (viz komentář tam). */
.tag.fac-FSI { background: #666666; color: #fff; }
.tag.fac-FŽP { background: #67AF23; color: #1e2b12; }
.tag.fac-FUD { background: #FBBE00; color: #2b2405; }
.tag.fac-FF  { background: #EB690A; color: #2b1503; }
.tag.fac-FZS { background: #D20019; color: #fff; }
.tag.fac-PRF { background: #007381; color: #fff; }
.tag.fac-PF  { background: #E53188; color: #2b0a1c; }
.tag.fac-FSE { background: #0095CF; color: #10222b; }

/* --- lišta nad tabulkou: fulltext + stránkování --- */
.table-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .9rem;
  font-size: .82rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #f0f0f0;
}
#t-search {
  font-family: inherit;
  font-size: .85rem;
  color: var(--text-dark);
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: .4rem .6rem;
  flex: 1 1 200px;
  max-width: 340px;
  min-width: 0;
}
#t-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.table-bar button {
  font-family: inherit;
  font-size: .8rem;
  border: 1px solid #dbdbdb;
  border-radius: 9999px;
  padding: .3rem .9rem;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.table-bar button:hover:not(:disabled) { background: #eef3f8; }
.table-bar button:disabled { color: #b5b5b5; cursor: default; }
.table-bar select {
  font-family: inherit;
  font-size: .8rem;
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: .25rem .4rem;
}
.table-bar .page-info { white-space: nowrap; }
.table-bar .page-label { color: #68717c; margin-left: auto; white-space: nowrap; }

/* --- přepínač pohledu tabulka/karty --- */
.view-toggle { display: flex; }
.view-toggle button { border-radius: 0; }
.view-toggle button:first-child { border-radius: 9999px 0 0 9999px; }
.view-toggle button:last-child { border-radius: 0 9999px 9999px 0; margin-left: -1px; }
.view-toggle button[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.view-toggle button[aria-pressed="true"]:hover { background: var(--navy-light); }

/* --- karetní pohled --- */
/* POZOR: display na třídách přebíjí atribut hidden — bez tohoto
   pravidla by se skryté karty/lišta vykreslovaly dál */
.cards[hidden], .cards-filters[hidden] { display: none; }
/* lišta filtrů (prvky se sem přesouvají z hlavičky tabulky) */
.cards-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.2rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid #f0f0f0;
}
.cards-filters .cf { display: inline-flex; align-items: center; gap: .4rem; }
.cards-filters .cf-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cards-filters select {
  font-family: inherit;
  font-size: .8rem;
  color: var(--text-dark);
  border: 1px solid #dbdbdb;
  border-radius: 8px;
  padding: .3rem .35rem;
  background: #fff;
  max-width: 190px;
}
.cards-filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.cards-filters input[type="checkbox"] {
  accent-color: var(--navy);
  width: 1.05rem; height: 1.05rem;
  cursor: pointer;
}
/* mřížka karet — karta nese vše z původní karty (záložky „Table"):
   kredity, úroveň, jazyky, zakončení, garant, vyučující, rozsah výuky
   + úryvek anotace. Dlouhé hodnoty končí výpustkou, úryvek má 3 řádky;
   plný obsah je v detailu (klik) — záměrně BEZ vnitřního rolování. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  padding: .8rem .9rem 1rem;
}
.course-card {
  border: 1px solid #e5e9ee;
  border-radius: 10px;
  padding: .9rem 1.1rem;
  cursor: pointer;
}
.course-card:hover { background: #f4f8fc; }
.course-card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cc-name { font-weight: 600; color: var(--navy); font-size: .95rem; margin-bottom: .3rem; }
.cc-meta { font-size: .8rem; color: #636c76; margin-bottom: .4rem; }
/* levý sloupec přesně na míru krátkým hodnotám (kredity, úroveň —
   v datech max „Bachelor"), zbytek šířky dostanou dlouhé (jazyky,
   zakončení); strop 45 % je pojistka proti nečekaně dlouhé hodnotě */
.cc-grid {
  display: grid;
  grid-template-columns: fit-content(45%) minmax(0, 1fr);
  gap: .15rem .9rem;
  font-size: .78rem;
  margin-bottom: .45rem;
}
.cc-f { display: flex; gap: .35rem; min-width: 0; }
.cc-span { grid-column: 1 / -1; }
.cc-l { color: var(--text-dark); font-weight: 600; flex: none; }
.cc-clock { font-weight: 400; }
.cc-v {
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* původ úryvku, když není z anotace (Overview: / Requirements:) */
.cc-ex-label { font-weight: 600; color: var(--text-dark); }
.cc-excerpt {
  font-size: .8rem;
  color: #555;
  line-height: 1.5;
  border-top: 1px solid #f0f0f0;
  padding-top: .45rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cards .tbl-msg { grid-column: 1 / -1; }

/* prázdný stav / chyba v tabulce */
.tbl-msg { padding: 1.4rem 1.2rem; font-size: .9rem; color: var(--text-dark); }

/* --- detail předmětu + nápověda (společný vzhled dialogů) --- */
#detail-overlay, #help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14,42,71,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}
#detail-overlay[hidden], #help-overlay[hidden] { display: none; }
.detail-box, .help-box {
  position: relative;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  width: min(720px, 94vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.4rem 1.6rem;
}
.help-box { width: min(560px, 94vw); }
#detail-close, #help-close {
  position: absolute;
  top: .6rem; right: .8rem;
  border: none; background: none;
  font-size: 1.4rem; line-height: 1;
  color: #8a8a8a; cursor: pointer;
}
#detail-close:hover, #help-close:hover { color: var(--navy); }
.detail-box h2 { margin: 0 0 .2rem; font-size: 1.2rem; color: var(--navy);
                 padding-right: 1.6rem; }
.detail-box .detail-sub { color: #636c76; font-size: .85rem; margin-bottom: .8rem; }
.detail-box table { width: auto; margin: 0 0 .6rem; }
.detail-box th, .detail-box td {
  padding: .25rem .8rem .25rem 0;
  font-size: .85rem;
  vertical-align: top;
}
.detail-box th { color: var(--text-dark); white-space: nowrap; font-weight: 600; }
.detail-box h3 { margin: .9rem 0 .3rem; font-size: .95rem; color: var(--navy); }
.detail-box .detail-text { font-size: .85rem; line-height: 1.55; }
.detail-box .detail-text p { margin: .3rem 0; }
/* poznámka pod názvem: řádek vyhověl hledání jen skrytým polem */
.row-match { font-size: .75rem; color: #68717c; margin-top: .15rem; }

/* zvýraznění hledaného výrazu v tabulce, na kartách a v detailu */
#tbl mark,
.cards mark,
.detail-box mark {
  background: #ffe9a8;
  color: inherit;
  padding: 0 .12em;
  border-radius: 3px;
}
.help-box h2 { margin: 0 0 .6rem; font-size: 1.15rem; color: var(--navy); }
.help-box h3 { margin: 1rem 0 .4rem; font-size: .95rem; color: var(--navy); }
.help-box p { margin: .4rem 0; font-size: .87rem; }
.help-keys { width: 100%; table-layout: fixed; }
.help-keys td { padding: .2rem .6rem .2rem 0; font-size: .85rem;
                overflow-wrap: break-word; }
.help-keys td:first-child { width: 6.5rem; }
kbd {
  display: inline-block;
  background: #f0f3f7;
  border: 1px solid #d5dde5;
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: .05rem .45rem;
  font-family: Consolas, monospace;
  font-size: .8rem;
  white-space: nowrap;
}

/* --- patička --- */
.foot {
  color: rgba(255,255,255,.6);
  font-size: .78rem;
  text-align: center;
  padding: 1.2rem 0 .4rem;
  font-weight: 300;
}
.foot a { color: rgba(255,255,255,.85); }

/* --- přístupnost --- */
th[data-sort]:focus-visible, tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
