/* assistant-widget.css - Cuadrado estilo LiveKit, look lujoso y sofisticado */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --sp-orb-size: 112px;
  --grid-size: var(--sp-orb-size);
  --grid-bg: linear-gradient(145deg, #0c0a09 0%, #141210 50%, #0f0d0b 100%);
  --grid-border: 1px solid rgba(212, 175, 55, 0.2);
  --grid-glow: rgba(212, 175, 55, 0.15);
  --cell-idle: rgba(45, 42, 39, 0.9);
  --cell-highlight: #d4af37;
  --cell-glow: 0 0 12px 2px rgba(212, 175, 55, 0.5);
  --accent-gold: #d4af37;
  --accent-champagne: #e8dcc4;
  --connecting-glow: rgba(245, 158, 11, 0.4);
  --live-glow: rgba(212, 175, 55, 0.35);
  --error-glow: rgba(185, 28, 28, 0.4);
  --sp-state-hue: 178;
  --sp-state-shift: 1.0;
  --sp-audio-level: 0;
  --sp-idle-level: 0;
}

.assistant-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.assistant-widget-container.sp-pos-bottom-left {
  left: 24px;
  right: auto;
  align-items: flex-start;
}

.assistant-widget-container.sp-pos-top-right {
  top: 24px;
  bottom: auto;
}

.assistant-widget-container.sp-pos-top-left {
  top: 24px;
  left: 24px;
  right: auto;
  bottom: auto;
  align-items: flex-start;
}

.assistant-widget-container.sp-orb-minimal {
  --grid-bg: linear-gradient(145deg, #0f172a 0%, #111827 100%);
  --grid-border: 1px solid rgba(59, 130, 246, 0.28);
  --grid-glow: rgba(59, 130, 246, 0.22);
  --cell-idle: rgba(30, 41, 59, 0.9);
  --cell-highlight: #60a5fa;
  --cell-glow: 0 0 12px 2px rgba(96, 165, 250, 0.55);
  --accent-gold: #60a5fa;
  --accent-champagne: #dbeafe;
  --live-glow: rgba(96, 165, 250, 0.32);
}

.assistant-widget-container.sp-orb-neon {
  --grid-bg: radial-gradient(circle at 30% 30%, #052e2b 0%, #021a18 65%, #01100f 100%);
  --grid-border: 1px solid rgba(20, 184, 166, 0.35);
  --grid-glow: rgba(20, 184, 166, 0.26);
  --cell-idle: rgba(13, 54, 50, 0.88);
  --cell-highlight: #2dd4bf;
  --cell-glow: 0 0 14px 3px rgba(45, 212, 191, 0.6);
  --accent-gold: #2dd4bf;
  --accent-champagne: #ccfbf1;
  --live-glow: rgba(45, 212, 191, 0.35);
}

.assistant-widget-container.sp-orb-sunset {
  --grid-bg: linear-gradient(145deg, #2c0f0f 0%, #3a1a0f 55%, #24100b 100%);
  --grid-border: 1px solid rgba(251, 146, 60, 0.33);
  --grid-glow: rgba(251, 146, 60, 0.23);
  --cell-idle: rgba(71, 34, 21, 0.88);
  --cell-highlight: #fb923c;
  --cell-glow: 0 0 12px 2px rgba(251, 146, 60, 0.58);
  --accent-gold: #fb923c;
  --accent-champagne: #ffedd5;
  --live-glow: rgba(251, 146, 60, 0.34);
}

.assistant-widget-container * {
  pointer-events: auto;
}

.assistant-grid {
  width: var(--grid-size);
  height: var(--grid-size);
  border-radius: 12px;
  --sp-primary: hsl(var(--sp-state-hue) 95% 62%);
  --sp-secondary: hsl(calc(var(--sp-state-hue) + (var(--sp-state-shift) * 24)) 95% 64%);
  --sp-primary-soft: hsl(var(--sp-state-hue) 95% 62% / 0.45);
  --sp-secondary-soft: hsl(calc(var(--sp-state-hue) + (var(--sp-state-shift) * 24)) 95% 64% / 0.4);
  --cell-highlight: var(--sp-primary);
  --cell-glow: 0 0 14px 2px var(--sp-primary-soft);
  background: var(--grid-bg);
  border: var(--grid-border);
  box-shadow: 0 4px 24px var(--grid-glow), inset 0 1px 0 rgba(255,255,255,0.03);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.assistant-grid.sp-state-connecting {
  --sp-state-hue: 38;
}

.assistant-grid.sp-state-listening {
  --sp-state-hue: 178;
}

.assistant-grid.sp-state-speaking {
  --sp-state-hue: 196;
}

.assistant-grid.sp-state-thinking {
  --sp-state-hue: 282;
}

.assistant-grid.sp-visualizer-bar,
.assistant-grid.sp-visualizer-radial,
.assistant-grid.sp-visualizer-wave,
.assistant-grid.sp-visualizer-aura {
  width: var(--sp-orb-size);
  height: var(--sp-orb-size);
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.assistant-grid.sp-visualizer-bar:hover,
.assistant-grid.sp-visualizer-radial:hover,
.assistant-grid.sp-visualizer-wave:hover,
.assistant-grid.sp-visualizer-aura:hover {
  transform: scale(1.03);
  border-color: transparent;
  box-shadow: none;
}

.assistant-grid.sp-visualizer-bar::before,
.assistant-grid.sp-visualizer-radial::before,
.assistant-grid.sp-visualizer-wave::before,
.assistant-grid.sp-visualizer-aura::before {
  content: none;
}

.assistant-grid:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 32px var(--grid-glow), inset 0 1px 0 rgba(255,255,255,0.05);
  border-color: rgba(212, 175, 55, 0.35);
}

.assistant-grid.connecting {
  border-color: hsl(var(--sp-state-hue) 95% 62% / 0.5);
  box-shadow: 0 4px 24px var(--sp-primary-soft);
  animation: grid-pulse 1.5s ease-in-out infinite;
}

.assistant-grid.live {
  border-color: hsl(var(--sp-state-hue) 95% 62% / 0.4);
  box-shadow: 0 4px 24px var(--sp-primary-soft);
}

.assistant-grid.sp-visualizer-bar.connecting,
.assistant-grid.sp-visualizer-radial.connecting,
.assistant-grid.sp-visualizer-wave.connecting,
.assistant-grid.sp-visualizer-aura.connecting,
.assistant-grid.sp-visualizer-bar.live,
.assistant-grid.sp-visualizer-radial.live,
.assistant-grid.sp-visualizer-wave.live,
.assistant-grid.sp-visualizer-aura.live {
  box-shadow: none;
  animation: none;
}

.assistant-grid.error {
  border-color: rgba(185, 28, 28, 0.5);
  box-shadow: 0 4px 24px var(--error-glow);
}

@keyframes grid-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 4px 24px var(--connecting-glow); }
  50% { opacity: 0.85; box-shadow: 0 6px 28px var(--connecting-glow); }
}

/* Grid interno 11x11 - celdas más grandes y visibles */
.sp-grid-inner {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 2px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  aspect-ratio: 1;
}

.sp-grid-cell {
  width: 100%;
  height: 100%;
  min-width: 4px;
  min-height: 4px;
  background: var(--cell-idle);
  border-radius: 2px;
  transition: background 0.08s ease-out, box-shadow 0.08s ease-out, transform 0.08s ease-out;
}

.sp-grid-cell[data-lk-highlighted="true"] {
  background: var(--cell-highlight);
  box-shadow: var(--cell-glow);
  transform: scale(1.15);
}

/* Cuando está live, transiciones rápidas para el visualizador */
.assistant-grid.live .sp-grid-cell {
  transition: background 0.05s ease-out, box-shadow 0.05s ease-out, transform 0.05s ease-out;
}

/* Celda con brillo parcial (para trail del sweep) */
.sp-grid-cell[data-lk-highlighted="trail"] {
  background: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 6px 1px rgba(212, 175, 55, 0.25);
}

.sp-bars,
.sp-wave-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: calc(100% - 16px);
  height: calc(100% - 20px);
}

.sp-bar,
.sp-wave-bar {
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--sp-secondary), var(--sp-primary));
  box-shadow: 0 0 8px var(--sp-primary-soft);
  opacity: 0.3;
  min-height: 9%;
  transform-origin: center bottom;
  transform: scaleY(calc(0.16 + (var(--sp-level, 0) * 0.92) + (var(--sp-idle-level, 0) * 0.35)));
  transition: transform 70ms ease-out, opacity 70ms ease-out, box-shadow 120ms ease-out;
}

