 /* Reset a základní styly */
* {
  box-sizing: border-box;
}

/* CSS proměnné pro světlý/tmavý režim */
:root {
  /* Tmavý režim (výchozí) */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #30363d;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --accent-primary: #58a6ff;
  --accent-hover: #1f6feb;
  --border-color: #30363d;
  --shadow-color: rgba(0,0,0,0.5);
  --toast-bg: #323232;
  --success-color: #4CAF50;
  --error-color: #f44336;
  
  /* OPRAVENO: Kompaktní header výška */
  --header-height: 50px;
}

/* Světlý režim */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #e1e4e8;
  --text-primary: #24292e;
  --text-secondary: #586069;
  --accent-primary: #0366d6;
  --accent-hover: #0056b3;
  --border-color: #e1e4e8;
  --shadow-color: rgba(0,0,0,0.1);
  --toast-bg: #24292e;
  --success-color: #28a745;
  --error-color: #dc3545;
}

/* Základní styly těla */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Přidáme CSS pro kontrolu zoomu */
  zoom: var(--app-zoom, 1);
  /* Vylepšené plynulé scrollování */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* OPRAVENO: Hlavička s kompaktní výškou */
header {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  /* OPRAVENO: Minimální padding bez zbytečných mezer */
  padding: env(safe-area-inset-top) 1rem 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0; 
  left: 0; 
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px var(--shadow-color);
  /* OPRAVENO: Kompaktní výška */
  height: calc(50px + env(safe-area-inset-top));
  min-height: 50px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Header sections */
.header-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.header-center {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: flex-end;
}

/* OPRAVENO: Responzivní chování headeru bez změny výšky */
@media (max-width: 768px) {
  header {
    /* Zachováváme stejnou výšku, jen upravíme padding */
    padding: calc(env(safe-area-inset-top) + 0.4rem) 0.8rem 0.4rem 0.8rem;
  }
  
  h1 {
    font-size: 1.1rem;
  }
  
  .header-center {
    display: block;
    position: static;
    transform: none;
    left: auto;
    flex: 0 0 auto;
    order: 1;
  }
  
  .header-right {
    gap: 0.3rem;
  }
  
  .header-controls {
    gap: 0.3rem !important;
  }
  
  /* Zoom kontroly na mobilech - kompaktnější */
  .zoom-controls {
    display: none !important;
  }
}

/* Tlačítka v hlavičce */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.4rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background-color: var(--bg-tertiary);
}

/* View toggle button */
.view-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.4rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle:hover {
  background-color: var(--bg-tertiary);
}

/* Zoom controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  padding: 0.2rem;
}

.zoom-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:hover {
  background-color: var(--bg-secondary);
}

.zoom-display {
  color: var(--text-secondary);
  font-size: 0.9rem;
  min-width: 45px;
  text-align: center;
  font-weight: 500;
}

/* Menu button */
.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: inherit;
  padding: 0.4rem;
  transition: transform 0.3s, background-color 0.2s;
  z-index: 1002;
  border-radius: 6px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn:hover {
  background-color: var(--bg-tertiary);
}

.menu-btn.open {
  transform: rotate(90deg);
}

/* OPRAVENO: Sidebar s kompaktním top offsetem */
.sidebar {
  width: 220px;
  background-color: var(--bg-secondary);
  padding: 1rem;
  overflow-y: auto;
  position: fixed;
  top: calc(50px + env(safe-area-inset-top)); /* OPRAVENO: Přesná hodnota */
  left: 0;
  bottom: 0;
  z-index: 1001;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
}

.sidebar h3 {
  margin-top: 0;
  color: var(--accent-primary);
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  margin-bottom: 0.5rem;
  padding: 0.3rem;
  transition: background-color 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 4px;
}

.sidebar li:hover {
  background-color: var(--bg-tertiary);
}

