/* ==========================================================================
   Stealth Cinema Player - Master Styling (Vanilla CSS)
   Aesthetics: Deep Dark Mode, Glassmorphism, Cinematic Backlight Glow
   ========================================================================== */

:root {
  --bg-primary: #050d12;
  --bg-card: rgba(9, 36, 45, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(80, 180, 152, 0.2);
  --accent-primary: #50b498;
  --accent-secondary: #093845;
  --accent-glow: rgba(80, 180, 152, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger-color: #ef4444;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 8px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Protection */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background & Grid Effect */
.ambient-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  height: 80vh;
  background: radial-gradient(circle at center, rgba(80, 180, 152, 0.2), rgba(9, 56, 69, 0.2), transparent 70%);
  filter: blur(80px);
  z-index: -2;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.ambient-glow.disabled {
  opacity: 0;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(80, 180, 152, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  z-index: -1;
  pointer-events: none;
}

/* App Container Layout */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(80, 180, 152, 0.35));
}

.brand-text h1 {
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-text h1 span {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(80, 180, 152, 0.15);
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid rgba(80, 180, 152, 0.35);
}

.brand-text p {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* Buttons */
.btn {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Main Player Card Container */
.player-wrapper {
  width: 100%;
  position: relative;
}

.video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-glass);
  transition: all var(--transition-normal);
}

/* Theater Mode Styles */
.video-container.theater-mode {
  border-radius: 0;
  max-width: 100vw;
}

/* Dynamic Video Ambient Backlight Sync */
.video-backlight {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.2), transparent 70%);
  filter: blur(40px);
  z-index: 1;
  pointer-events: none;
  opacity: 0.6;
}

/* Iframe Holder & Disable YouTube Direct Pointer Events */
.iframe-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  overflow: hidden;
}

.iframe-box iframe,
.iframe-box #yt-player {
  width: 135% !important;
  height: 135% !important;
  position: absolute;
  top: -17.5%;
  left: -17.5%;
  border: 0;
  pointer-events: none !important; /* CRITICAL: Prevents clicking inside YouTube iframe */
}

/* Transparent Protection Shield Layer */
.click-shield {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: pointer;
  background: transparent;
}

/* Loader Overlay */
.loader-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(7, 9, 14, 0.92);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: opacity var(--transition-normal);
}

.loader-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loader-text {
  font-size: 15px;
  color: var(--text-muted);
}

/* Poster Overlay Cover (Hides Red YouTube Play Button) */
.poster-overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  background: radial-gradient(circle at center, rgba(9, 56, 69, 0.95) 0%, rgba(5, 13, 18, 0.98) 100%);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--transition-normal);
}

.poster-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.poster-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.poster-play-btn {
  width: 86px;
  height: 86px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  box-shadow: 0 10px 30px var(--accent-glow);
  padding-left: 4px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.poster-overlay:hover .poster-play-btn {
  transform: scale(1.1);
  box-shadow: 0 14px 40px var(--accent-glow);
}

.poster-content p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

/* Center Play Trigger Button Animation */
.center-play-trigger {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
}

.center-play-trigger.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.big-play-icon {
  width: 80px;
  height: 80px;
  background: rgba(18, 22, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding-left: 4px;
}

/* Controls Overlay System */
.controls-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(
    to bottom,
    rgba(7, 9, 14, 0.7) 0%,
    transparent 30%,
    transparent 65%,
    rgba(7, 9, 14, 0.9) 100%
  );
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

/* Interactive elements inside overlay */
.controls-overlay * {
  pointer-events: auto;
}

.video-container.user-idle .controls-overlay {
  opacity: 0;
  pointer-events: none;
}

.video-container.user-idle {
  cursor: none;
}

/* Controls Top Section */
.controls-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.video-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 22, 34, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 10px #22c55e;
}

.protection-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
}

.protection-tag i {
  color: var(--accent-primary);
}

/* Controls Bottom Section & Timeline */
.controls-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Progress Container / Scrubber */
.progress-container {
  width: 100%;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.progress-hover-time {
  position: absolute;
  top: -30px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(18, 22, 34, 0.9);
  border: 1px solid var(--border-glass);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Outfit', sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.progress-container:hover .progress-hover-time {
  opacity: 1;
}

.progress-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  position: relative;
  overflow: visible;
  transition: height var(--transition-fast);
}

.progress-container:hover .progress-bar-track {
  height: 8px;
}

.progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  width: 0%;
}

.progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
  border-radius: 4px;
  width: 0%;
}

.progress-scrubber {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%) scale(0);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-primary);
  transition: transform var(--transition-fast);
}

.progress-container:hover .progress-scrubber {
  transform: translate(-50%, -50%) scale(1);
}

/* Toolbar Controls */
.controls-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-controls, .right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--accent-primary);
  transform: scale(1.08);
}

/* Volume Slider Group */
.volume-group {
  display: flex;
  align-items: center;
  position: relative;
}

.volume-slider-box {
  width: 0;
  overflow: hidden;
  transition: width var(--transition-normal);
  display: flex;
  align-items: center;
}

.volume-group:hover .volume-slider-box {
  width: 80px;
  margin-left: 6px;
}

.volume-range {
  -webkit-appearance: none;
  width: 70px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px var(--accent-primary);
}

/* Time Display */
.time-display {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 8px;
}

/* Speed Dropdown Menu */
.speed-menu-wrapper {
  position: relative;
}

.speed-dropdown {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(18, 22, 34, 0.95);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 120px;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.speed-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.speed-option {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition-fast);
}

.speed-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-primary);
}

.speed-option.active {
  background: var(--accent-primary);
  color: #fff;
  font-weight: 700;
}

/* Features Section */
.features-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition-fast);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
}

.card-icon {
  width: 44px;
  height: 44px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent-primary);
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Modal Selector Backdrop & Card */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #121622;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.modal-header h3 i {
  color: var(--accent-primary);
}

.close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.preset-videos {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-label {
  font-size: 12px;
  color: var(--text-muted);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Toast Security Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px;
  }
  .controls-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-text p {
    display: none;
  }
  .feature-card {
    padding: 16px;
  }
}
