/* ==========================================================================
   WJRN HOTLINE DESK - DESIGN SYSTEM & TOKENS
   ========================================================================== */

:root {
  /* Colors */
  --bg-primary: #050811;
  --bg-secondary: #0b1120;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-gold: #b5945b;
  --accent-gold-glow: rgba(181, 148, 91, 0.35);
  --accent-gold-hover: #cbb080;
  
  --color-danger: #f43f5e;
  --color-danger-glow: rgba(244, 63, 94, 0.3);
  --color-danger-hover: #fb7185;
  
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.2);
  
  --glass-bg: rgba(15, 23, 42, 0.45);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-shadow: rgba(0, 0, 0, 0.5);
  
  /* Fonts */
  --font-display: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Glow */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
  will-change: transform;
}

.bg-glow-1 {
  width: 50vw;
  height: 50vw;
  max-width: 600px;
  max-height: 600px;
  background: radial-gradient(circle, rgba(181, 148, 91, 0.2) 0%, rgba(0,0,0,0) 70%);
  top: -10%;
  right: -5%;
  animation: floatGlow1 25s infinite alternate ease-in-out;
}

.bg-glow-2 {
  width: 60vw;
  height: 60vw;
  max-width: 700px;
  max-height: 700px;
  background: radial-gradient(circle, rgba(30, 41, 150, 0.15) 0%, rgba(0,0,0,0) 75%);
  bottom: -15%;
  left: -10%;
  animation: floatGlow2 30s infinite alternate ease-in-out;
}

.bg-glow-3 {
  width: 40vw;
  height: 40vw;
  max-width: 500px;
  max-height: 500px;
  background: radial-gradient(circle, rgba(120, 20, 150, 0.1) 0%, rgba(0,0,0,0) 70%);
  top: 40%;
  left: 35%;
  animation: floatGlow3 20s infinite alternate ease-in-out;
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Panel Helper */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 var(--glass-shadow);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  text-decoration: none;
  background: transparent;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #8c6e3b 100%);
  box-shadow: 0 4px 14px var(--accent-gold-glow);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-gold-hover) 0%, var(--accent-gold) 100%);
  box-shadow: 0 6px 20px var(--accent-gold-glow);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-tertiary {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-tertiary:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: inline-block;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */

.login-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  animation: fadeIn 0.5s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.15em;
  background: rgba(181, 148, 91, 0.12);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 16px;
  box-shadow: 0 0 10px rgba(181, 148, 91, 0.1);
}

.login-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.login-form .input-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-form label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.login-form input[type="password"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  transition: all var(--transition-fast);
  outline: none;
}

.login-form input[type="password"]:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-glow);
  background: rgba(0, 0, 0, 0.4);
}

.error-message {
  color: var(--color-danger);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 6px;
}

.error-message.visible {
  display: flex;
}

/* ==========================================================================
   DASHBOARD HEADER
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-bottom: 24px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-brand-img {
  height: 32px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1) drop-shadow(0 0 8px var(--accent-gold-glow));
}

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

.hotline-phone {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  color: var(--accent-gold);
  text-shadow: 0 0 12px var(--accent-gold-glow);
  letter-spacing: 0.05em;
}

.logo-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
}

.logo-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-success);
}

.status-dot.pulsing {
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulseSuccess 2s infinite;
}

.status-text {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-right {
  display: flex;
  gap: 12px;
}

.refresh-icon.spinning {
  animation: spin 1s linear infinite;
}

/* ==========================================================================
   STATS BAR CONTROLS
   ========================================================================== */

.desk-controls {
  margin-bottom: 24px;
}

.stats-bar {
  display: flex;
  padding: 16px 24px;
  gap: 24px;
  align-items: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.glow-text {
  color: var(--accent-gold);
  text-shadow: 0 0 10px rgba(181, 148, 91, 0.4);
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
}

.flex-grow {
  flex-grow: 1;
}

.status-light {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==========================================================================
   VOICEMAIL GRID & CARDS
   ========================================================================== */

.voicemail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  width: 100%;
}

.voicemail-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
}