/* OPRAVENO: Hlavní obsah s vyváženým paddingem */
.main-content {
  flex: 1;
  padding: 0.5rem;
  /* OPRAVENO: Malá mezera pro čitelnost, ale stále minimální */
  padding-top: calc(50px + env(safe-area-inset-top) + 0.15rem);
  margin-left: 220px;
  transition: margin-left 0.3s ease;
  overflow-y: auto;
  background-color: var(--bg-primary);
  /* Vylepšené scrollování */
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    /* OPRAVENO: Malá mezera i na mobilech pro čitelnost */
    padding-top: calc(50px + env(safe-area-inset-top) + 0.15rem);
  }
}

/* OPRAVENO: Horizontální zobrazení - nová plynulá implementace */
.horizontal-view .audiobook-list {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 1rem;
  padding: 0.5rem 0 1.5rem 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* Skryjeme scrollbar na mobilech, ale zachováme funkcionalitu */
  -ms-overflow-style: none;
  scrollbar-width: none;
  /* OPRAVENO: Povolujeme jak horizontální tak vertikální touch scrollování */
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  padding-left: 1rem;
  padding-right: 1rem;
  justify-content: flex-start;
  align-items: flex-start;
  min-width: 100%;
  
  /* OPRAVENO: Smooth scrolling optimalizace */
  will-change: scroll-position;
  contain: layout style paint;
}

/* Skryjeme scrollbar na Webkit prohlížečích jen na mobilech */
@media (max-width: 768px) {
  .horizontal-view .audiobook-list::-webkit-scrollbar {
    display: none;
  }
}

/* Na desktopu zobrazíme hezký scrollbar */
@media (min-width: 769px) {
  .horizontal-view .audiobook-list::-webkit-scrollbar {
    height: 8px;
    margin-top: 4px;
  }

  .horizontal-view .audiobook-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin: 0 1rem;
  }

  .horizontal-view .audiobook-list::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
    transition: background-color 0.2s ease;
  }

  .horizontal-view .audiobook-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
  }
}

.horizontal-view .audiobook {
  flex: 0 0 160px;
  scroll-snap-align: start;
  min-height: 240px;
  margin-bottom: 0;
}

.horizontal-view .audiobook:last-child {
  margin-right: 1rem;
}

/* Grid view (výchozí) */
.grid-view .audiobook-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  justify-content: center;
  grid-auto-flow: dense;
  padding: 0;
}

/* Responzivní grid */
@media (max-width: 480px) {
  .grid-view .audiobook-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8rem;
  }
}

@media (min-width: 1200px) {
  .grid-view .audiobook-list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* Knihy */
.audiobook {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-secondary);
  box-shadow: 0 2px 5px var(--shadow-color);
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.3s ease, background-color 0.3s ease;
  transform: scale(0.9);
  opacity: 0;
  padding-bottom: 0.5rem;
  cursor: grab;
  z-index: 1;
}

.audiobook:active {
  cursor: grabbing;
}

.audiobook.show {
  transform: scale(1);
  opacity: 1;
}

.audiobook:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.audiobook img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  margin: 0;
  transition: transform 0.3s;
}

.audiobook img:hover {
  transform: scale(1.05);
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.2rem;
}

