/* EyeLink IoT — Modern Dark Theme */
:root {
  /* Primární barvy - inspirováno IoT dashboardy */
  --primary: #00d4ff;           /* Cyan - moderní tech barva */
  --primary-dark: #0099cc;
  --primary-light: #66e0ff;
  
  /* Sekundární barvy */
  --accent: #ff6b6b;            /* Červená - pro důležité akce */
  --success: #51cf66;          /* Zelená - úspěch */
  --warning: #ffd93d;          /* Žlutá - varování */
  --info: #74c0fc;             /* Světle modrá - informace */
  
  /* Pozadí a text */
  --surface: #0a0a0a;          /* Tmavé pozadí */
  --surface-light: #1a1a1a;     /* Lehčí pozadí */
  --card-bg: #141414;          /* Karty */
  --card-hover: #1f1f1f;
  --text: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  
  /* Rámečky a efekty */
  --border: #2a2a2a;
  --border-light: #3a3a3a;
  --shadow: rgba(0, 0, 0, 0.5);
  --glow: rgba(0, 212, 255, 0.3);
  
  /* Specifické hodnoty */
  --chart-line: var(--primary);
  --chart-fill: rgba(0, 212, 255, 0.1);
}

/* Povinné styly pro tmavý režim */
@media (prefers-color-scheme: dark) {
  :root {
    /* už nastaveno výše */
  }
}

/* Hlavní layout */
body {
  background: linear-gradient(135deg, #0a0a0a 0%, #0f0f0f 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  min-height: 100vh;
}

/* Hlavička - Moderní horní menu */
.app-header {
  background: linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px var(--shadow);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px var(--glow);
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.nav-section {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-menu {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
  background: rgba(0, 212, 255, 0.1);
}

.nav-link.active {
  color: var(--primary);
  background: rgba(0, 212, 255, 0.15);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 20px;
  color: var(--primary-light);
  font-size: 0.9rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* Boční menu - Moderní design */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0f0f0f 0%, #050505 100%);
  height: calc(100vh - 80px);
  position: fixed;
  top: 80px;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--border);
  z-index: 100;
}

/* Logo/branding */
.sidebar-header {
  padding: 2rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 212, 255, 0.05);
}

.sidebar-logo {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.4rem;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px var(--glow);
}

.sidebar-title {
  text-align: center;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}
}

/* Menu sekce */
.sidebar-menu {
  padding: 1rem 0;
}

.menu-section {
  margin-bottom: 2rem;
}

.section-title {
  padding: 0 1.5rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Menu položky */
.menu-item {
  position: relative;
  margin: 0.25rem 0.5rem;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.menu-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.menu-link:hover {
  background: rgba(0, 212, 255, 0.08);
  color: var(--primary);
  transform: translateX(4px);
}

.menu-link:hover::before {
  transform: scaleY(1);
}

.menu-link.active {
  background: rgba(0, 212, 255, 0.12);
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.2);
}

.menu-link.active::before {
  transform: scaleY(1);
}

/* Menu ikony */
.menu-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.menu-link:hover .menu-icon {
  transform: scale(1.1);
}

/* Podmenu */
.menu-item.has-submenu .menu-link::after {
  content: '▶';
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.menu-item.has-submenu:hover .menu-link::after {
  transform: translateY(-50%) rotate(90deg);
  color: var(--primary);
}

.submenu {
  margin-left: 2rem;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.submenu .menu-link {
  padding: 0.625rem 1rem;
  font-size: 0.9rem;
  background: transparent;
}

.submenu .menu-link::before {
  width: 2px;
}

/* Podmenu - struktura */
.nav-item.has-submenu {
  position: relative;
}

.nav-item.has-submenu::after {
  content: '▶';
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  z-index: 2;
}

.nav-item.has-submenu:hover::after {
  transform: translateY(-50%) rotate(90deg);
  color: var(--primary);
}

/* Submenu toggle */
.submenu-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

/* Podmenu kontejner */
.submenu {
  position: absolute;
  left: 100%;
  top: 0;
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid rgba(255, 167, 38, 0.2);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px) scale(0.95);
  transition: all 0.3s ease;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

/* Podmenu položky */
.submenu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border-radius: 8px;
  margin: 0.25rem;
}

}

/* Hlavní obsah */
.main-content {
  margin-left: 260px;
  min-height: calc(100vh - 80px);
  background: var(--surface);
}

.content-area {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Moderní karty */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--shadow);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow);
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Tlačítka */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px var(--glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--glow);
}