.assistant-grid.sp-idle-hover .sp-bar,
.assistant-grid.sp-idle-hover .sp-wave-bar,
.sp-bar[data-lk-active="true"],
.sp-wave-bar[data-lk-active="true"] {
  opacity: 0.95;
  box-shadow: 0 0 10px var(--sp-primary-soft);
}

.assistant-grid.sp-visualizer-wave .sp-wave-bar:nth-child(odd) {
  width: 3px;
}

.assistant-grid.sp-visualizer-wave .sp-wave-bar:nth-child(3n) {
  opacity: 0.42;
}

.sp-wave-shader,
.sp-aura-shader {
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: visible;
  position: relative;
}

.sp-shader-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sp-radial-inner {
  width: calc(100% - 22px);
  height: calc(100% - 22px);
  border-radius: 999px;
  position: relative;
  background: radial-gradient(circle, hsl(var(--sp-state-hue) 95% 62% / 0.12) 0%, hsl(var(--sp-state-hue) 95% 62% / 0.03) 62%, transparent 100%);
  border: 1px solid hsl(var(--sp-state-hue) 95% 62% / 0.22);
}

.sp-radial-center {
  position: absolute;
  width: 20px;
  height: 20px;
  left: calc(50% - 10px);
  top: calc(50% - 10px);
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, var(--sp-secondary) 35%, var(--sp-primary) 85%);
  box-shadow: 0 0 16px var(--sp-primary-soft);
  opacity: calc(0.35 + (var(--sp-audio-level, 0) * 0.55) + (var(--sp-idle-level, 0) * 0.2));
}