.controls select,
.controls button,
.controls input[type="text"] {
  padding: 0.5rem;
  border-radius: 4px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  min-width: 150px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.controls select:hover,
.controls button:hover,
.controls input[type="text"]:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.controls button {
  cursor: pointer;
}

/* Small buttons - zvětšíme pro lepší dotykový zážitek */
.small-btn {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.small-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* OPRAVENO: Vylepšený offline status indikátor - lépe viditelná zelená fajfka */
.offline-status-indicator {
  background: rgba(76, 175, 80, 0.15); /* Jemné pozadí pro lepší viditelnost */
  color: var(--success-color);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: 50%; /* Okrouhlý tvar */
  padding: 0.4rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1010;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.offline-status-indicator:hover {
  transform: scale(1.15);
  background: rgba(76, 175, 80, 0.25);
  border-color: rgba(76, 175, 80, 0.5);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.offline-status-indicator i {
  font-size: 1.4rem;
  color: #4CAF50;
  text-shadow: 0 1px 3px rgba(76, 175, 80, 0.4);
  filter: drop-shadow(0 0 2px rgba(76, 175, 80, 0.5));
}

/* Animační efekt pro nově stažené knihy */
.offline-status-indicator.newly-cached {
  animation: offlineIndicatorPulse 1s ease-in-out;
}

@keyframes offlineIndicatorPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
  }
}

/* Menu content */
.menu-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 150px;
  border-radius: 4px;
  box-shadow: 0 2px 5px var(--shadow-color);
  z-index: 1001;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.menu-content.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.menu-content a {
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.menu-content a:last-child {
  border-bottom: none;
}

.menu-content a:hover {
  background-color: var(--bg-tertiary);
}

/* Toast notifikace */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 2000;
}

.toast {
  background-color: var(--toast-bg);
  color: #fff;
  padding: 1rem 1.5rem;
  margin-top: 0.5rem;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background-color: var(--success-color);
}

.toast.error {
  background-color: var(--error-color);
}

.toast.info {
  background-color: #2196F3;
}

/* Modern Login Container */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
}

/* Particles Background */
.particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

/* Modern Login Card */
.modern-login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 450px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: none;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: cardFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* PC verze - větší karta */
@media (min-width: 769px) {
  .modern-login-card {
    max-width: 500px;
    padding: 4rem 3.5rem;
  }

  .login-title {
    font-size: 2.5rem;
  }

  .input-field input {
    padding: 1.2rem 3.5rem 1.2rem 1.2rem;
    font-size: 16px;
  }

  .input-field label {
    font-size: 16px;
    left: 1.2rem;
  }

  .input-field .input-icon {
    right: 1.2rem;
  }

  .modern-login-btn {
    padding: 1.2rem;
    font-size: 18px;
  }
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-title {
  margin: 0 0 2.5rem 0;
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  letter-spacing: -0.5px;
}

/* Modern Form */
.modern-login-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Input Fields with Floating Label */
.input-field {
  position: relative;
}

.input-field input {
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ffffff;
  font-size: 15px;
  box-sizing: border-box;
  transition: all 0.3s ease;
  outline: none;
}

.input-field input:focus {
  border-color: rgba(88, 166, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.1);
}

.input-field label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  transition: all 0.3s ease;
  pointer-events: none;
  background: transparent;
  padding: 0 0.25rem;
}

.input-field input:focus + label,
.input-field input:not(:placeholder-shown) + label {
  top: -0.5rem;
  left: 0.85rem;
  font-size: 12px;
  color: #58a6ff;
  background: linear-gradient(to bottom, transparent 50%, rgba(255, 255, 255, 0.03) 50%);
}

.input-field .input-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-field input:focus ~ .input-icon {
  color: #58a6ff;
}


/* Modern Login Button */
.modern-login-btn {
  width: 100%;
  padding: 1rem;
  margin-top: 0.5rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #58a6ff 0%, #1f6feb 100%);
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  box-shadow: 0 4px 15px rgba(88, 166, 255, 0.3);
}

.modern-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(88, 166, 255, 0.4);
  background: linear-gradient(135deg, #6ab0ff 0%, #3078fb 100%);
}

.modern-login-btn:active {
  transform: translateY(0);
}

/* Responsive - Tablet */
@media (max-width: 768px) {
  .modern-login-card {
    max-width: 90%;
    padding: 2.5rem 2rem;
    margin: 1.5rem;
  }

  .login-title {
    font-size: 1.75rem;
  }

  .input-field input {
    font-size: 16px;
  }

  .modern-login-btn {
    font-size: 16px;
  }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
  .modern-login-card {
    max-width: 95%;
    padding: 2rem 1.5rem;
    margin: 1rem;
  }

  .login-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
  }

  .modern-login-form {
    gap: 1.5rem;
  }

  .input-field input {
    padding: 0.9rem 3rem 0.9rem 0.9rem;
    font-size: 16px;
  }

  .input-field label {
    left: 0.9rem;
    font-size: 14px;
  }

  .input-field .input-icon {
    right: 0.9rem;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .modern-login-card {
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
  }

  .login-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .modern-login-form {
    gap: 1.25rem;
  }
}

/* Sliding form containers */
.sliding-form-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.5s ease;
  opacity: 0;
  background-color: var(--bg-secondary);
  padding: 0 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px var(--shadow-color);
  margin-bottom: 0.2rem;
}

