/* ==========================================================================
   Sinhala Dubbed Cartoons & Movies - Main CSS & Design Tokens
   සිංහල කාටූන් සහ සිනමා මූලික මෝස්තර පද්ධතිය
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+Sinhala:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #080b12;
  --bg-secondary: #0f1422;
  --bg-card: rgba(18, 25, 43, 0.75);
  --bg-card-hover: rgba(28, 38, 64, 0.9);
  --bg-glass: rgba(15, 20, 34, 0.85);
  --bg-glass-card: rgba(255, 255, 255, 0.04);

  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.4);
  --accent-red: #ef4444;
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-gold: #fbbf24;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(245, 158, 11, 0.3);
  --border-glass: rgba(255, 255, 255, 0.12);

  /* Typography */
  --font-sinhala: 'Noto Sans Sinhala', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Noto Sans Sinhala', sans-serif;
  --font-body: 'Inter', 'Noto Sans Sinhala', sans-serif;

  /* Shadows & Glows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
  --shadow-gold: 0 0 25px rgba(245, 158, 11, 0.35);
  --shadow-cyan: 0 0 25px rgba(6, 182, 212, 0.35);

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

/* Custom Modern Scrollbars */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 6px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* Typography styles */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  max-width: 100%;
  display: block;
  object-fit: cover;
}

/* Container */
.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-family: var(--font-sinhala);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.68rem 1.35rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-smooth);
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b0f19;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  font-weight: 700;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

.btn-glass {
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
}

.btn-glass:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-2px);
}

.btn-telegram {
  background: linear-gradient(135deg, #229ED9 0%, #0088cc 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(34, 158, 217, 0.35);
}

.btn-telegram:hover {
  background: #2cb5f6;
  transform: translateY(-2px);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 1.25rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}

.btn-like {
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.35);
  gap: 0.4rem;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-like:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(244, 63, 94, 0.6);
  transform: translateY(-2px);
}

.btn-like.liked {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.35), rgba(251, 113, 133, 0.25));
  border-color: #f43f5e;
  color: #fda4af;
  box-shadow: 0 4px 18px rgba(244, 63, 94, 0.3);
}

@keyframes likePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25) rotate(-8deg); }
  70%  { transform: scale(0.95) rotate(4deg); }
  100% { transform: scale(1); }
}

.btn-like.like-pop {
  animation: likePop 0.4s ease forwards;
}

.btn-lg {
  padding: 0.85rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 4px;
}

/* Badges & Tags */
.badge-featured {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
}

.badge-channel {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
}

.badge-audio {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
}

/* Form inputs */
.form-group {
  margin-bottom: 1.1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 20, 34, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sinhala);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
  background: rgba(18, 25, 43, 0.95);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

/* Content Request Guidelines & Validation Styles */
.request-guidelines-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(30, 58, 138, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  margin-bottom: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #bfdbfe;
  backdrop-filter: blur(8px);
}

.request-guidelines-banner .guide-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.request-guidelines-banner .guide-text strong {
  color: #93c5fd;
}

.request-error-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.48);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.15rem;
  color: #fca5a5;
  font-size: 0.86rem;
  line-height: 1.4;
  backdrop-filter: blur(10px);
  animation: alertSlideIn 0.25s ease-out;
}

.request-error-alert .error-alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.request-error-alert .error-alert-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.2rem;
}

.request-error-alert .error-alert-msg {
  margin: 0;
  color: #fecaca;
  font-size: 0.84rem;
}

@keyframes alertSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.form-group input.field-invalid,
.form-group textarea.field-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45) !important;
  background: rgba(45, 15, 20, 0.85) !important;
  animation: inputShake 0.4s ease-in-out;
}

/* Toast Notification Styles */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-glass);
  border-left: 4px solid var(--accent-gold);
  color: var(--text-primary);
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  animation: slideInRight 0.35s ease forwards;
  max-width: 420px;
  font-size: 0.92rem;
}

.toast-success {
  border-left-color: var(--accent-emerald);
}

.toast-error {
  border-left-color: var(--accent-red);
}

.toast-message.fade-out {
  animation: fadeOutRight 0.4s ease forwards;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(50px); }
}

/* Download Progress Toast in bottom right */
.download-progress-toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-lg);
  width: 340px;
  font-size: 0.88rem;
  animation: slideInRight 0.35s ease forwards;
}

.download-progress-toast.fade-out {
  animation: fadeOutRight 0.4s ease forwards;
}

.dl-toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.dl-toast-percent {
  color: var(--accent-gold);
  font-weight: 700;
}

.dl-toast-bar {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.dl-toast-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

.dl-toast-footer {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Hide native browser video download button */
video::-internal-media-controls-download-button,
video::-webkit-media-controls-download-button {
  display: none !important;
}
video::-webkit-media-controls-enclosure {
  overflow: hidden;
}

/* Shield to cover and disable external pop-out icon in embedded iframes */
.iframe-shield {
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 56px;
  background: #000;
  z-index: 10;
  cursor: default;
  pointer-events: auto;
}

.player-wrap.has-error,
.player-wrap:has(.mp-player-error-overlay),
.mp-player-wrap.has-error,
.mp-player-wrap:has(.mp-player-error-overlay) {
  min-height: 290px;
}

/* In-player Error Recovery Overlay */
.mp-player-error-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 0.75rem;
  text-align: center;
  z-index: 25;
  color: #fff;
  animation: fadeIn 0.25s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mp-err-icon {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
  line-height: 1;
}
.mp-err-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.25rem;
  line-height: 1.35;
  max-width: 440px;
}
.mp-err-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  max-width: 440px;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}
.mp-err-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  max-width: 360px;
}
.btn-mp-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.95rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-mp-switch:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.btn-mp-ext {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.95rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn-mp-ext:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

@media (max-width: 640px) {
  .player-wrap.has-error,
  .player-wrap:has(.mp-player-error-overlay),
  .mp-player-wrap.has-error,
  .mp-player-wrap:has(.mp-player-error-overlay) {
    min-height: 285px;
  }
  .mp-player-error-overlay {
    padding: 0.65rem 0.5rem;
  }
  .mp-err-icon {
    font-size: 1.4rem;
    margin-bottom: 0.18rem;
  }
  .mp-err-title {
    font-size: 0.86rem;
    line-height: 1.3;
    margin-bottom: 0.18rem;
  }
  .mp-err-desc {
    font-size: 0.72rem;
    line-height: 1.3;
    margin-bottom: 0.55rem;
  }
  .mp-err-actions {
    gap: 0.35rem;
    max-width: 320px;
  }
  .btn-mp-switch,
  .btn-mp-ext {
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 6px;
  }
}
