/* ===== AURA IPTV - Animated Backgrounds ===== */

/* Effect 1: Floating Gradient Orbs */
@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(100px, -50px) scale(1.1); }
  50% { transform: translate(-50px, 100px) scale(0.9); }
  75% { transform: translate(-100px, -30px) scale(1.05); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-80px, 60px) scale(1.15); }
  66% { transform: translate(60px, -80px) scale(0.85); }
}

@keyframes floatOrb3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(120px, 120px) scale(1.2); }
}

.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

.bg-none {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: var(--bg);
}

.bg-orbs::before,
.bg-orbs::after,
.bg-orbs .orb {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation-duration: 20s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.bg-orbs::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #667eea, transparent);
  top: 10%;
  left: 10%;
  animation-name: floatOrb1;
}

.bg-orbs::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #764ba2, transparent);
  bottom: 10%;
  right: 10%;
  animation-name: floatOrb2;
}

.bg-orbs .orb {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #f093fb, transparent);
  top: 50%;
  left: 50%;
  animation-name: floatOrb3;
}

/* Effect 2: Particle Field */
@keyframes particleFloat {
  0% { transform: translateY(100vh) translateX(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100vh) translateX(100px); opacity: 0; }
}

.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(to bottom, #0a0a0a, #1a1a2e);
  overflow: hidden;
}

.bg-particles .particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}

/* Effect 3: Geometric Waves */
@keyframes waveMove {
  0% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(-50px) translateY(20px); }
  100% { transform: translateX(0) translateY(0); }
}

@keyframes rotateShape {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.bg-geometric {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(45deg, #1e3c72, #2a5298);
  overflow: hidden;
}

.bg-geometric .shape {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.1);
  animation: waveMove 15s ease-in-out infinite;
}

.bg-geometric .shape:nth-child(1) {
  width: 200px;
  height: 200px;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  top: 20%;
  left: 20%;
  animation-duration: 18s;
}

.bg-geometric .shape:nth-child(2) {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  top: 60%;
  right: 20%;
  animation-duration: 22s;
  animation-delay: -5s;
}

.bg-geometric .shape:nth-child(3) {
  width: 300px;
  height: 300px;
  border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
  bottom: 20%;
  left: 50%;
  animation-duration: 25s;
  animation-delay: -10s;
}

/* ===== UI Improvements ===== */

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0a0a0a;
  color: #ffffff;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
}

.glass-dark {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

/* Smooth transitions */
* {
  transition: all 0.3s ease;
}

/* Button improvements */
button {
  cursor: pointer;
  border: none;
  outline: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

button:active {
  transform: translateY(0);
}

/* Card hover effects */
.channel-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Smooth page transitions */
.page {
  display: none;
  animation: fadeIn 0.4s ease;
}

.page.active {
  display: block;
}

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

/* ===== Status Indicators ===== */
.channel-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.country-flag-mini {
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.status-online {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.status-offline {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.status-checking {
  background: #eab308;
  box-shadow: 0 0 6px #eab308;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Favorite button active state */
.control-btn.active {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: #fbbf24;
}

/* ===== Country Grid ===== */
#countriesList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
}

.country-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.country-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-color: var(--accent);
}

.country-card:active {
  transform: scale(0.98);
}

.country-flag {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  display: flex;
  align-items: center;
  justify-content: center;
}

.country-count {
  font-size: 12px;
  color: var(--text2);
  opacity: 0.9;
  font-weight: 500;
  text-align: center;
}

.country-name {
  font-size: 11px;
  color: var(--text);
  opacity: 0.85;
  font-weight: 600;
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 600px) {
  #countriesList {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .country-card {
    padding: 12px;
    border-radius: 12px;
  }

  .country-flag {
    font-size: 36px;
  }

  .country-name {
    font-size: 12px;
  }

  .country-count {
    font-size: 11px;
  }
}

/* ===== Category Grid ===== */
#categoriesList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px;
}

.category-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-color: var(--accent2);
}

.category-card:active {
  transform: scale(0.98);
}

.category-icon {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.category-count {
  font-size: 12px;
  color: var(--text2);
  opacity: 0.9;
  font-weight: 500;
}

@media (max-width: 600px) {
  #categoriesList {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 10px;
  }

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

  .category-icon {
    font-size: 36px;
  }

  .category-name {
    font-size: 12px;
  }

  .category-count {
    font-size: 11px;
  }
}

/* ===== Channel Selector ===== */
.channel-selector {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  z-index: 2000;
  display: none;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

.channel-selector.active {
  display: flex;
}

.channel-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.channel-selector-header h3 {
  margin: 0;
  font-size: 18px;
}

.channel-selector-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

.channel-selector-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.channel-selector-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.channel-selector-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.channel-selector-item.active {
  background: rgba(102, 126, 234, 0.2);
  border: 1px solid var(--accent);
}

.channel-selector-item .selector-flag {
  font-size: 24px;
}

.channel-selector-item .selector-info {
  flex: 1;
}

.channel-selector-item .selector-name {
  font-weight: 600;
  font-size: 14px;
}

.channel-selector-item .selector-meta {
  font-size: 12px;
  color: var(--text2);
}

/* Loading indicator */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