.sliding-form-container.show {
  max-height: 1000px;
  opacity: 1;
  padding: 1rem;
}

.sliding-form-container input,
.sliding-form-container select,
.sliding-form-container textarea {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.sliding-form-container input:focus,
.sliding-form-container select:focus,
.sliding-form-container textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Genre sections */
.genre-section {
  margin-bottom: 0.5rem;
}

.genre-title {
  font-size: 1.5rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent-primary);
  display: inline-block;
  padding-bottom: 0.3rem;
}

/* Drag handle */
.drag-handle {
  position: absolute;
  top: 5px;
  left: 5px;
  background-color: rgba(0,0,0,0.7);
  border: none;
  color: white;
  padding: 0.2rem;
  border-radius: 4px;
  cursor: grab;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1004;
  touch-action: none;
}

[data-theme="light"] .drag-handle {
  background-color: rgba(0,0,0,0.5);
}

/* Genre actions */
.genre-actions {
  margin-top: 1rem;
}

.genre-actions button {
  background-color: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.genre-actions button:hover {
  background-color: var(--accent-hover);
}

/* Genre buttons */
.genre-buttons {
  display: flex;
  gap: 0.3rem;
}

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

.modal-content {
  background-color: var(--bg-primary);
  padding: 20px;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  color: var(--text-primary);
  opacity: 1;
}

.modal-content.show {
  opacity: 1;
}

.close-modal {
  color: var(--text-secondary);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover {
  color: var(--text-primary);
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Container adjustments */
.container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  height: 100vh;
}

/* Zoom controls in menu */
.zoom-btn-menu {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn-menu:hover {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.zoom-display-menu {
  color: var(--text-primary);
  font-size: 0.9rem;
  min-width: 45px;
  text-align: center;
  font-weight: 500;
}

#zoom-menu-toggle {
  position: relative;
}

#zoom-submenu {
  transition: all 0.2s ease;
}

/* Network status styles */
.network-status {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
  display: none;
}

.network-status.online {
  background: rgba(76, 175, 80, 0.9);
  color: white;
  border: 1px solid #4CAF50;
  display: block;
}

.network-status.offline {
  background: rgba(244, 67, 54, 0.9);
  color: white;
  border: 1px solid #f44336;
  display: block;
}

/* Loading states */
.loading {
  opacity: 0.6;
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1005;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Download progress overlay */
.download-progress-overlay,
#download-progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 8px;
  backdrop-filter: blur(5px);
}

/* Download tlačítko na detail stránce */
.download-overlay {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.download-overlay:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.download-overlay i {
  color: white;
  font-size: 1.2rem;
}

.download-overlay.downloaded {
  background: rgba(76, 175, 80, 0.9);
}

.download-overlay.downloaded:hover {
  background: rgba(76, 175, 80, 1);
}

/* Sjednocení offline tlačítek mezi index a detail stránkami */
.offline-btn.downloaded,
.download-overlay.downloaded {
  background-color: var(--success-color) !important;
  color: white !important;
  border-color: var(--success-color) !important;
}

.offline-btn.downloaded:hover,
.download-overlay.downloaded:hover {
  background-color: #45a049 !important;
  border-color: #45a049 !important;
  transform: scale(1.05);
}

.progress-circle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.progress-ring {
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 5px rgba(88, 166, 255, 0.5));
}

.progress-ring-background {
  fill: transparent;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 4;
}

.progress-ring-progress {
  fill: transparent;
  stroke: var(--accent-primary);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}

.progress-text {
  position: absolute;
  color: white;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.progress-label {
  color: white;
  font-size: 14px;
  margin-top: 10px;
  font-weight: 500;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease;
}

/* Fix responzivních problémů při zoom */
:root {
  --app-zoom: 1;
}

body {
  zoom: var(--app-zoom, 1);
}

/* Audiokniha - popis knihy s formátováním odstavců */
#detail-description {
  line-height: 1.6;
  margin: 1rem 0;
  color: var(--text-primary);
  font-size: 1rem;
  /* Zachováváme formátování odstavců */
  white-space: pre-line;
  /* Povolit zalamování dlouhých řádků */
  word-wrap: break-word;
  /* Lepší typografie */
  text-align: justify;
  padding: 0.8rem;
  background-color: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: background-color 0.3s ease;
}

/* Styling pro editační formulář popisu */
#detail-edit-book-description,
#book-description {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

/* Actions */
.audiobook .actions {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Focus styles */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
  .sidebar li,
  .controls button,
  .controls select,
  .controls input {
    min-height: 44px;
  }
  
  .audiobook {
    min-height: 200px;
  }
  
  .controls {
    gap: 0.8rem;
  }
  
  .audiobook-list {
    gap: 0.8rem;
  }
}

/* Vylepšená responsivnost */
@media (max-width: 480px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls > * {
    width: 100%;
    min-width: unset;
  }
  
  .horizontal-view .audiobook {
    flex: 0 0 140px;
    min-height: 220px;
  }
}

/* Vylepšené loading states */
.audiobook.loading {
  opacity: 0.6;
  pointer-events: none;
}

.audiobook.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--bg-tertiary);
  border-top: 2px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== MODAL PRO MAZÁNÍ VIDEA ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
}