.btn-secondary {
  background: var(--surface-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  border-color: var(--border-light);
}

/* Statistiky */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.5rem 0;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Tabulky */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--surface-light);
  color: var(--text);
  font-weight: 600;
}

.table tr:hover {
  background: var(--surface-light);
}

/* Formuláře */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Floating action button */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px var(--glow);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px var(--glow);
}

/* Animace */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

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

.animate-fadeIn {
  animation: fadeIn 0.5s ease-out;
}

.animate-slideIn {
  animation: slideIn 0.3s ease-out;
}

/* Mobilní verze */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    left: -100%;
    z-index: 999;
    transition: left 0.3s ease;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-section {
    flex-wrap: wrap;
  }
  
  .content-area {
    padding: 1rem;
  }
}
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav-item {
  animation: slideIn 0.3s ease forwards;
}

.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.2s; }
.nav-item:nth-child(3) { animation-delay: 0.3s; }
.nav-item:nth-child(4) { animation-delay: 0.4s; }

/* Hlavní obsah */
.main-content {
  display: flex;
  min-height: calc(100vh - 64px);
}

.content-area {
  flex: 1;
  padding: 1.5rem;
}

/* Dashboard grid — Masonry (desktop) */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: 0.5rem;
}

/* Karta zařízení */
.device-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}

.device-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  background-color: var(--card-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background-color: rgba(30, 30, 30, 0.7);
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

.value {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.value.big {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.5rem 0;
}

.sensors {
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 0.5rem;
}

/* Graf placeholder */
.chart-placeholder {
  height: 60px;
  background: linear-gradient(90deg, transparent 50%, rgba(229, 164, 0, 0.1) 50%);
  background-size: 20px 20px;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-top: 1rem;
}

@keyframes shimmer {
  0% { background-position: -20px 0; }
  100% { background-position: 20px 0; }
}

/* Loading karty */
.device-card.loading {
  opacity: 0.7;
}

.device-card.loading .value,
.device-card.loading h3,
.device-card.loading .sensors {
  background: linear-gradient(90deg, #333, #444, #333);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Tlačítka */
.btn {
  background-color: var(--primary);
  color: #000;
  border: none;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: var(--primary-dark);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Modální okna */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--card-bg);
  width: 90%;
  max-width: 500px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1001;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--text);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group button {
  width: 100%;
  padding: 0.6rem;
  background-color: #2d2d2d;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 1rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

code {
  background-color: #2d2d2d;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
}

/* Floating hlasové tlačítko (mobil) */
.voice-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #000;
  font-size: 1.8rem;
  border: none;
  box-shadow: 0 6px 16px rgba(229, 164, 0, 0.4);
  cursor: pointer;
  z-index: 999;
  display: none; /* defaultně skryto — zobrazí se jen na mobilu */
}

/* Hlasový log */
.voice-log {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 320px;
  max-height: 400px;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 998;
  display: none;
  flex-direction: column;
}

.log-header {
  padding: 0.75rem 1rem;
  background-color: rgba(30, 30, 30, 0.8);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.log-content {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.log-content div {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background-color: #252525;
  border-radius: 6px;
}

.log-content .user {
  color: var(--primary);
}

.log-content .ai {
  color: #4fc3f7;
}

/* Mobilní optimalizace */
@media (max-width: 768px) {
  .app-header {
    padding: 0.75rem 1rem;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    flex-direction: column;
    height: auto;
  }

  .content-area {
    padding: 1rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .voice-fab {
    display: block;
  }

  .header-right {
    gap: 0.5rem;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
}

/* Animace pro PWA instalaci */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 164, 0, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(229, 164, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 164, 0, 0); }
}

.install-prompt {
  animation: pulse 2s infinite;
}
/* Karta pro přidání zařízení */
.add-card {
  background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
  border: 2px dashed var(--primary);
  grid-column: span 2;
}

.add-card .center {
  text-align: center;
}

.add-card .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.device-selector {
  width: 100%;
  padding: 0.6rem;
  background-color: #2d2d2d;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  margin-top: 1rem;
}
