/* ============================================
   Vocare — POC Design System
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Primary Teal */
  --primary-50: #F0FDFA;
  --primary-100: #CCFBF1;
  --primary-200: #99F6E4;
  --primary-300: #5EEAD4;
  --primary-400: #2DD4BF;
  --primary-500: #06AC9C;
  --primary-600: #0D9488;
  --primary-700: #0D5768;
  --primary-800: #115E59;
  --primary-900: #134E4A;
  --primary-950: #042F2E;

  /* Semantic */
  --success: #2D9A6A;
  --warning: #F59E0B;
  --error: #D5262D;
  --info: #3B82F6;

  /* Backgrounds */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F1F4F5;
  --bg-tertiary: #F8FAFC;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Borders */
  --border-light: #E2E8F0;
  --border-default: #CBD5E1;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-fab: 0 8px 24px rgba(6, 172, 156, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Spacing */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --mobile-nav-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Focus States (Accessibility) --- */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Typography Utilities --- */
.font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.text-display {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.text-h1 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.text-h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.text-h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

.text-caption {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

/* --- Status Colors --- */
.status-approved { color: var(--success); }
.status-pending { color: var(--warning); }
.status-rejected, .status-alert { color: var(--error); }
.status-processing, .status-info { color: var(--info); }

.bg-status-approved { background: #ECFDF5; border-left: 4px solid var(--success); }
.bg-status-pending { background: #FFFBEB; border-left: 4px solid var(--warning); }
.bg-status-rejected { background: #FEF2F2; border-left: 4px solid var(--error); }
.bg-status-processing { background: #EFF6FF; border-left: 4px solid var(--info); }

/* --- Card Styles --- */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-interactive:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* --- Button Styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary-500);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-600);
  box-shadow: 0 4px 12px rgba(6, 172, 156, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #248c5e;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #b82025;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-secondary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- Badge Styles --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.badge-medical { background: #DBEAFE; color: #1E40AF; }
.badge-social { background: #F3E8FF; color: #7C3AED; }
.badge-educational { background: #FEF3C7; color: #92400E; }
.badge-administrative { background: #E2E8F0; color: #475569; }

.badge-routine { background: #F0FDF4; color: var(--success); }
.badge-important { background: #FFF7ED; color: #C2410C; }
.badge-urgent { background: #FEF2F2; color: var(--error); }
.badge-emergency { background: var(--error); color: white; }

.badge-approved { background: #ECFDF5; color: var(--success); }
.badge-pending { background: #FFFBEB; color: #92400E; }
.badge-rejected { background: #FEF2F2; color: var(--error); }

/* --- Sidebar Layout --- */
.layout-dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--border-light);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 35;
}

.dashboard-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  background: var(--bg-secondary);
  transition: margin-left var(--transition-normal);
}

.sidebar.collapsed + .dashboard-content,
.sidebar.collapsed ~ .dashboard-content {
  margin-left: var(--sidebar-collapsed);
}

.dashboard-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.dashboard-main {
  padding: 24px;
  max-width: 1400px;
}

/* --- Mobile Layout --- */
.mobile-frame {
  max-width: 428px;
  margin: 0 auto;
  min-height: 100vh;
  background: white;
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .mobile-frame {
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
  }
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: white;
  border-bottom: 1px solid var(--border-light);
  padding: 12px 16px;
}

.mobile-content {
  padding: 16px;
  padding-bottom: calc(var(--mobile-nav-height) + 32px);
}

.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 428px;
  height: var(--mobile-nav-height);
  background: white;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
  padding: 0 8px;
}

/* --- FAB (Voice Capture Button) --- */
.fab-record {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: var(--primary-500);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  position: relative;
  transition: all var(--transition-fast);
  margin-top: -20px;
}

.fab-record:hover {
  background: var(--primary-600);
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(6, 172, 156, 0.4);
}

.fab-record:active {
  transform: scale(0.95);
}

.fab-record.recording {
  background: var(--error);
  box-shadow: 0 8px 24px rgba(213, 38, 45, 0.3);
}

.fab-record .pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 9999px;
  border: 2px solid var(--primary-500);
  animation: pulseRing 1.5s ease-out infinite;
}

.fab-record.recording .pulse-ring {
  border-color: var(--error);
}

/* --- Waveform Animation --- */
.waveform-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
}

.waveform-bar {
  width: 4px;
  background: var(--primary-500);
  border-radius: 2px;
  animation: waveform 1.2s ease-in-out infinite;
}

.waveform-bar:nth-child(1) { animation-delay: 0s; height: 12px; }
.waveform-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; height: 32px; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; height: 24px; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; height: 36px; }
.waveform-bar:nth-child(6) { animation-delay: 0.5s; height: 28px; }
.waveform-bar:nth-child(7) { animation-delay: 0.6s; height: 16px; }
.waveform-bar:nth-child(8) { animation-delay: 0.7s; height: 24px; }
.waveform-bar:nth-child(9) { animation-delay: 0.8s; height: 32px; }
.waveform-bar:nth-child(10) { animation-delay: 0.9s; height: 20px; }
.waveform-bar:nth-child(11) { animation-delay: 1.0s; height: 12px; }
.waveform-bar:nth-child(12) { animation-delay: 1.1s; height: 28px; }

/* --- Toast Notifications --- */
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  min-width: 320px;
  max-width: 420px;
  animation: slideIn 0.3s ease forwards;
}

.toast.removing {
  animation: slideOut 0.3s ease forwards;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: bounceIn 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
}

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

/* --- Confidence Bar --- */
.confidence-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-normal);
}

.confidence-high { background: var(--success); }
.confidence-medium { background: var(--warning); }
.confidence-low { background: var(--error); }

/* --- Loading Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Form Styles --- */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-primary);
  background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(6, 172, 156, 0.1);
}

.form-input::placeholder {
  color: var(--text-light);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(213, 38, 45, 0.1);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

/* --- Glassmorphism Navbar --- */
.navbar-glass {
  backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* --- Gradient Mesh Background --- */
.gradient-mesh {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(6, 172, 156, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(13, 87, 104, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(6, 172, 156, 0.06) 0%, transparent 50%),
    #FFFFFF;
}

/* --- Data Table --- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-light);
}

.data-table th:first-child {
  border-top-left-radius: 8px;
}

.data-table th:last-child {
  border-top-right-radius: 8px;
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-tertiary);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-light);
}

.tab {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--primary-500);
  border-bottom-color: var(--primary-500);
}

/* --- Page Transition --- */
.page-enter {
  opacity: 0;
  transform: translateY(8px);
}

.page-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* --- Responsive Sidebar --- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 45;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .dashboard-content {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .dashboard-main {
    padding: 16px;
  }
}

/* --- Print Styles --- */
@media print {
  .sidebar, .dashboard-header, .mobile-nav, .fab-record {
    display: none !important;
  }

  .dashboard-content {
    margin-left: 0 !important;
  }
}

/* --- Utility Classes --- */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
