/* =============================================================================
   ZÁKLADNÍ STYLY A PROMĚNNÉ
   ============================================================================= */

:root { 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; 
}

body { 
  margin: 0.3rem; 
  background: #fff; 
  color: #222; 
  font-family: Verdana, sans-serif; 
  font-size: 12px; 
  overflow-x: hidden; /* Zabrání horizontálnímu scrollu na celé stránce */
}

.container { 
  margin: 0 auto; 
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* =============================================================================
   BARVY OBTÍŽNOSTI CEST
   ============================================================================= */

.cervena, th.cervena { background-color: #CC0000 !important; color: #fff !important; }
.modra, th.modra { background-color: #0000AA !important; color: #fff !important; }
.zelena, th.zelena { background-color: #008822 !important; color: #fff !important; }
.oranzova, th.oranzova { background-color: #FF6500 !important; color: #fff !important; }

/* =============================================================================
   HLAVIČKA STRÁNKY S VÝSLEDKY
   ============================================================================= */

.vysledky-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.7rem 1.2rem 0.5rem 1.2rem;
  background: linear-gradient(90deg, #e6f0ff 0%, #f7f7f7 100%);
  border-radius: 14px;
  margin-bottom: 0.7rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.vysledky-title {
  font-size: 2.1em;
  font-weight: 800;
  color: #1a237e;
  font-family: 'Segoe UI', 'Verdana', 'Arial', sans-serif;
  letter-spacing: 0.03em;
  margin-right: 1.2rem;
  text-shadow: 0 1px 2px #fff, 0 2px 8px #e6f0ff;
}

.vysledky-kolo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.kolo-navigation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kolo-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.kolo-date {
  font-size: 0.85em;
  color: #666;
  white-space: nowrap;
  font-weight: normal;
  font-family: 'Segoe UI', 'Verdana', 'Arial', sans-serif;
  margin-left: 0.4rem;
}

.vysledky-link {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
}

/* =============================================================================
   TABULKA S VÝSLEDKY
   ============================================================================= */

.table-scroll {
  overflow: auto;
  max-width: 100%;
  position: relative;
  max-height: 95vh; /* Omezíme výšku pro scrollování */
  width: 100%;
}

table.vysledky-freeze {
  border-collapse: collapse;
  min-width: 820px;
}

.vysledky-freeze th, 
.vysledky-freeze td {
  border: 1px solid #ddd;
  padding: 3px 6px;
  text-align: center;
}

.vysledky-freeze th:not(.cell-cesta) { 
  background: #fff; 
}

.vysledky-freeze td { 
  background: #fff; 
}

/* Sticky sloupce */
.vysledky-freeze th:nth-child(2), 
.vysledky-freeze td:nth-child(2) {
  min-width: 48px;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 6;
  background: #fff;
}

.vysledky-freeze th.sticky-row, 
.vysledky-freeze th.sticky-col, 
.vysledky-freeze td.sticky-col {
  position: sticky;
}

.vysledky-freeze th.sticky-row:not(.cell-cesta) {
  top: 0;
  z-index: 10;
  background: linear-gradient(90deg,#f7f7f7,#ffffff);
}

/* Zamražení záhlaví při scrollování dolů */
.vysledky-freeze thead th {
  position: sticky;
  top: 0;
  z-index: 15;
  background: #fff;
}

/* Sloupec "Lezec" má vyšší z-index než ostatní záhlaví */
.vysledky-freeze thead th:nth-child(2) {
  z-index: 16;
}

.vysledky-freeze th.sticky-col, 
.vysledky-freeze td.sticky-col {
  position: sticky;
  left: 48px;
  z-index: 8;
  background: #fff;
  text-align: left;
}

.vysledky-freeze th.sticky-row.sticky-col, 
.vysledky-freeze th.sticky-intersect {
  top: 0;
  left: 48px;
  z-index: 7;
  background: linear-gradient(90deg,#e9f0ff,#f7f7ff);
}

/* Stíny pro sticky sloupce */
.vysledky-freeze th.sticky-col, 
.vysledky-freeze td.sticky-col,
.vysledky-freeze th:nth-child(2), 
.vysledky-freeze td:nth-child(2) {
  box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}

/* Hlavička cest */
.vysledky-freeze th.cell-cesta {
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1.1;
}

.cesta-info {
  font-size: 11px;
  font-weight: normal;
}

.vysledky-freeze th.cell-cesta .cesta-info {
  font-size: 10.5px;
}

/* Tělo tabulky */
.vysledky-freeze td {
  font-size: 11px;
  padding: 4px 6px;
}

/* =============================================================================
   HOVER EFEKT PRO TABULKU VÝSLEDKŮ
   ============================================================================= */

/* Základní stav - všechny řádky jsou plně viditelné */
.vysledky-freeze tbody tr {
  transition: opacity 0.3s ease;
}

/* Při najetí myší nad tabulku - všechny řádky v tbody se utlumí */
.vysledky-freeze:hover tbody tr {
  opacity: 0.4;
}

/* Aktivní řádek (nad kterým je myš) zůstává plně viditelný */
.vysledky-freeze tbody tr:hover {
  opacity: 1 !important;
}

/* Záhlaví tabulky se nikdy nezmění */
.vysledky-freeze thead th {
  opacity: 1 !important;
}

/* =============================================================================
   BUŇKY TABULKY - STAVY A OBSAH
   ============================================================================= */

.vybledla {
  background: #f7f7f7 !important;
  color: #bbb !important;
  box-shadow: none !important;
}

.cell-cesta.vybledla {
  background: #f7f7f7 !important;
  color: #bbb !important;
  box-shadow: none !important;
}

.lichy {
  filter: brightness(1.05);
}

.sudy {
  filter: brightness(0.95);
}

.fajfka {
  font-weight: bold;
  font-size: 1.1em;
  color: #FFF;
}

.pravdep {
  font-size: 0.7em;
  color: #888;
  font-weight: normal;
}

.oddelovac {
  border-right: 4px solid #222 !important;
}

/* =============================================================================
   ODKAZY A TLAČÍTKA
   ============================================================================= */

.odkaz-modry {
  font-size: 1.1em;
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
  padding: 0.3em 1.1em;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  background: #f7f7f7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.odkaz-modry:hover {
  background: #e6f0ff;
  color: #0056b3;
  text-decoration: underline;
}

.lezec-link {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.2s, color 0.2s;
  background: #f7f7f7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.lezec-link:hover {
  background: #e6f0ff;
  color: #0056b3;
  text-decoration: underline;
}

/* =============================================================================
   FORMULÁŘE A DROPDOWNY
   ============================================================================= */

.kolo-dropdown-label {
  font-weight: bold;
  margin-right: 0.5rem;
  font-size: 1rem;
}

.kolo-dropdown {
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  border: 2px solid #ddd;
  background: #fff;
  font-size: 1rem;
  font-weight: bold;
  color: #222;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.kolo-dropdown:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px #007bff33;
}

.kolo-dropdown option {
  font-size: 1rem;
  padding: 0.5rem;
}

.kolo-dropdown option.kolo-active {
  background-color: #d4edda;
  color: #155724;
}

.kolo-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: #555;
  font-size: 1.5rem;
  font-weight: normal;
  line-height: 1;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  cursor: pointer;
}

.kolo-nav-btn:hover:not(.disabled) {
  background: #f0f0f0;
  border-color: #999;
  color: #222;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.kolo-nav-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #f9f9f9;
  color: #bbb;
}

.kolo-nav-btn.disabled:hover {
  background: #f9f9f9;
  border-color: #ddd;
  color: #bbb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* =============================================================================
   NAVIGACE MEZI KOLY
   ============================================================================= */

.kola-navigation { 
  background: #f7f7f7; 
  border-radius: 12px; 
  padding: 1rem; 
  margin-bottom: 1rem; 
  text-align: center; 
}

.kola-buttons { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 0.5rem; 
  justify-content: center; 
  margin-top: 0.5rem; 
}

.kolo-button { 
  display: inline-block; 
  padding: 0.5rem 1rem; 
  background: #fff; 
  border: 2px solid #ddd; 
  border-radius: 8px; 
  text-decoration: none; 
  color: #222; 
  font-weight: bold; 
  transition: all 0.2s ease; 
}

.kolo-button:hover { 
  background: #f0f0f0; 
  border-color: #999; 
  transform: translateY(-1px); 
}

.kolo-button.active { 
  background: #007bff; 
  color: white; 
  border-color: #0056b3; 
}

.kolo-button small { 
  font-size: 10px; 
  font-weight: normal; 
  opacity: 0.8; 
}

/* =============================================================================
   STRÁNKA HISTORIE
   ============================================================================= */

.historie-controls {
  background: #f7f7f7;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.lezec-selector {
  margin-bottom: 1.5rem;
}

.lezec-selector label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 1.1em;
}

.search-container {
  position: relative;
  max-width: 400px;
  width: 100%;
  box-sizing: border-box;
}

#lezec-search {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

#lezec-search:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px #007bff33;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-result-item {
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border-bottom: 1px solid #eee;
}

.search-result-item:hover {
  background: #e6f0ff;
  color: #007bff;
  font-weight: bold;
}

.search-result-item:last-child {
  border-bottom: none;
}

.no-results {
  padding: 0.8rem 1rem;
  color: #666;
  font-style: italic;
}

.selected-lezci h3 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.2em;
}

.selected-lezci-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 100%;
  overflow-x: hidden;
}

.selected-lezec {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #e6f0ff;
  border: 2px solid #007bff;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-weight: bold;
  color: #007bff;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 1;
}

.remove-lezec {
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.remove-lezec:hover {
  background: #cc0000;
}

.selected-lezec .lezec-name {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.no-lezci {
  color: #666;
  font-style: italic;
  margin: 0;
}

/* =============================================================================
   GRAFY A CHARTY
   ============================================================================= */

.chart-container {
  background: white;
  border-radius: 12px;
  padding: 1rem 0.8rem;
  padding-bottom: 8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 1.5rem;
  height: 500px;
  position: relative;
}

/* =============================================================================
   OBECNÉ KOMPONENTY
   ============================================================================= */


.panel { 
  background: #f7f7f7; 
  border-radius: 12px; 
  padding: 1rem; 
  margin-bottom: 1rem; 
}

.layout-float-left { 
  float: left; 
  margin-right: 10px; 
  margin-top: 10px; 
}

.clear { 
  clear: both; 
}

.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
  gap: .75rem; 
  align-items: end; 
}

button { 
  padding: .5rem .8rem; 
  border: 1px solid #ddd; 
  border-radius: 8px; 
  background: #fff; 
  cursor: pointer; 
}

.detail-link { 
  text-align: center; 
  margin-bottom: 1rem; 
}

.detail-button { 
  display: inline-block; 
  padding: 0.75rem 1.5rem; 
  background: #28a745; 
  color: white; 
  text-decoration: none; 
  border-radius: 8px; 
  font-weight: bold; 
  transition: all 0.2s ease; 
}

.detail-button:hover { 
  background: #218838; 
  transform: translateY(-1px); 
  box-shadow: 0 2px 4px rgba(0,0,0,0.2); 
}

.empty-state {
  background: #f7f7f7;
  border-radius: 12px;
  padding: 3rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.empty-state-content h2 {
  color: #333;
  margin-bottom: 1rem;
  font-size: 1.5em;
}

.empty-state-content p {
  color: #666;
  margin: 0;
  font-size: 1.1em;
  line-height: 1.5;
}

/* =============================================================================
   POZNÁMKY A POZADÍ
   ============================================================================= */

.vysledky-note {
  font-size: 0.7em;
  color: #888;
  margin-top: 10px;
  text-align: right;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 1200px) {
  .chart-container {
    padding: 0.8rem 0.6rem;
    padding-bottom: 6.5rem;
    height: 460px;
  }
}

@media (max-width: 900px) {
  .chart-container {
    padding: 0.7rem 0.5rem;
    padding-bottom: 5.2rem;
    height: 420px;
  }
  #overview-wrapper { height: 70px !important; }
  
  /* Responsivní styly pro stránku historie na středních obrazovkách */
  .historie-controls {
    padding: 1.2rem;
  }
  
  .lezec-selector label {
    font-size: 1.05em;
  }
  
  #lezec-search {
    font-size: 0.95rem;
    padding: 0.7rem 0.9rem;
  }
  
  .selected-lezci h3 {
    font-size: 1.15em;
  }
  
  .selected-lezec {
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .vysledky-freeze th, .vysledky-freeze td { padding: 2px 4px; }
  .vysledky-freeze th.cell-cesta { font-size: 1rem; }
  .vysledky-freeze td { font-size: 10px; }
  
  /* Oprava headeru na mobilu - nadpis vlevo, odkaz vpravo, výběr pod nadpisem */
  .vysledky-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.8rem;
  }
  
  .vysledky-title {
    font-size: 1.6em;
    text-align: left;
    margin-right: 0;
    flex: 1;
    min-width: 0;
  }
  
  .vysledky-kolo {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    margin-top: 0.5rem;
  }
  
  .kolo-navigation {
    width: 100%;
    gap: 0.4rem;
  }
  
  .kolo-select-wrapper {
    flex: 1;
    min-width: 0;
  }
  
  .kolo-date {
    font-size: 0.8em;
  }
  
  .kolo-nav-btn {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 1.3rem;
    flex-shrink: 0;
  }
  
  .vysledky-link {
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
    flex: none;
    align-self: flex-start;
  }
  
  .kolo-dropdown {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
  
  .odkaz-modry {
    font-size: 1rem;
    padding: 0.3em 0.8em;
  }
  
  /* Oprava sticky sloupců na mobilu */
  .table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
  }
  
  .vysledky-freeze th:nth-child(2), 
  .vysledky-freeze td:nth-child(2) {
    position: sticky;
    left: 0;
    z-index: 20;
    background: #fff;
    min-width: 40px;
  }
  
  .vysledky-freeze thead th:nth-child(2) {
    z-index: 21;
  }
  
  /* Responsivní styly pro stránku historie */
  .historie-controls {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .lezec-selector {
    margin-bottom: 1rem;
  }
  
  .lezec-selector label {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }
  
  .search-container {
    max-width: 100%;
  }
  
  #lezec-search {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
  }
  
  .selected-lezci h3 {
    font-size: 1.1em;
    margin-bottom: 0.8rem;
  }
  
  .selected-lezci-list {
    gap: 0.4rem;
  }
  
  .selected-lezec {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .remove-lezec {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }
  
  .chart-container {
    padding: 0.6rem 0.4rem;
    padding-bottom: 4.2rem;
    height: 360px;
  }
  #overview-wrapper { height: 60px !important; }
}

@media (max-width: 420px) {
  /* Ještě lepší sticky sloupce pro velmi malé obrazovky */
  .vysledky-freeze th:nth-child(2), 
  .vysledky-freeze td:nth-child(2) {
    min-width: 35px;
    font-size: 9px;
  }
  
  .vysledky-freeze th.cell-cesta {
    font-size: 0.9rem;
    padding: 1px 2px;
  }
  
  .vysledky-freeze td {
    font-size: 9px;
    padding: 1px 2px;
  }
  
  /* Ještě kompaktnější header pro velmi malé obrazovky */
  .vysledky-header {
    padding: 0.6rem;
    gap: 0.6rem;
  }
  
  .vysledky-title {
    font-size: 1.4em;
  }
  
  .vysledky-kolo {
    margin-top: 0.3rem;
  }
  
  .kolo-dropdown {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }
  
  .odkaz-modry {
    font-size: 0.9rem;
    padding: 0.25em 0.6em;
  }
  
  /* Ještě kompaktnější styly pro stránku historie na velmi malých obrazovkách */
  .historie-controls {
    padding: 0.8rem;
    margin-bottom: 0.8rem;
  }
  
  .lezec-selector label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }
  
  #lezec-search {
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
  }
  
  .selected-lezci h3 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
  }
  
  .selected-lezec {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .remove-lezec {
    width: 16px;
    height: 16px;
    font-size: 11px;
  }
  
  .chart-container {
    padding: 0.5rem 0.3rem;
    padding-bottom: 3.2rem;
    height: auto;
  }
  #overview-wrapper { height: 52px !important; }
}