.sp-radial-segment {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 16px;
  margin-left: -2px;
  margin-top: -8px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--sp-secondary), var(--sp-primary));
  opacity: 0.28;
  box-shadow: 0 0 8px var(--sp-primary-soft);
  transform-origin: center 34px;
  transform: rotate(var(--sp-rotate)) scaleY(calc(0.25 + (var(--sp-level, 0) * 1.12) + (var(--sp-idle-level, 0) * 0.35)));
  transition: transform 70ms ease-out, opacity 70ms ease-out, box-shadow 100ms ease-out;
}

.sp-radial-segment[data-lk-active="true"],
.assistant-grid.sp-idle-hover .sp-radial-segment {
  opacity: 0.9;
  box-shadow: 0 0 10px var(--sp-primary-soft);
}

.sp-aura {
  width: calc(100% - 22px);
  height: calc(100% - 22px);
  border-radius: 999px;
  position: relative;
}

.sp-aura-ring,
.sp-aura-core {
  position: absolute;
  border-radius: 999px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: transform 70ms ease-out, opacity 70ms ease-out, box-shadow 120ms ease-out;
}

.sp-aura-ring {
  width: 76%;
  height: 76%;
  border: 1px solid hsl(var(--sp-state-hue) 95% 62% / 0.45);
  box-shadow: 0 0 18px var(--sp-primary-soft), inset 0 0 14px hsl(var(--sp-state-hue) 95% 62% / 0.12);
  opacity: calc(0.42 + (var(--sp-audio-level, 0) * 0.45) + (var(--sp-idle-level, 0) * 0.25));
  transform: translate(-50%, -50%) scale(calc(0.82 + (var(--sp-audio-level, 0) * 0.38) + (var(--sp-idle-level, 0) * 0.15)));
}

.sp-aura-core {
  width: 34%;
  height: 34%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.8) 0%, var(--sp-secondary) 45%, var(--sp-primary) 100%);
  opacity: calc(0.65 + (var(--sp-audio-level, 0) * 0.35));
  box-shadow: 0 0 18px var(--sp-primary-soft), 0 0 30px var(--sp-secondary-soft);
  transform: translate(-50%, -50%) scale(calc(0.86 + (var(--sp-audio-level, 0) * 0.52) + (var(--sp-idle-level, 0) * 0.2)));
}

/* Tooltip */
.assistant-tooltip {
  background: linear-gradient(135deg, rgba(20, 18, 16, 0.95) 0%, rgba(12, 10, 9, 0.98) 100%);
  backdrop-filter: blur(12px);
  color: var(--accent-champagne);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.assistant-widget-container:hover .assistant-tooltip,
.assistant-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Modal de slots */
.sp-slots-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Inter', sans-serif;
}

.sp-slots-modal {
  background: linear-gradient(145deg, #1a1816 0%, #141210 100%);
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.sp-slots-modal-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

/* Steps indicator */
.sp-steps-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sp-step {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.5);
  font-weight: 500;
  transition: color 0.2s;
}

.sp-step-active {
  color: var(--accent-gold);
}

.sp-step-done {
  color: var(--accent-champagne);
}

.sp-step-separator {
  width: 20px;
  height: 1px;
  background: rgba(212, 175, 55, 0.2);
}

.sp-modal-title {
  margin: 0;
  font-size: 18px;
  color: var(--accent-champagne);
  font-weight: 600;
}

.sp-slots-modal-body {
  padding: 20px;
}

.sp-slots-loading {
  color: #94a3b8;
  text-align: center;
  padding: 24px;
}

.sp-slots-empty {
  color: #94a3b8;
  text-align: center;
  padding: 24px;
}

/* Date grid - paso 1 */
.sp-dates-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.sp-date-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  background: rgba(45, 42, 39, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  min-height: 58px;
}

.sp-date-btn:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.sp-date-btn.sp-date-suggested {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.sp-date-btn.sp-date-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sp-date-weekday {
  font-size: 11px;
  color: rgba(148, 163, 184, 0.7);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sp-date-day {
  font-size: 18px;
  color: var(--accent-champagne);
  font-weight: 600;
  margin-top: 2px;
}

.sp-date-btn.sp-date-disabled .sp-date-day {
  color: rgba(148, 163, 184, 0.3);
}

/* Slots list - paso 2 */
.sp-slots-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-slot-btn {
  background: rgba(45, 42, 39, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 14px 18px;
  color: var(--accent-champagne);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: left;
}

.sp-slot-btn:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.sp-slot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sp-slots-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.sp-slots-back-btn {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--accent-gold);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, border-color 0.2s;
}

.sp-slots-back-btn:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.4);
}

.sp-slots-close-btn {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--accent-champagne);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.sp-slots-close-btn:hover {
  background: rgba(212, 175, 55, 0.1);
}

.sp-slots-success {
  color: #22c55e;
  text-align: center;
  padding: 24px;
  font-weight: 500;
}

.sp-meet-link {
  color: var(--accent-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}
