/* ==========================================================================
   Základní layout stránky
   ========================================================================== */

body {
  margin: 0;
  padding: 0;
  background-color: #e9ebef;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden; /* Zabrání vodorovnému posuvníku */
}

.page-wrapper {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  background: #e9ebef;
  width: 100%;
}

.content-wrapper {
  display: flex;
  /* ZMĚNA: Místo fixní šířky použijeme maximální a 100% */
  width: 100%;
  max-width: 1380px;
  box-sizing: border-box;
}

.main-content {
  /* ZMĚNA: Hlavní obsah je pružný */
  width: 100%;
  max-width: 1080px; 
  min-height: 100vh;
  background: white;
  box-sizing: border-box;
  margin: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.main-inner {
  padding: 30px 30px 60px 30px;
  box-sizing: border-box;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

h1 {
    font-size: 1.8em;
    margin-top: 0.5em;
}

/* ==========================================================================
   Branding (Barevné pruhy)
   ========================================================================== */

.branding-left, .branding-right {
  width: 150px;
  min-height: 100vh; /* Změna na min-height */
  background: repeating-linear-gradient(
    135deg, #ffecd2, #ffecd2 32px, #f7caca 32px, #f7caca 70px
  );
  box-sizing: border-box;
  /* Sticky funguje jen na desktopu dobře, na mobilu ho schováme */
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0; /* Aby se nesmrskávaly */
}

.branding-left {
  border-right: 3px dashed #d93025;
}

.branding-right {
  border-left: 3px dashed #d93025;
}

.branding-top {
  width: 100%;
  height: 100px;
  background: repeating-linear-gradient(
    45deg, #d1e4fd, #d1e4fd 33px, #a8c3fa 33px, #a8c3fa 70px
  );
  border-bottom: 3px dashed #d93025;
  margin-bottom: 8px;
  position: relative;
  z-index: 50;
}


/* ==========================================================================
   Hlavička (Header)
   ========================================================================== */

.header-wrapper {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: rgba(255, 255, 255, 1);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 16px 26px 16px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}
      
.header-wrapper.header--faded {
  background-color: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
}

.header {
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: 16px;
}

.header__logo-text {
  font-weight: bold;
  font-size: 1.6em;
  color: #191919;
  user-select: none;
  letter-spacing: 0.02em;
}

.header__spacer {
  flex: 1;
}

/* ==========================================================================
   Mřížka s kartami (Cards Grid)
   ========================================================================== */

.cards-grid {
  display: grid;
  /* ZMĚNA: Responsivní sloupce. Minimum 280px, jinak se roztáhne */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  width: 100%;
  grid-auto-flow: dense;
}

.card {
  position: relative;
  height: 420px;
  border-radius: 18px;
  overflow: hidden;
  background: #222;
  box-shadow: 0 2px 18px rgba(0,0,0,0.08);
  transition: transform 0.15s cubic-bezier(.4,2,.8,1), box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  text-decoration: none;
  width: 100%; /* Aby karta vyplnila buňku gridu */
  box-sizing: border-box;
}

.card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 4px 32px rgba(0,0,0,0.18);
  z-index: 5;
}

.card__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  filter: brightness(0.83);
  transition: filter 0.2s;
}

.card:hover .card__bg {
  filter: brightness(0.60);
}

.card__overlay-gradient {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60%; /* Zvýšeno pro lepší čitelnost */
  background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6) 50%, transparent 100%);
  z-index: 2;
  transition: background 0.2s;
}

.card__text, .card__perex {
  position: absolute;
  left: 24px; right: 24px; bottom: 28px;
  z-index: 3;
  color: white;
  line-height: 1.25;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: opacity 0.15s;
  pointer-events: none;
}

.card__text {
  font-size: 1.3em;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  max-height: 5em; /* Limit výšky */
  opacity: 1;
}

.card__perex {
  font-size: 1em;
  font-weight: 400;
  font-style: italic;
  max-height: 18em;
  -webkit-line-clamp: 12;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
}

.card:hover .card__text {
  opacity: 0;
}
.card:hover .card__perex {
  opacity: 1;
}

.card__meta {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  font-size: 0.9em;
  opacity: 0.95;
  z-index: 3;
  text-shadow: 0 1px 7px rgba(0,0,0,0.8);
  pointer-events: auto;
  font-weight: 600;
  gap: 0.4em;
  color: white;
  flex-wrap: wrap; /* Aby tagy nelezly ven */
}

.card__meta > *:last-child {
    margin-left: auto;
}

/* ==========================================================================
   Velikosti karet (S, M, L)
   ========================================================================== */

/* M (Medium) - card--size-m - zabere 2 sloupce */
.card--size-m {
  grid-column: span 2;
}
.card--size-m .card__text {
  font-size: 1.8em;
  -webkit-line-clamp: 5;
  max-height: 7em;
}

