/* ============================================
   VoxPulse Component Styles
   ============================================ */

/* Alpine.js cloak */
[x-cloak] { display: none !important; }

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.5rem;
  background: white;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  animation: slideIn 0.3s ease-out;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #3b82f6; }

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-message { flex: 1; font-size: 0.875rem; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
}
.toast-close:hover { opacity: 1; }

.toast-fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: white;
  border-radius: 0.75rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.2s ease-out;
}

.modal-confirm {
  max-width: 400px;
  padding: 1.5rem;
}

/* ============================================
   Floating Action Button (FAB) - Mic
   ============================================ */
.fab {
  position: fixed;
  bottom: var(--mic-bottom-offset);
  left: 50%;
  transform: translateX(-50%);
  width: var(--mic-size-desktop);
  height: var(--mic-size-desktop);
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-mic);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 60;
}

/* Mobile: hide floating FAB, use integrated nav mic instead */
@media (max-width: 640px) {
  .fab {
    display: none;
  }
}

.fab-recording-background {
  background: var(--status-error) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

.fab:hover {
  transform: translateX(-50%) scale(1.05);
  background: var(--accent-primary-hover);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.fab-recording-background:hover {
  background: #dc2626 !important;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5) !important;
}

.fab:active {
  transform: translateX(-50%) scale(0.95);
}

.recording-pulse {
  animation: recording-pulse 1.5s ease-in-out infinite;
}

/* ============================================
   Bottom Navigation (Mobile)
   ============================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 640px) {
  .bottom-nav {
    display: flex;
  }
  .main-content-with-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + 24px);
  }
  .desktop-tabs {
    display: none !important;
  }
}

.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  height: 100%;
  padding: 0 8px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  text-decoration: none;
  transition: all 0.15s ease;
  gap: 2px;
  min-width: 56px;
}

.bottom-nav-item:hover {
  color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.05);
}

.bottom-nav-item.active {
  color: var(--accent-primary);
}

.bottom-nav-gap {
  width: calc(var(--mic-size-mobile) + 16px);
  flex-shrink: 0;
}

/* Integrated mic button in bottom nav */
.bottom-nav-mic {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-top: -20px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  border: 4px solid var(--bg-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.bottom-nav-mic:hover {
  transform: scale(1.05);
  background: var(--accent-primary-hover);
}

.bottom-nav-mic:active {
  transform: scale(0.95);
}

.bottom-nav-mic.recording {
  background: var(--status-error);
  animation: recording-pulse 1.5s ease-in-out infinite;
}

/* ============================================
   Tab Navigation (Desktop Header)
   ============================================ */
.tab-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.tab-nav-item {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.tab-nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.tab-nav-item.active {
  color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.1);
}

/* ============================================
   Audio Visualizer
   ============================================ */
.audio-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 60px;
  margin: 1rem 0;
}

.audio-bar {
  width: 4px;
  background: #8b5cf6;
  border-radius: 2px;
  transition: height 0.1s ease;
}

/* ============================================
   Tags & Badges
   ============================================ */
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tag-gray { background: #f3f4f6; color: #374151; }
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-green { background: #d1fae5; color: #065f46; }
.tag-yellow { background: #fef3c7; color: #92400e; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-purple { background: #ede9fe; color: #5b21b6; }
.tag-pink { background: #fce7f3; color: #9f1239; }

.tag-ai {
  background: #8b5cf6;
  color: white;
  font-weight: 500;
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-uploading { background: #f3e8ff; color: #7c3aed; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-completed { background: transparent; color: #6b7280; }
.status-failed { background: #fee2e2; color: #991b1b; }

/* ============================================
   Recording Card
   ============================================ */
.recording-card {
  background: white;
  border-radius: 0.5rem;
  padding: 0.625rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: box-shadow 0.15s ease;
  cursor: pointer;
}

.recording-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   Empty State & Loading
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: #6b7280;
}

.loading-spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #8b5cf6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

/* ============================================
   Onboarding
   ============================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

.onboarding-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9997;
  pointer-events: auto;
}

.onboarding-spotlight {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
  z-index: 9998;
  pointer-events: none;
  transition: all 0.4s ease-out;
}

.onboarding-tooltip {
  position: absolute;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 320px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  pointer-events: auto;
  animation: tooltipFadeIn 0.3s ease-out;
}

.onboarding-tooltip::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--bg-card);
  transform: rotate(45deg);
}

.onboarding-tooltip.tooltip-top::before {
  bottom: -8px;
  left: 50%;
  margin-left: -8px;
}

.onboarding-tooltip.tooltip-bottom::before {
  top: -8px;
  left: 50%;
  margin-left: -8px;
}

.onboarding-step-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
}

.onboarding-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-default);
  transition: all 0.2s ease;
}

.onboarding-step-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--accent-primary);
}

/* ============================================
   Theme-aware utility classes
   ============================================ */
.theme-bg-app { background-color: var(--bg-app); }
.theme-bg-card { background-color: var(--bg-card); }
.theme-bg-elevated { background-color: var(--bg-elevated); }
.theme-text-primary { color: var(--text-primary); }
.theme-text-secondary { color: var(--text-secondary); }
.theme-text-muted { color: var(--text-muted); }
.theme-border { border-color: var(--border-default); }
.theme-border-strong { border-color: var(--border-strong); }

/* ============================================
   Keyframe Animations
   ============================================ */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes recording-pulse {
  0%, 100% {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: translateX(-50%) scale(1.03);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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