/* Import moderních písem z Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  /* Barevná paleta - Magická noc */
  --bg-midnight: #080616;
  --bg-card-glass: rgba(22, 18, 48, 0.45);
  --border-glass: rgba(255, 255, 255, 0.08);
  --accent-lavender: #a897ff;
  --accent-indigo: #6353d2;
  --accent-pink: #ffa3e3;
  --text-primary: #f0ecff;
  --text-secondary: #a9a3cc;
  --text-muted: #6e6799;
  --success: #63e2b7;
  --error: #e88080;
  
  /* Stíny a zaoblení */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-glow: 0 8px 32px 0 rgba(10, 5, 30, 0.5);
  --shadow-neon: 0 0 15px rgba(168, 151, 255, 0.35);
  
  --font-sans: 'Outfit', sans-serif;
  --font-serif: 'Playfair Display', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-midnight);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 83, 210, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 163, 227, 0.1) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* Hlavní kontejner simulující mobilní aplikaci */
.app-container {
  width: 100%;
  max-width: 480px; /* Perfektní pro telefony a tablety na šířku */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: rgba(8, 6, 22, 0.6);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  padding-bottom: 80px; /* Prostor pro spodní navigaci */
}

/* Hlavička aplikace */
header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--accent-lavender);
}

.user-badge {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--accent-lavender);
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-badge:hover {
  background: rgba(168, 151, 255, 0.15);
  box-shadow: var(--shadow-neon);
}

/* Hlavní obsah - sekce */
main {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

/* Glassmorphic karty */
.card {
  background: var(--bg-card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-glow);
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

p.subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 15px;
}

/* Formulářové prvky */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  background: rgba(10, 8, 30, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-lavender);
  box-shadow: var(--shadow-neon);
  background: rgba(16, 12, 45, 0.8);
}

textarea {
  resize: none;
  height: 100px;
}

/* Výběr hrdiny (dětských profilů) formou dlaždic */
.child-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.child-tile {
  background: rgba(10, 8, 30, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.child-tile:hover {
  background: rgba(168, 151, 255, 0.08);
}

.child-tile.selected {
  background: rgba(99, 83, 210, 0.3);
  border-color: var(--accent-lavender);
  box-shadow: var(--shadow-neon);
}

.child-tile .avatar {
  font-size: 2rem;
  margin-bottom: 8px;
}

.child-tile .name {
  font-weight: 600;
  font-size: 1rem;
}

.child-tile .age {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Tlačítka */
.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-lavender) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 83, 210, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 83, 210, 0.6), var(--shadow-neon);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Spodní Navigační Panel */
.nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgba(13, 10, 31, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: none;
  border: none;
}

.nav-item i {
  font-size: 1.3rem;
}

.nav-item.active {
  color: var(--accent-pink);
  text-shadow: 0 0 10px rgba(255, 163, 227, 0.5);
}

/* Knihovna / Historie Pohádek */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.story-item:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(4px);
}

.story-item img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.story-item-info {
  flex: 1;
}

.story-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.story-item-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Nabíjecí obrazovka (Loader) */
.loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 6, 22, 0.95);
  backdrop-filter: blur(25px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 40px;
  text-align: center;
}

.loader-overlay.active {
  display: flex;
}

.loader-spinner {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--bg-card-glass);
  border-top-color: var(--accent-pink);
  animation: spin 1.5s linear infinite;
  margin-bottom: 30px;
  box-shadow: var(--shadow-neon);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.loader-status {
  font-size: 0.95rem;
  color: var(--text-secondary);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ==========================================
   HLAVNÍ AUDIO PŘEHRÁVAČ (DETIAL POHÁDKY)
   ========================================== */
.player-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.player-artwork {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  border: 1px solid var(--border-glass);
  position: relative;
}

.player-artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin-top: 10px;
}

.player-child {
  font-size: 0.9rem;
  color: var(--accent-lavender);
  font-weight: 500;
}

/* Časová osa (Timeline) */
.timeline-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.time-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-pink);
  box-shadow: 0 0 10px var(--accent-pink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.time-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Animované zvukové vlny (Waveform) */
.waveform {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: 40px;
  margin: 10px 0;
}

.wave-bar {
  width: 3px;
  height: 8px;
  background: var(--accent-lavender);
  border-radius: 1.5px;
  transition: all 0.3s ease;
}

.waveform.playing .wave-bar {
  animation: dance 1.2s infinite ease-in-out;
}

/* Různé rychlosti pro přirozenější pohyb vln */
.waveform.playing .wave-bar:nth-child(even) { animation-duration: 0.8s; }
.waveform.playing .wave-bar:nth-child(3n) { animation-duration: 1.5s; }
.waveform.playing .wave-bar:nth-child(4n) { animation-duration: 1.1s; }

@keyframes dance {
  0%, 100% { height: 8px; }
  50% { height: 35px; background-color: var(--accent-pink); }
}

/* Ovládací prvky přehrávače */
.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 10px 0;
}

.btn-control {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-control:hover {
  color: var(--accent-lavender);
  transform: scale(1.1);
}

.btn-play-pause {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-lavender) 100%);
  color: white;
  font-size: 1.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 20px rgba(255, 163, 227, 0.4);
}

.btn-play-pause:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 163, 227, 0.6);
  color: white;
}

/* Časovač vypnutí (Sleep Timer) */
.sleep-timer-section {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.sleep-timer-section i {
  color: var(--accent-lavender);
}

/* Text pohádky pro vlastní čtení */
.story-text-card {
  margin-top: 20px;
  text-align: left;
}

.story-text-content {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-top: 15px;
}

.story-text-content p {
  margin-bottom: 18px;
}

/* Modální okno pro Sleep Timer */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 6, 22, 0.85);
  backdrop-filter: blur(15px);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-glow);
}

.timer-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.timer-opt-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 14px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-opt-btn:hover {
  background: rgba(168, 151, 255, 0.15);
  border-color: var(--accent-lavender);
}
