:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #e11d48;
  --dark-bg: #0f1117;
  --menu-bg: #1a1d28;
  --surface: #252837;
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --border-color: rgba(255, 255, 255, 0.08);
}

/* Variabile pentru modul deschis (light) */
.light-theme {
  --dark-bg: #f8fafc;
  --menu-bg: #ffffff;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: rgba(0, 0, 0, 0.08);
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #e11d48;
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--dark-bg);
  color: var(--text-primary);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  touch-action: pan-y;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container principal pentru mobil */
.app-container {
  min-height: 100vh;
  position: relative;
  transition: all 0.3s ease;
}

/* Header mobil */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(26, 29, 40, 0.95);
  backdrop-filter: blur(20px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.light-theme .mobile-header {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.logo-icon {
  font-size: 22px;
  color: var(--primary);
}

/* Logo image styling */
.logo-image {
  height: 150px;
  width: auto;
  object-fit: contain;
}

/* Butoane din header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buton tema (lună/soare) */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.light-theme .theme-toggle {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.theme-toggle:active {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(0.95);
}

.theme-toggle i {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.light-theme .theme-toggle i.fa-sun {
  color: #f59e0b;
}

.theme-toggle i.fa-moon {
  color: #94a3b8;
}

/* Buton hamburger pentru mobil */
.hamburger-mobile {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.light-theme .hamburger-mobile {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.hamburger-mobile:active {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(0.95);
}

.hamburger-line {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  margin: 3px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.hamburger-mobile.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-mobile.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-mobile.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Meniu mobil - optimizat pentru atingere */
.mobile-menu {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--menu-bg);
  z-index: 90;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.22, 0.68, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
}

.light-theme .mobile-menu {
  box-shadow: 5px 0 25px rgba(0, 0, 0, 0.05);
}

.mobile-menu.active {
  transform: translateX(0);
}

/* Container pentru scroll */
.menu-scroll-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px 90px;
  -webkit-overflow-scrolling: touch;
}

/* Categorii principale */
.main-category {
  display: flex;
  align-items: center;
  padding: 18px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.light-theme .main-category {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.main-category:active {
  background: rgba(59, 130, 246, 0.15);
  transform: translateX(4px);
}

.main-category.active {
  background: rgba(59, 130, 246, 0.15);
  border-left-color: var(--primary);
}

.category-icon {
  width: 44px;
  height: 44px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  font-size: 20px;
  color: var(--primary);
}

.light-theme .category-icon {
  background: rgba(59, 130, 246, 0.08);
}

.category-info {
  flex: 1;
}

.category-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.category-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.category-arrow {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Card special pentru Evenimente Live */
.live-card {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.15), rgba(244, 63, 94, 0.1));
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: 16px;
  padding: 18px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
}

.light-theme .live-card {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.1), rgba(244, 63, 94, 0.05));
  border: 1px solid rgba(225, 29, 72, 0.15);
}

.live-badge {
  background: var(--secondary);
  color: white;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.live-pulse {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  70% {
    opacity: 0.5;
    transform: scale(1.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

/* Bottom navigation pentru acces rapid */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(26, 29, 40, 0.98);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 80;
  padding-bottom: env(safe-area-inset-bottom, 0);
  transition: all 0.3s ease;
}

.light-theme .bottom-nav {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border-radius: 12px;
  min-width: 60px;
}

.nav-item:active {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* Indicator pentru meniul curent */
.nav-indicator {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}

.nav-item.active .nav-indicator {
  opacity: 1;
}

/* Conținut principal pentru demo */
.main-content {
  padding: 80px 16px 80px;
  max-width: 800px;
  margin: 0 auto;
  transition: all 0.3s ease;
}

.content-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.light-theme .content-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* Pentru iOS safe areas */
@supports (padding: max(0px)) {
  .mobile-header,
  .bottom-nav {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .bottom-nav {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* Efect de blur pentru fundal cand meniul este deschis */
.blur-background .main-content,
.blur-background .bottom-nav {
  filter: blur(5px);
  transition: filter 0.3s ease;
}

/* Animație pentru încărcare */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.3s ease forwards;
}

/* Pentru dispozitive foarte mici */
@media (max-height: 700px) {
  .main-category {
    padding: 14px 16px;
  }

  .category-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* Animație pentru butonul de schimbare temă */
@keyframes rotateSun {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(180deg);
  }
}

@keyframes rotateMoon {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-180deg);
  }
}

.theme-toggle.rotating i {
  animation-duration: 0.5s;
  animation-fill-mode: forwards;
}

.theme-toggle.rotating i.fa-sun {
  animation-name: rotateSun;
}

.theme-toggle.rotating i.fa-moon {
  animation-name: rotateMoon;
}

/* Fallback pentru logo dacă imaginea nu se încarcă */
.logo-fallback {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: none;
}

.logo.loading .logo-fallback {
  display: block;
}

.logo.loading .logo-image {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .logo-image {
    height: 120px;
  }

  .main-content {
    padding: 70px 12px 80px;
  }
}

@media (max-width: 480px) {
  .logo-image {
    height: 100px;
  }

  .header-actions {
    gap: 8px;
  }

  .main-content {
    padding: 70px 10px 80px;
  }
}

/* ============================================
   Stiluri PROFESIONALE pentru grila de canale TV
   ============================================ */

.channels-container {
  padding: 15px 0;
}

.category-section {
  margin-bottom: 35px;
  scroll-margin-top: 80px;
}

/* Header categoria redesigned cu gradient si icon mare */
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--surface), rgba(59, 130, 246, 0.08));
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.light-theme .category-header {
  background: linear-gradient(135deg, var(--surface), rgba(59, 130, 246, 0.05));
}

.category-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.category-title-box i {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.category-title-box h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.category-title-box.live-title {
  gap: 14px;
}

.category-title-box.live-title i {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
  animation: liveGlow 2s ease-in-out infinite;
}

@keyframes liveGlow {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
  }
  50% {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
  }
}

.live-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

/* Channel count badge stilizat */
.channel-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  padding: 8px 16px;
  border-radius: 25px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Grid responsiv imbunatatit */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 14px;
}

/* Card canal complet redesigned */
.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border-radius: 18px;
  padding: 18px 12px 14px;
  text-decoration: none;
  color: var(--text-primary);
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.light-theme .channel-card {
  box-shadow: 0 44px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
}

/* Gradient overlay pe hover */
.channel-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.channel-card:hover::before,
.channel-card:active::before {
  opacity: 1;
}

.channel-card:hover,
.channel-card:active {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.2);
}

/* Live card cu stil special */
.channel-card.live-channel {
  border: 2px solid rgba(239, 68, 68, 0.3);
  background: linear-gradient(180deg, var(--surface), rgba(239, 68, 68, 0.05));
}

.channel-card.live-channel::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
  opacity: 1;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.channel-card.live-channel:hover {
  border-color: #ef4444;
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.25);
}

/* Logo container cu fundal gradient */
.channel-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.light-theme .channel-logo {
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.channel-card:hover .channel-logo {
  transform: scale(1.08);
}

.channel-logo img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* Nume canal cu truncare si font modern */
.channel-name {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  /* Removed white-space: nowrap and text-overflow: ellipsis to show full channel names */
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* Badge pentru canale premium */
.channel-card.premium::after {
  content: "★";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border-radius: 50%;
}

/* ============================================
   Responsive pentru canale - PROFESIONAL
   ============================================ */

@media (min-width: 360px) {
  .channels-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

@media (min-width: 480px) {
  .channels-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }

  .channel-card {
    padding: 20px 14px 16px;
  }
}

@media (min-width: 640px) {
  .channels-grid {
    /* Reduced columns from 5 to 4 for wider cards */
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }

  .channel-logo {
    width: 80px;
    height: 80px;
  }

  .channel-name {
    font-size: 14px;
  }

  .category-title-box h2 {
    font-size: 22px;
  }
}

@media (min-width: 768px) {
  .channels-grid {
    /* Reduced columns from 6 to 5 for wider cards */
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
  }

  .channel-card {
    padding: 24px 18px 20px;
  }

  .channel-logo {
    width: 90px;
    height: 90px;
  }
}

@media (min-width: 1024px) {
  .channels-grid {
    /* Reduced columns from 7 to 6 for wider cards */
    grid-template-columns: repeat(6, 1fr);
    gap: 22px;
  }

  .channel-logo {
    width: 95px;
    height: 95px;
  }
}

@media (min-width: 1280px) {
  .channels-grid {
    /* Reduced columns from 8 to 7 for wider cards */
    grid-template-columns: repeat(7, 1fr);
    gap: 24px;
  }

  .channel-card {
    padding: 26px 20px 22px;
  }

  .channel-logo {
    width: 100px;
    height: 100px;
  }

  .channel-name {
    font-size: 15px;
  }
}

@media (max-width: 359px) {
  .channels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .channel-card {
    padding: 14px 10px 12px;
    border-radius: 14px;
  }

  .channel-logo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }

  .channel-name {
    font-size: 11px;
  }

  .category-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .category-title-box h2 {
    font-size: 16px;
  }

  .category-title-box i {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
}

/* Animatie fade-in pentru canale */
.channel-card {
  animation: channelFadeIn 0.4s ease forwards;
  opacity: 0;
}

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

.channels-grid .channel-card:nth-child(1) {
  animation-delay: 0.02s;
}
.channels-grid .channel-card:nth-child(2) {
  animation-delay: 0.04s;
}
.channels-grid .channel-card:nth-child(3) {
  animation-delay: 0.06s;
}
.channels-grid .channel-card:nth-child(4) {
  animation-delay: 0.08s;
}
.channels-grid .channel-card:nth-child(5) {
  animation-delay: 0.10s;
}
.channels-grid .channel-card:nth-child(6) {
  animation-delay: 0.12s;
}
.channels-grid .channel-card:nth-child(7) {
  animation-delay: 0.14s;
}
.channels-grid .channel-card:nth-child(8) {
  animation-delay: 0.16s;
}
.channels-grid .channel-card:nth-child(9) {
  animation-delay: 0.18s;
}
.channels-grid .channel-card:nth-child(10) {
  animation-delay: 0.20s;
}
.channels-grid .channel-card:nth-child(11) {
  animation-delay: 0.22s;
}
.channels-grid .channel-card:nth-child(12) {
  animation-delay: 0.24s;
}

/* Skeleton loading pentru imagini */
.channel-logo.loading {
  background: linear-gradient(90deg, var(--surface) 0%, rgba(255, 255, 255, 0.05) 30%, var(--surface) 60%);
  background-size: 200% 100%; /* Fix: Completed background-size property */
  animation: shimmer 1.5s infinite; /* Fix: Added animation for shimmer effect */
}

/* Keyframes for shimmer animation */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
