/* ===================================================================
   PANITAS VOICE - MODERN WEB APP STYLESHEET (SPA)
   Design System: Slate Dark / Indigo Glow / Glassmorphism
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-main: #07090e;
  --bg-surface: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --accent-primary: #6366f1;
  --accent-glow: #818cf8;
  --accent-hover: #4f46e5;
  
  --color-emerald: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.35);
  --color-rose: #f43f5e;
  --color-rose-glow: rgba(244, 63, 94, 0.35);
  --color-amber: #f59e0b;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --sidebar-width: 260px;
  --bottom-nav-height: 68px;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Outfit', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Glassmorphism */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
}

.glass-panel-hover {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-panel-hover:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.6);
}

/* Botones principales */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
  filter: brightness(1.08);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.5);
}

/* Efecto de voz activa */
.speaking-pulse {
  border-color: var(--color-emerald) !important;
  box-shadow: 0 0 24px var(--color-emerald-glow) !important;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Radar 2D */
.radar-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.95) 0%, rgba(7, 9, 14, 0.98) 100%);
  border: 2px solid rgba(99, 102, 241, 0.3);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8), 0 12px 36px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#radar-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Indicador de barra activa (Bottom Nav) */
.nav-indicator-line {
  position: absolute;
  top: 0;
  height: 3px;
  width: 32px;
  background: var(--accent-glow);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 10px var(--accent-glow);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Barra inferior móvil */
.mobile-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 6px 0;
}
.mobile-nav-btn i {
  font-size: 1.35rem;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-nav-btn.active {
  color: var(--accent-glow);
}
.mobile-nav-btn.active i {
  transform: translateY(-2px);
}

/* Botón central (+) destacado */
.center-add-btn {
  width: 48px;
  height: 44px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.center-add-btn:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: var(--accent-glow);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Sidebar para PC/Escritorio */
@media (min-width: 1024px) {
  .mobile-nav-bar {
    display: none;
  }
  .app-main-layout {
    display: flex;
    min-height: 100vh;
  }
  .desktop-sidebar {
    width: var(--sidebar-width);
    background: rgba(11, 15, 25, 0.95);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
  }
  .main-content-container {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    padding-bottom: 3rem;
  }
}

@media (max-width: 1023px) {
  .desktop-sidebar {
    display: none;
  }
  .main-content-container {
    width: 100%;
    padding: 1rem;
    padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
  }
}

/* Animaciones de vistas SPA */
.spa-view {
  display: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.spa-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Drawer Lateral de Perfil y Ajustes */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.profile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: #0b0f19;
  border-right: 1px solid var(--border-subtle);
  z-index: 51;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 20px 0 50px rgba(0, 0, 0, 0.7);
}
.profile-drawer.open {
  transform: translateX(0);
}

/* Burbujas de Chat */
.chat-bubble-received {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 18px 18px 18px 4px;
}
.chat-bubble-sent {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px 18px 4px 18px;
}

/* Mineral Rain Animation (Efecto Lluvia de Minerales del servidor) */
.mineral-particle {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  font-size: 1.5rem;
  animation: fall-down linear forwards;
}

@keyframes fall-down {
  0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* Audio Visualizer Waves */
.visualizer-bar {
  width: 4px;
  height: 6px;
  background: var(--accent-glow);
  border-radius: 999px;
  transition: height 0.08s ease;
}
