/* style.css - TubZen Design System & Layout */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #0d0f12 0%, #151922 100%);
  --glass-bg: rgba(20, 24, 33, 0.55);
  --glass-bg-hover: rgba(30, 37, 50, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(255, 255, 255, 0.2);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --spotify-green: #1db954;
  --accent-color: #8b5cf6; /* Spa/relaxing violet */
  --font-family: 'Outfit', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  width: 100vw;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  background: #000;
  color: var(--text-primary);
  position: relative;
}

/* 9:16 Viewport Wrapper */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* Fullscreen Ambient Video */
.video-background-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  background: var(--bg-gradient);
}

.ambient-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.ambient-video.visible {
  opacity: 0.65; /* Dark overlay achieved via backing black color and opacity */
}

/* Subtle Dark Gradient Overlay for Text Readability */
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: linear-gradient(to bottom, 
    rgba(0, 0, 0, 0.4) 0%, 
    rgba(0, 0, 0, 0.1) 40%, 
    rgba(0, 0, 0, 0.6) 80%, 
    rgba(0, 0, 0, 0.85) 100%
  );
  pointer-events: none;
}

/* UI Content Layer */
.ui-layer {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

/* TOP SCENE TOGGLES */
.scene-toggles {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.scene-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 30px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scene-btn:hover, .scene-btn.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
}

/* WET-FINGER GLASSMORPHIC CONSOLE (BOTTOM) */
.control-console {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 24px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition-smooth);
}

/* Vibe Presets */
.vibe-presets {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.vibe-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  padding: 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.vibe-btn:active {
  transform: scale(0.96);
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-color);
  color: var(--text-primary);
}

/* Now Playing Information */
.now-playing {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 4px 0;
}

.album-art-container {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
}

.album-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.track-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0; /* Enables text truncation */
  flex-grow: 1;
}

.track-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.track-artist {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Playback Control Panel */
.playback-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Touch targets optimized for wet-finger use (large padding, small icons) */
.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition-smooth);
  
  /* Extended hit-box: padding is large but icon matches styling design */
  padding: 24px;
}

.ctrl-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: var(--transition-smooth);
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ctrl-btn:active {
  transform: scale(0.88);
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-color);
}

.ctrl-btn.play-pause {
  background: var(--text-primary);
  color: #000;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
}

.ctrl-btn.play-pause:hover {
  background: #ffffff;
}

.ctrl-btn.play-pause:active {
  transform: scale(0.9);
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

/* Volume Slider styling */
.volume-control {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 4px;
}

.vol-icon {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.vol-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.volume-slider-container {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: center;
  height: 32px; /* Fat hit-box for slider */
  cursor: pointer;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
  background: var(--accent-color);
}

/* Progress Track Bar */
.progress-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: var(--accent-color);
  width: 0%;
  transition: width 0.5s linear;
}

/* SYSTEM STATUS/SETTINGS BUTTON */
.utility-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--spotify-green);
  box-shadow: 0 0 8px var(--spotify-green);
}

.gear-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 8px;
  transition: var(--transition-smooth);
}

.gear-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.gear-btn:active {
  color: var(--text-primary);
  transform: rotate(45deg);
}

.top-action-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding-top: 16px;
}

.bell-btn-large {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 24px;
  flex: 1;
  max-width: 180px;
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: var(--transition-smooth);
}

.bell-btn-large i {
  font-size: 28px;
  color: currentColor;
}

.bell-btn-large:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.bell-btn-large:active {
  background: rgba(251, 191, 36, 0.15);
  border-color: #fbbf24;
  color: #fbbf24;
  transform: scale(0.94);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.35);
}

.spa-btn-large {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 24px;
  flex: 1;
  max-width: 180px;
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: var(--transition-smooth);
}

.spa-btn-large i {
  font-size: 28px;
  color: currentColor;
}

.spa-btn-large:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.spa-btn-large:active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: scale(0.94);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.35);
}

.btn-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: center;
  line-height: 1.2;
}

.spa-option-item {
  transition: var(--transition-smooth);
}

.spa-option-item:active {
  transform: scale(0.98);
}

.spa-option-item:has(.spa-checkbox:checked) {
  background: rgba(139, 92, 246, 0.12) !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.1);
}

.submit-spa-btn {
  margin-top: 10px;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  padding: 16px;
  border-radius: 16px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-spa-btn:active {
  background: rgba(139, 92, 246, 0.35);
  transform: scale(0.98);
}


/* DEVICE SELECTION DRAWER */
.drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

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

.device-drawer {
  position: absolute;
  bottom: -100%;
  left: 0;
  width: 100%;
  max-height: 80%;
  background: rgba(18, 22, 30, 0.95);
  border-top: 1px solid var(--glass-border);
  border-radius: 32px 32px 0 0;
  padding: 32px 24px;
  z-index: 11;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-backdrop.active .device-drawer {
  bottom: 0;
}

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

.drawer-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition-smooth);
}

.close-btn:active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 300px;
  padding-bottom: 20px;
}

.device-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 16px 20px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.device-item:active {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent-color);
}

.device-item.active {
  background: rgba(29, 185, 84, 0.1);
  border-color: var(--spotify-green);
}

.device-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

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

.device-item.active .device-name {
  color: var(--spotify-green);
}

.logout-btn {
  margin-top: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 14px;
  border-radius: 16px;
  font-family: var(--font-family);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.logout-btn:active {
  background: rgba(239, 68, 68, 0.25);
}

/* GATEWAY/AUTH SCREEN */
.gateway-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px;
  text-align: center;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.gateway-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.gateway-icon {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--accent-color) 0%, #4c1d95 100%);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 12px 36px rgba(139, 92, 246, 0.4);
  margin-bottom: 24px;
}

.gateway-icon svg {
  width: 48px;
  height: 48px;
  fill: currentColor;
}

.gateway-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.gateway-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 280px;
  line-height: 1.5;
}

.connect-spotify-btn {
  background: var(--spotify-green);
  color: #000;
  border: none;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 700;
  padding: 16px 32px;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(29, 185, 84, 0.3);
  transition: var(--transition-smooth);
}

.connect-spotify-btn:active {
  transform: scale(0.96);
  box-shadow: 0 4px 12px rgba(29, 185, 84, 0.15);
}

.connect-spotify-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ERROR/CYNICAL NOTIFICATIONS overlay */
.error-overlay {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  background: rgba(239, 68, 68, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  padding: 16px;
  z-index: 50;
  display: flex;
  gap: 12px;
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.error-overlay.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.error-icon {
  width: 24px;
  height: 24px;
  color: #fff;
  flex-shrink: 0;
}

.error-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.error-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
}

/* Center Logo Layout & Float Keyframes */
.logo-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  pointer-events: none;
}

.center-logo {
  width: 100%;
  max-width: 100%;
  max-height: 40dvh;
  object-fit: contain;
  opacity: 0.55;
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.5));
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Success Notification Banner */
.success-overlay {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  background: rgba(139, 92, 246, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 16px 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  transition: var(--transition-smooth);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.15);
}

.success-overlay.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.success-icon {
  font-size: 24px;
}

.success-text {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  white-space: pre-line;
}

.notification-countdown {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
