/* ============================================
   PROFESSIONAL AI VOICE CALLS PLATFORM
   Modern, Accessible, Beautiful Design System
   Light Theme Only - Orange as Accent Only
   ============================================ */

:root[data-theme="light"],
:root {
  /* ============================================
     BRAND & ACTION COLORS (Accent Only)
     ============================================ */
  --brand-500: #E85C2E;   /* Primary action (buttons, active nav) */
  --brand-600: #D44F26;   /* Hover / pressed */
  --brand-100: #FFE7DD;   /* Soft highlight (rare use only) */
  
  /* Legacy compatibility - map to brand */
  --primary: var(--brand-500);
  --on-primary: #FFFFFF;  /* White text on brand buttons */

  /* ============================================
     NEUTRAL FOUNDATION (80% of UI)
     ============================================ */
  --bg-app: #F7F7F8;      /* App background */
  --bg-surface: #FFFFFF;   /* Cards, tables, modals */
  --bg-muted: #F1F2F4;    /* Inputs, subtle sections */
  
  --border-subtle: #E5E7EB;  /* Light borders */
  --border-strong: #D1D5DB;   /* Strong borders */
  
  /* Legacy compatibility */
  --bg: var(--bg-app);
  --surface: var(--bg-surface);
  --border-color: var(--border-subtle);
  --bg-hover: #E8E8E8;
  --surface-secondary: var(--bg-muted);

  /* ============================================
     TEXT HIERARCHY (WCAG Compliant)
     ============================================ */
  --text-primary: #111827;   /* Headings, numbers, KPIs (≥4.5:1 contrast) */
  --text-secondary: #4B5563; /* Labels, metadata (≥3:1 contrast) */
  --text-muted: #6B7280;     /* Helper text (replaces ultra-light gray) */
  --text-disabled: #9CA3AF;  /* Disabled states */
  
  /* Legacy compatibility */
  --text-secondary: var(--text-secondary);

  /* ============================================
     STATUS COLORS (Strictly Semantic)
     ============================================ */
  --success-500: #22C55E;
  --success-100: #DCFCE7;
  --warning-500: #F59E0B;
  --warning-100: #FEF3C7;
  --danger-500: #EF4444;
  --danger-100: #FEE2E2;
  --info-500: #3B82F6;
  --info-100: #DBEAFE;
  
  /* Legacy compatibility */
  --success: var(--success-500);
  --warning: var(--warning-500);
  --error: var(--danger-500);
  --info: var(--info-500);

  /* ============================================
     SIDEBAR COLORS
     ============================================ */
  --sidebar-bg: #1F2937;
  --sidebar-text: #F9FAFB;
  --sidebar-text-muted: #D1D5DB;
  --sidebar-border: #374151;
  --sidebar-hover: #374151;
  --sidebar-active: var(--brand-500);  /* Brand color for active nav */
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 0.875rem; /* 14px base */
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; } /* 28px */
h2 { font-size: 1.375rem; } /* 22px */
h3 { font-size: 1.25rem; } /* 20px */
h4 { font-size: 1.125rem; } /* 18px */

/* ============================================
   UTILITY CLASSES
   ============================================ */

.theme-bg {
  background-color: var(--bg-app);
}

.theme-surface {
  background-color: var(--bg-surface);
}

.theme-surface-secondary {
  background-color: var(--surface-secondary);
}

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

.theme-text-secondary {
  color: var(--text-secondary);
}

.theme-text-muted {
  color: var(--text-muted);
}

.theme-border {
  border-color: var(--border-subtle);
}

.theme-border-t {
  border-top: 1px solid var(--border-subtle);
}

.theme-border-b {
  border-bottom: 1px solid var(--border-subtle);
}

.theme-input {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.sidebar-text {
  color: var(--sidebar-text);
}

.sidebar-text-muted {
  color: var(--sidebar-text-muted);
}

.sidebar-border {
  border-color: var(--sidebar-border);
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-hover {
  background-color: var(--sidebar-hover);
}

.nav-item-active {
  background-color: var(--sidebar-active);
  color: var(--on-primary);
}

.nav-item-inactive {
  color: var(--sidebar-text-muted);
}

.nav-item-inactive:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text);
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

.btn-primary {
  background: var(--brand-500);
  color: var(--on-primary);
  padding: 0.75rem 1.25rem; /* Height ~44px */
  border-radius: 0.625rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  min-height: 44px;
}

.btn-primary:hover {
  background: var(--brand-600);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

.btn-secondary:hover {
  background-color: var(--bg-muted);
  border-color: var(--text-secondary);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.btn-success {
  background: var(--success-500);
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-success:hover {
  background: #16A34A;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

.btn-success:focus-visible {
  outline: 2px solid var(--success-500);
  outline-offset: 2px;
}

.btn-warning {
  background: var(--warning-500);
  color: white;
  padding: 0.375rem 0.875rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-warning:hover {
  background: #D97706;
}

.btn-warning:focus-visible {
  outline: 2px solid var(--warning-500);
  outline-offset: 2px;
}

/* ============================================
   STAT CARDS - Professional Design
   ============================================ */

.stat-card {
  background: var(--bg-surface);
  border-radius: 0.5rem;
  padding: 1rem; /* 16px - 4-point scale */
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.stat-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--border-strong);
}

/* ============================================
   ACTION CARDS - Professional Design
   ============================================ */

.action-card {
  background: var(--bg-surface);
  border-radius: 0.5rem;
  padding: 1.25rem 1rem; /* Reduced from 2rem for better density */
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  display: block;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.action-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--border-strong);
}

/* ============================================
   TABLES - Professional Design
   ============================================ */

.table-container {
  background: var(--bg-surface);
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem; /* 14px - improved from 13px */
}

.table-container thead th {
  background-color: var(--bg-muted);
  color: var(--text-secondary); /* Not muted - better contrast */
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-container tbody td {
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.table-container tbody tr:hover {
  background-color: #FAFAFA;
}

.table-container tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   STATUS BADGES (Semantic Colors Only)
   ============================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.025em;
}

.status-badge.draft {
  background-color: #E5E7EB;
  color: #374151;
}

.status-badge.scheduled {
  background-color: var(--warning-100);
  color: #92400E;
}

.status-badge.running {
  background-color: var(--info-100);
  color: #1E40AF;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-badge.completed {
  background-color: var(--success-100);
  color: #065F46;
}

.status-badge.failed {
  background-color: var(--danger-100);
  color: #991B1B;
}

.status-badge.paused {
  background-color: var(--warning-100);
  color: #92400E;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .7;
  }
}

/* ============================================
   FORM INPUTS
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(232, 92, 46, 0.1);
}

input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="password"]:focus-visible,
input[type="date"]:focus-visible,
input[type="datetime-local"]:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input[type="text"]:disabled,
input[type="email"]:disabled,
input[type="password"]:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--bg-muted);
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* Error states */
input.error,
select.error,
textarea.error {
  border-color: var(--danger-500);
}

input.error:focus,
select.error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
