/* 
   Style Sheet for Daily Audio Briefing
   Modern Dark Mode with Glassmorphism & Micro-animations
*/

:root {
  /* Fonts */
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette (HSL) */
  --color-primary: 252, 82%, 67%;    /* Vibrant indigo/violet */
  --color-primary-rgb: 147, 112, 219;
  --color-secondary: 184, 96%, 54%;  /* Bright cyan/neon blue */
  --color-danger: 350, 80%, 55%;     /* Crimson red */
  
  --bg-main: 224, 32%, 8%;           /* Rich dark charcoal/space */
  --card-bg: 225, 25%, 12%;          /* Dark card base */
  
  --text-primary: 0, 0%, 95%;        /* Clean white text */
  --text-muted: 220, 10%, 65%;       /* Soft gray/blue text */
  --border-light: 220, 20%, 20%;     /* Card thin borders */
  
  --glass-bg: rgba(13, 17, 28, 0.55);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-glow: rgba(147, 112, 219, 0.15);
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* Reset & Basics */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}

body {
  font-family: var(--font-family);
  background-color: hsl(var(--bg-main));
  color: hsl(var(--text-primary));
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Ambient glow orbs in the background */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.45;
  pointer-events: none;
}

.glow-orb-1 {
  width: 40vw;
  height: 40vw;
  top: -10vw;
  left: -10vw;
  background: radial-gradient(circle, hsl(var(--color-primary)) 0%, rgba(0,0,0,0) 70%);
}

.glow-orb-2 {
  width: 50vw;
  height: 50vw;
  bottom: -15vw;
  right: -10vw;
  background: radial-gradient(circle, hsl(var(--color-secondary)) 0%, rgba(0,0,0,0) 70%);
}

/* Utility Layouts */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--color-primary)) 0%, hsl(var(--color-primary-rgb) / 0.8) 100%);
  color: white;
  box-shadow: 0 4px 15px hsl(var(--color-primary) / 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px hsl(var(--color-primary) / 0.5);
  background: linear-gradient(135deg, hsl(var(--color-primary)) 0%, hsl(var(--color-primary)) 100%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: hsl(var(--text-primary));
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(240, 50, 75, 0.15);
  border: 1px solid rgba(240, 50, 75, 0.3);
  color: hsl(var(--color-danger));
}

.btn-danger:hover {
  background: hsl(var(--color-danger));
  color: white;
  box-shadow: 0 4px 15px hsl(var(--color-danger) / 0.3);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn.icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
}

.btn.rounded {
  border-radius: 50%;
}

.btn.plain {
  background: transparent;
  border-color: transparent;
}
.btn.plain:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Forms */
.input-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--text-muted));
}

.input-group input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: white;
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.input-group input:focus {
  border-color: hsl(var(--color-primary));
  box-shadow: 0 0 0 3px hsl(var(--color-primary) / 0.15);
  background: rgba(0, 0, 0, 0.35);
}

/* 1. LOCK SCREEN CSS */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(6, 8, 14, 0.8);
  backdrop-filter: blur(16px);
  padding: 2rem;
}

.lock-card {
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  text-align: center;
}

.lock-header {
  margin-bottom: 2rem;
}

.lock-icon-container {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: hsl(var(--color-primary) / 0.15);
  border: 1px dashed hsl(var(--color-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 0 20px hsl(var(--color-primary) / 0.2);
}

.lock-icon {
  color: hsl(var(--color-primary));
  width: 28px;
  height: 28px;
}

.lock-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, white, hsl(var(--text-muted)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lock-header p {
  color: hsl(var(--text-muted));
  font-size: 0.9rem;
  line-height: 1.4;
}

.login-form button {
  width: 100%;
  justify-content: center;
  margin-top: 0.75rem;
}

.error-message {
  color: hsl(var(--color-danger));
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
  display: none;
}

/* 2. MAIN APPLICATION CONTAINER */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  gap: 1.5rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, hsl(var(--color-primary)) 0%, hsl(var(--color-secondary)) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px hsl(var(--color-primary) / 0.2);
}

.logo-icon {
  color: white;
  width: 20px;
  height: 20px;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
  margin-top: 0.1rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: #2ec4b6;
  box-shadow: 0 0 8px #2ec4b6;
}

.status-dot.loading {
  background-color: #ffb703;
  box-shadow: 0 0 8px #ffb703;
  animation: pulse 1.5s infinite;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Grid Layout */
.content-grid {
  display: grid;
  grid-template-columns: 340px 1fr 340px;
  gap: 1.5rem;
  flex: 1;
  min-height: 0; /* Important for scrollable items inside grid */
}

.column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Column Cards base */
.column .glass-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: hsl(var(--text-primary));
}

.badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  color: hsl(var(--text-muted));
}

/* A. PLAYER COLUMN DETAILS */
.player-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  flex: 1;
}

.visualizer-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  flex: 1;
  min-height: 140px;
  max-height: 220px;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1.5rem;
}

.visualizer-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

.music-note-icon {
  width: 36px;
  height: 36px;
  color: hsl(var(--color-primary) / 0.15);
  animation: float 4s ease-in-out infinite;
}

.waveforms {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 90%;
  height: 60px;
  justify-content: center;
}

.waveforms .bar {
  width: 5px;
  height: 8px;
  background: linear-gradient(to top, hsl(var(--color-primary)), hsl(var(--color-secondary)));
  border-radius: 3px;
  transition: height 0.1s ease;
}

/* Keyframes for playing visualizer */
.playing .waveforms .bar {
  animation: bounce 1s ease-in-out infinite alternate;
}

