:root {
  --primary: hsl(230, 100%, 67%);
  --primary-glow: hsla(230, 100%, 67%, 0.4);
  --secondary: hsl(260, 100%, 67%);
  --bg-dark: #0f172a;
  /* Deeper SaaS blue-black */
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --radius-lg: 24px;
  /* More rounded premium feel */
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

.dashboard {
  display: grid;
  grid-template-columns: 350px 1fr;
  height: 100vh;
  gap: 0;
}

/* Sidebar / Config Panel */
.sidebar {
  background: #0f172a;
  border-right: 1px solid var(--glass-border);
  padding: 2.5rem 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: 'Outfit';
  color: white;
  box-shadow: 0 8px 16px var(--primary-glow);
  font-size: 1.25rem;
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: 'Outfit';
  letter-spacing: -1px;
  background: linear-gradient(to bottom, #fff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-container label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modern-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: white;
  font-size: 0.9rem;
  transition: var(--transition);
}

.modern-input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1rem;
}

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

.sample-links {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sample-link {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
  border: 1px solid transparent;
}

.sample-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border-color: var(--glass-border);
}

.sample-link.active {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: white;
}

/* Main Content area */
.main-content {
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
}

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

.status-pills {
  display: flex;
  gap: 1rem;
}

.status-pill {
  padding: 0.4rem 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

/* Player Container */
.player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--glass-border);
  max-height: 80vh;
}

.player-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #000;
}

/* Fix Subtitle Overlap with Controls */
.custom-subtitle-window {
  bottom: 40px !important;
  transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.player-wrapper.user-active .custom-subtitle-window {
  bottom: 110px !important;
}

/* Custom UI Layers */
.luminous-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
  pointer-events: none;
}

.luminous-ui>* {
  pointer-events: auto;
}

.player-wrapper:hover .luminous-ui,
.player-wrapper.user-active .luminous-ui {
  opacity: 1;
  visibility: visible;
}

.player-wrapper:fullscreen .luminous-ui,
.player-wrapper:-webkit-full-screen .luminous-ui {
  z-index: 2147483647;
}

/* Hide native controls in fullscreen */
.player-wrapper video::-webkit-media-controls {
  display: none !important;
}

.player-wrapper video::-webkit-media-controls-enclosure {
  display: none !important;
}

.luminous-ui {
  transition: opacity 0.4s ease;
}

.player-wrapper:hover .luminous-ui,
.player-wrapper.user-active .luminous-ui {
  opacity: 1;
}

.ui-top {
  padding: 1.5rem 2rem;

  pointer-events: auto;
}

.ui-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.big-play-btn {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

.big-play-btn svg {
  width: 36px;
  height: 36px;
  fill: white;
  margin-left: 6px;
}

.big-play-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 30px var(--primary-glow);
}

.ui-bottom {
  padding: 2rem;

  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.progress-area {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  transition: height 0.2s ease;
  --thumb-scale: 1;
}

@media (max-width: 1024px) {
  .progress-area {
    --thumb-scale: 0.85;
  }
}

@media (max-width: 768px) {
  .progress-area {
    --thumb-scale: 0.75;
  }
}

@media (max-width: 480px) {
  .progress-area {
    --thumb-scale: 0.6;
  }
}

.thumbnail-preview {
  position: absolute;
  bottom: 25px;
  left: 0;
  transform: translateX(-50%) scale(var(--thumb-scale));
  transform-origin: bottom;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.thumbnail-img-container {
  width: 140px;
  aspect-ratio: 16/9;
  height: auto;
  overflow: hidden;
  position: relative;
  background: #000;
  border-radius: var(--radius-sm);
}

.thumbnail-img {
  position: absolute;
  top: 0;
  left: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.thumbnail-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.progress-area:hover {
  height: 10px;
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border-radius: 3px;
  box-shadow: 0 0 15px var(--primary-glow);
  width: 0%;
}

.buffer-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  width: 0%;
}

.progress-handle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translate(50%, -50%) scale(0);
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
}

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

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.control-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0.8;
}

.control-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  color: var(--primary);
}

.time-display {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  min-width: 100px;
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 140px;
}

.volume-slider-container {
  flex: 1;
  height: 24px;
  /* Increased hit area */
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.volume-slider-container::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.volume-level {
  position: absolute;
  top: 10px;
  /* Center it (24px total / 2 - 2px half-height) */
  left: 0;
  height: 4px;
  background: white;
  border-radius: 2px;
  width: 100%;
  pointer-events: none;
}

/* Feature Cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 1rem;
}

.feature-card {
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

.feature-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.feature-icon {
  width: 40px;
  height: 40px;
  background: var(--glass);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.feature-card h3 {
  font-size: 1.1rem;
  margin: 0;
}

.feature-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Settings Menu */
.settings-menu {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 280px;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-popup.show {
  display: flex !important;
}

.menu-header {
  padding: 1rem;
  font-weight: 700;
  font-family: 'Outfit';
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-list {
  max-height: 300px;
  overflow-y: auto;
}

.menu-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.menu-item:hover {
  background: var(--glass);
  color: var(--primary);
}

.menu-item.active {
  color: var(--primary);
  font-weight: 600;
}

.menu-item.active::after {
  content: '✓';
  font-size: 0.8rem;
}

.submenu-arrow::after {
  content: '→';
  font-size: 0.8rem;
  opacity: 0.5;
}

/* Locked State */
.locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: auto;
}

.lock-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  color: white;
  text-align: center;
}

.lock-indicator p {
  font-family: 'Outfit';
  font-size: 1.25rem;
  font-weight: 600;
}

.btn-unlock {
  background: white;
  color: black;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.btn-unlock:hover {
  transform: scale(1.05);
}

.player-wrapper.is-locked .luminous-ui {
  pointer-events: none;
  opacity: 0 !important;
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }

  .ui-bottom {
    padding: 1rem;
  }

  .volume-group {
    display: none;
    /* Hide volume slider on mobile */
  }

  .controls-right .control-btn:not(#quality-btn):not(#lock-btn) {
    display: none;
    /* Simplify controls on mobile */
  }

  .big-play-btn {
    width: 60px;
    height: 60px;
  }

  .settings-menu {
    width: 90%;
    right: 5%;
    bottom: 70px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .player-wrapper {
    height: 100vh;
    border-radius: 0;
  }

  .main-content {
    padding: 0;
  }

  .page-header,
  .feature-grid {
    display: none;
  }
}