.delete-modal .modal-header {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-body {
  padding: 2rem;
  color: var(--text-primary);
}

.modal-body p {
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.video-title-highlight {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 4px solid #dc2626;
  font-weight: 600;
  color: var(--accent-primary);
  margin: 1.5rem 0;
}

.warning-text {
  color: #fbbf24;
  font-weight: 500;
  background: rgba(251, 191, 36, 0.1);
  padding: 0.75rem;
  border-radius: 8px;
  border-left: 4px solid #fbbf24;
}

.modal-footer {
  padding: 1.5rem 2rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  background: var(--bg-secondary);
  border-radius: 0 0 12px 12px;
  border-top: 1px solid var(--border-color);
}

.btn-cancel {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: var(--bg-primary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-delete {
  padding: 0.75rem 1.5rem;
  border: none;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-delete:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.delete-btn {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.delete-btn:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}


/* Univerzální modal tlačítka (v2.14.0) */
.modal-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.modal-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.modal-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.modal-btn-secondary:hover {
  background: var(--bg-tertiary);
}

.modal-btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
}

.modal-btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* Dark mode adjustments */
[data-theme="dark"] .modal-content {
  background: #1a1a1a;
  border-color: #2a2a2a;
}

[data-theme="dark"] .modal-footer {
  background: #0f0f0f;
  border-color: #2a2a2a;
}

[data-theme="dark"] .video-title-highlight {
  background: #2a2a2a;
}


/* FLEXBOX PRO VIDEA - jen pro video kontejnery */
#folders-container,
#videos-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-content: flex-start;
}

/* FIX: Zabránění auto-zoom při psaní do přihlašovacích polí na mobilech */
.login-container input,
.modern-login-form input {
  font-size: 16px !important;
  /* Větší font zabrání auto-zoom i při initial-scale < 1.0 */
}