/* Generate different animations for staggered wave behavior */
.playing .waveforms .bar:nth-child(2) { animation-delay: 0.1s; animation-duration: 1.2s; }
.playing .waveforms .bar:nth-child(3) { animation-delay: 0.25s; animation-duration: 0.8s; }
.playing .waveforms .bar:nth-child(4) { animation-delay: 0.05s; animation-duration: 1.4s; }
.playing .waveforms .bar:nth-child(5) { animation-delay: 0.35s; animation-duration: 1.0s; }
.playing .waveforms .bar:nth-child(6) { animation-delay: 0.15s; animation-duration: 1.1s; }
.playing .waveforms .bar:nth-child(7) { animation-delay: 0.4s; animation-duration: 0.9s; }
.playing .waveforms .bar:nth-child(8) { animation-delay: 0.2s; animation-duration: 1.3s; }
.playing .waveforms .bar:nth-child(9) { animation-delay: 0.3s; animation-duration: 0.7s; }
.playing .waveforms .bar:nth-child(10) { animation-delay: 0.12s; animation-duration: 1.5s; }
.playing .waveforms .bar:nth-child(11) { animation-delay: 0.22s; animation-duration: 1.0s; }
.playing .waveforms .bar:nth-child(12) { animation-delay: 0.07s; animation-duration: 1.2s; }
.playing .waveforms .bar:nth-child(13) { animation-delay: 0.32s; animation-duration: 0.8s; }
.playing .waveforms .bar:nth-child(14) { animation-delay: 0.17s; animation-duration: 1.1s; }
.playing .waveforms .bar:nth-child(15) { animation-delay: 0.45s; animation-duration: 1.4s; }

.track-info {
  margin-bottom: 1.5rem;
  text-align: center;
}

.track-info h4 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: white;
}

.track-info p {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
}

.player-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Timeline */
.timeline-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.time-label {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
  font-variant-numeric: tabular-nums;
  width: 38px;
}

.progress-bar-container {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(to right, hsl(var(--color-primary)), hsl(var(--color-secondary)));
  box-shadow: 0 0 8px hsl(var(--color-secondary) / 0.5);
  position: absolute;
  top: 0;
  left: 0;
  transition: width 0.05s linear;
}

.progress-bar-handle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, left 0.05s linear;
}

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

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

/* Controls bottom row */
.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Speed controller dropdown */
.speed-control {
  position: relative;
}

.btn-text {
  background: transparent;
  border: none;
  color: hsl(var(--text-muted));
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 6px;
}

.btn-text:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.speed-menu {
  position: absolute;
  bottom: 120%;
  left: 0;
  background: hsl(var(--card-bg));
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 10;
  min-width: 70px;
}

.speed-menu button {
  background: transparent;
  border: none;
  color: hsl(var(--text-muted));
  font-family: var(--font-family);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}

.speed-menu button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

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

/* Main buttons */
.main-playback {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.play-btn {
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  justify-content: center;
  box-shadow: 0 4px 18px hsl(var(--color-primary) / 0.4);
}

/* Volume Slider styling */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}

.volume-slider {
  -webkit-appearance: none;
  width: 0px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  cursor: pointer;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
  overflow: hidden;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.volume-control:hover .volume-slider {
  width: 60px;
  opacity: 1;
}

/* B. TRANSCRIPT COLUMN DETAILS */
.transcript-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  font-size: 1rem;
  line-height: 1.7;
  color: hsl(var(--text-primary) / 0.9);
  text-align: left;
}

.transcript-body p {
  margin-bottom: 1.25rem;
}

.transcript-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: hsl(var(--text-muted));
  gap: 1rem;
}

.placeholder-icon {
  width: 48px;
  height: 48px;
  color: rgba(255, 255, 255, 0.05);
}

/* C. HISTORY COLUMN DETAILS */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.history-item.active {
  background: hsl(var(--color-primary) / 0.08);
  border-color: hsl(var(--color-primary) / 0.3);
}

.history-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.history-item.active .history-item-icon {
  background: hsl(var(--color-primary));
  color: white;
}

.history-item.active .history-item-icon i {
  color: white !important;
}

.history-item-icon i {
  width: 18px;
  height: 18px;
  color: hsl(var(--text-muted));
}

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-subtitle {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.history-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  color: hsl(var(--text-muted));
  gap: 0.75rem;
}

/* Spinner */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: hsl(var(--color-primary));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* 3. MODAL SETTINGS CSS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  padding: 1.75rem 2rem;
}

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

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  margin-bottom: 1.75rem;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Scrollbars styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

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

@keyframes bounce {
  from { height: 8px; }
  to { height: 45px; }
}

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

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

.animate-slide-in {
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    overflow-y: auto;
    height: auto;
  }
  
  .app-container {
    height: auto;
    overflow-y: visible;
  }
  
  .column {
    height: auto !important;
  }
  
  .column .glass-card {
    height: auto;
  }
  
  .transcript-body {
    max-height: 400px;
  }
  
  .history-list {
    max-height: 300px;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 0.75rem;
    gap: 0.75rem;
  }
  
  .lock-card, .modal-card {
    padding: 1.5rem;
  }
  
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .logo-icon {
    width: 16px;
    height: 16px;
  }
  
  .brand-logo {
    width: 34px;
    height: 34px;
  }
  
  .brand-text h2 {
    font-size: 0.95rem;
  }
  
  .player-body {
    padding: 1rem;
  }
  
  .visualizer-container {
    height: 140px;
  }
  
  .waveforms .bar {
    width: 4px;
  }
}