/* L (Large) - card--size-l - zabere celý řádek (3 sloupce) */
.card--size-l {
  grid-column: 1 / -1;
}
.card--size-l .card__text {
  font-size: 2.4em;
  -webkit-line-clamp: 4;
  max-height: 6em;
}


/* ==========================================================================
   UI Komponenty
   ========================================================================== */

.card__meta form.chip-form {
  display: inline;
  margin: 0; padding: 0;
}

.chip-link.chip {
  background-color: #d93025;
  color: white;
  padding: 4px 12px 3px 12px;
  border-radius: 12px;
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
  user-select: none;
  margin-right: 0.4em;
  margin-bottom: 4px; /* Pro případ zalamování */
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
  z-index: 12;
}

.chip-link.chip:hover {
  transform: scale(1.05);
  background: #b91c1c;
}

.chip-link.chip--active {
  background: #2e7d32;
}

.chip--tag { background-color: #5f6368; }
.chip--tag:hover { background-color: #3c4043; }
.chip-tag-active { background: #1e8e3e; }


/* Dropdown menu pro tagy */
.tag-dropdown-container { position: relative; display: inline-block; }
.tag-dropdown-menu {
  display: none;
  position: absolute;
  background-color: #fff;
  min-width: 180px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 20;
  border-radius: 6px;
  padding: 8px 0;
  top: 100%; /* Otevře se pod tlačítkem */
  left: 0;
  margin-top: 5px;
}
.tag-dropdown-menu.show { display: block; }
.tag-dropdown-menu form { margin: 0; }
.tag-dropdown-menu button {
  color: #333;
  padding: 8px 16px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95em;
}
.tag-dropdown-menu button:hover { background-color: #f1f1f1; }
.tag-fav-icon { display: inline-block; width: 1.2em; color: #1e8e3e; font-weight: bold; }

/* Přepínač feedu */
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap; /* Povolit zalomení na mobilu */
  gap: 10px;
}

.toggle-switch-link {
  background-color: #e4e6eb;
  color: #050505;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  border: 1px solid #ccc;
  white-space: nowrap;
}

/* Notifikace */
#notification-bar {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%); /* Vycentrování */
    z-index: 2000;
    display: none;
    text-align: center;
    width: max-content;
    max-width: 90%;
}

#notification-bar a {
    color: white;
    background: rgba(255,255,255,0.2);
    margin-left: 10px;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
}

/* ==========================================================================
   MEDIA QUERIES - RESPONSIVITA (To nejdůležitější)
   ========================================================================== */

/* 1. Krok: Tablet a menší desktop (pod 1300px) 
   - Schováme postranní branding
   - Obsah roztáhneme na střed
*/
@media (max-width: 1300px) {
  .branding-left, .branding-right, .branding-top {
    display: none;
  }
  .content-wrapper {
    justify-content: center;
    max-width: 100%;
  }
  .main-content {
    width: 100%;
    max-width: 1000px; /* Trochu užší než full desktop pro lepší čtení */
  }
  .page-wrapper {
      padding: 0 20px; /* Aby se obsah nelepil na kraje obrazovky */
      box-sizing: border-box;
  }
}

/* 2. Krok: Menší tablety (pod 900px) 
   - Karty, které zabíraly 2 sloupce (M), se zmenší na 1, pokud není místo
*/
@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
  /* Vynutíme, aby M a L karty zabíraly méně místa, když se nevejdou */
  .card--size-m {
     grid-column: span 1; 
  }
  .card--size-m .card__text {
      font-size: 1.4em; /* Zmenšíme písmo */
  }
}

/* 3. Krok: Mobily (pod 600px) 
   - Všechno do jednoho sloupce
   - Menší paddingy
*/
@media (max-width: 600px) {
  .page-wrapper {
      padding: 0; /* Na mobilu chceme obsah až do krajů */
  }
  .main-content {
      width: 100%;
  }
  .main-inner {
    padding: 15px; /* Menší vnitřní odsazení */
  }
  
  .header-wrapper {
      padding: 12px 15px;
      margin-bottom: 15px;
  }
  
  .feed-header h1 {
      font-size: 1.5em;
  }

  .cards-grid {
    display: flex; /* Místo gridu flex, aby šlo vše pod sebe */
    flex-direction: column;
    gap: 20px;
  }

  .card {
    height: 380px; /* Trochu menší výška na mobilu */
    width: 100%;
  }
  
  /* Reset velikostí karet - na mobilu jsou všechny 100% */
  .card--size-m, .card--size-l {
    grid-column: auto;
  }
  
  .card__text, 
  .card--size-m .card__text, 
  .card--size-l .card__text {
    font-size: 1.4em; /* Jednotná velikost písma */
    bottom: 20px;
    left: 15px; right: 15px;
  }
  
  .card__meta {
      left: 15px; right: 15px; top: 15px;
  }
}