.voicemail-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  transition: background var(--transition-fast);
}

.voicemail-card[data-downloaded="false"] {
  border-color: rgba(181, 148, 91, 0.25);
  background: rgba(181, 148, 91, 0.02);
}

.voicemail-card[data-downloaded="false"]::before {
  background: var(--accent-gold);
}

.voicemail-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 255, 255, 0.02);
}

.voicemail-card:hover[data-downloaded="false"] {
  border-color: rgba(181, 148, 91, 0.4);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 20px rgba(181, 148, 91, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.caller-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.caller-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text-primary);
}

.received-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.badge-container {
  flex-shrink: 0;
  min-height: 20px;
}

.new-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  background: var(--accent-gold);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(181, 148, 91, 0.4);
  animation: badgePulse 2s infinite;
}

/* Custom Audio Player */
.player-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 14px;
}

.play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  outline: none;
}

.play-btn:hover {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
  transform: scale(1.05);
}

.play-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.progress-bar {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.progress-bar:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Progress bar webkit styles */
.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 6px var(--accent-gold-glow);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.progress-bar::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Firefox styles */
.progress-bar::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 6px var(--accent-gold-glow);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.progress-bar::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.time-display {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.card-actions .download-btn {
  flex-grow: 1;
  background: rgba(181, 148, 91, 0.06);
  border: 1px solid rgba(181, 148, 91, 0.15);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.card-actions .download-btn:hover {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #000;
  box-shadow: 0 4px 12px var(--accent-gold-glow);
}

.action-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.card-actions .delete-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all var(--transition-fast);
  cursor: pointer;
  outline: none;
}

.card-actions .delete-btn:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--color-danger-hover);
}

.card-actions .delete-btn.confirming {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--text-primary);
  box-shadow: 0 4px 12px var(--color-danger-glow);
  animation: shakeSmall 0.3s ease-in-out;
}

/* ==========================================================================
   LOADING & EMPTY STATES
   ========================================================================== */

.grid-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  border-top-color: var(--accent-gold);
  animation: spin 1s ease-in-out infinite;
}

.grid-loading p {
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 32px;
  max-width: 500px;
  margin: 40px auto;
  gap: 16px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  margin-top: auto;
  padding: 40px 0 16px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */

@keyframes floatGlow1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 40px) scale(1.05); }
}

@keyframes floatGlow2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, -20px) scale(0.95); }
}

@keyframes floatGlow3 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -30px) scale(1.1); }
}

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

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

@keyframes pulseSuccess {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes badgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(181, 148, 91, 0.4);
  }
  70% {
    box-shadow: 0 0 0 5px rgba(181, 148, 91, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(181, 148, 91, 0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shakeSmall {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Class for fade-in slide of newly polled voicemails */
.new-arrival {
  animation: slideInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Class for collapsing a deleted voicemail card */
.deleting {
  animation: cardCollapse 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes cardCollapse {
  0% {
    opacity: 1;
    transform: scale(1);
    max-height: 300px;
    margin-bottom: 20px;
    padding: 20px;
    border-width: 1px;
  }
  100% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    overflow: hidden;
  }
}

/* ==========================================================================
   MEDIA QUERIES (Mobile-Friendly Layout)
   ========================================================================== */

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    align-items: stretch;
  }
  
  .header-left {
    justify-content: space-between;
  }
  
  .header-center {
    justify-content: center;
    margin: 4px 0;
  }
  
  .header-right {
    justify-content: stretch;
  }
  
  .header-right .btn {
    flex-grow: 1;
  }
  
  .stats-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  
  .stat-divider {
    display: none;
  }
  
  .voicemail-grid {
    grid-template-columns: 1fr;
  }
}
