/* SeniorSitters CareHub - Accessible Design System
   =================================================
   WCAG 2.1 AA Compliant - Minimum 4.5:1 contrast ratio for text
   Professional Healthcare SaaS Aesthetic
*/

/* ============================================
   DESIGN TOKENS - ACCESSIBLE COLOR SYSTEM
   ============================================ */

:root {
  /* Background Hierarchy - Clear separation */
  --bg-page: #F8F6F3;           /* Main page background - soft warm gray */
  --bg-secondary: #F0EDE8;      /* Secondary areas - slightly darker */
  --bg-card: #FFFFFF;           /* Card backgrounds - pure white */
  --bg-elevated: #FFFFFF;       /* Elevated elements */
  --bg-hover: #F5F3EF;          /* Hover states */
  --bg-active: #EBE8E2;         /* Active/selected states */
  
  /* Text Hierarchy - Strong readable contrast */
  --text-primary: #2D2924;      /* Main body text - 7.8:1 on white */
  --text-secondary: #4A4540;    /* Secondary text - 6.2:1 on white */
  --text-tertiary: #6B6459;       /* Muted but readable - 4.6:1 on white */
  --text-placeholder: #8B8478;    /* Placeholders - 4.5:1 on white */
  --text-inverse: #FFFFFF;      /* Text on dark backgrounds */
  
  /* Brand Colors - Healthcare Professional */
  --brand-primary: #2B6B7C;       /* Primary teal - professional */
  --brand-primary-hover: #1F4F5C; /* Darker for hover */
  --brand-primary-light: #E8F4F6; /* Light backgrounds */
  --brand-secondary: #C67B5C;     /* Warm accent - accessible */
  --brand-secondary-hover: #A05E44;
  --brand-secondary-light: #FDF2EE;
  
  /* Semantic Colors - Accessible Status */
  --success-dark: #166534;        /* Green text - 7:1 on white */
  --success: #22C55E;             /* Green icons/highlights */
  --success-light: #DCFCE7;       /* Green backgrounds */
  
  --warning-dark: #92400E;        /* Orange/amber text */
  --warning: #F59E0B;             /* Warning icons */
  --warning-light: #FEF3C7;       /* Warning backgrounds */
  
  --danger-dark: #991B1B;         /* Red text - errors */
  --danger: #EF4444;              /* Danger icons */
  --danger-light: #FEE2E2;        /* Error backgrounds */
  
  --info-dark: #1E40AF;           /* Blue text */
  --info: #3B82F6;                /* Info icons */
  --info-light: #DBEAFE;          /* Info backgrounds */
  
  /* Legacy Status Mapping */
  --status-new: #7C3AED;
  --status-pending: #D97706;
  --status-approved: --success-dark;
  --status-denied: --danger-dark;
  --status-onboarding: --info-dark;
  --status-active: --success-dark;
  --status-inactive: --text-tertiary;
  
  /* Borders & Separation - Visible but subtle */
  --border-light: #E5E1DB;        /* Light borders - cards */
  --border-medium: #D8D2CA;       /* Medium borders - inputs */
  --border-strong: #C4BCB2;       /* Strong borders - emphasis */
  --border-focus: --brand-primary; /* Focus states */
  
  /* Shadows - Soft but defined */
  --shadow-xs: 0 1px 2px rgba(45, 41, 36, 0.05);
  --shadow-sm: 0 1px 3px rgba(45, 41, 36, 0.08);
  --shadow-md: 0 4px 6px rgba(45, 41, 36, 0.1);
  --shadow-lg: 0 10px 15px rgba(45, 41, 36, 0.12);
  --shadow-xl: 0 20px 25px rgba(45, 41, 36, 0.15);
  
  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px - captions, labels */
  --text-sm: 0.875rem;   /* 14px - secondary text */
  --text-base: 1rem;     /* 16px - body */
  --text-lg: 1.125rem;   /* 18px - large body */
  --text-xl: 1.25rem;    /* 20px - small headings */
  --text-2xl: 1.5rem;    /* 24px - headings */
  --text-3xl: 1.875rem;  /* 30px - large headings */
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Spacing */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Z-index scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-popover: 400;
  --z-tooltip: 500;
}

/* ============================================
   BASE RESET WITH ACCESSIBLE DEFAULTS
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-page);
  min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY - ACCESSIBLE HIERARCHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: var(--font-semibold);
  line-height: 1.3;
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

/* Text hierarchy utilities */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-placeholder { color: var(--text-placeholder); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* ============================================
   CARDS - CLEAR SEPARATION
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

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

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================
   BUTTONS - HIGH CONTRAST STATES
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.5;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-primary-light), 0 0 0 5px var(--brand-primary);
}

/* Primary Button */
.btn-primary {
  background: var(--brand-primary);
  color: var(--text-inverse);
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

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

/* Success Button */
.btn-success {
  background: var(--success-dark);
  color: var(--text-inverse);
  border-color: var(--success-dark);
}

.btn-success:hover {
  background: #14532D;
  border-color: #14532D;
}

/* Danger Button */
.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
}

/* Ghost/Text Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Disabled State - Never use opacity alone */
.btn:disabled,
.btn.disabled {
  background: var(--border-light) !important;
  color: var(--text-placeholder) !important;
  border-color: var(--border-light) !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Size variants */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}

/* ============================================
   FORMS - ACCESSIBLE INPUTS
   ============================================ */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.form-label-required::after {
  content: " *";
  color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Input sizes */
.form-input-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.form-input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
}

/* ============================================
   SIDEBAR - PREMIUM NAVIGATION
   ============================================
   Professional healthcare SaaS sidebar styling
   with fixed width, no overflow, and premium feel
*/

.sidebar {
  background: #0F172A; /* Deep slate - premium dark */
  color: #E2E8F0;
  width: 260px;
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1E293B;
  overflow-x: hidden; /* Prevent horizontal scroll */
  overflow-y: auto; /* Allow vertical scroll if needed */
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0F172A;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: #0F172A;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

/* Branding Section */
.sidebar-branding {
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.sidebar-logo i {
  font-size: 1.5em;
  margin: 0;
}

.sidebar-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* Allow text truncation */
}

.sidebar-company {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: #F8FAFC;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-product {
  font-size: var(--text-xs);
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--font-semibold);
  line-height: 1.2;
}

/* Navigation Container */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* Navigation Items */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: #94A3B8;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item i {
  font-size: 1.25em;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  margin: 0;
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: #1E293B;
  color: #F1F5F9;
}

.nav-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--brand-primary);
}

.nav-item.active {
  background: rgba(43, 107, 124, 0.15);
  color: var(--brand-primary);
  font-weight: var(--font-semibold);
  border-left: 3px solid var(--brand-primary);
  margin-left: -3px;
  padding-left: calc(var(--space-4) + 3px);
}

.nav-item.active:hover {
  background: rgba(43, 107, 124, 0.25);
}

/* Footer Section */
.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid #1E293B;
  flex-shrink: 0;
  background: #0F172A;
  overflow-x: hidden;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: #1E293B;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #334155 0%, #1E293B 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.user-avatar i {
  font-size: 1.25em;
  margin: 0;
}

.user-details {
  min-width: 0;
  overflow: hidden;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #F1F5F9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--text-xs);
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  color: #94A3B8;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  overflow: hidden;
}

.logout-btn i {
  font-size: 1.25em;
  margin: 0;
  flex-shrink: 0;
}

.logout-btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn:hover {
  background: #1E293B;
  border-color: #475569;
  color: #F1F5F9;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-toggle {
    display: flex;
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 101;
    background: #0F172A;
    color: #E2E8F0;
    border: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-xl);
  }
}

/* ============================================
   TABLES - READABLE DATA
   ============================================ */

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}

.table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 2px solid var(--border-medium);
}

.table td {
  padding: var(--space-4);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table tr:hover td {
  background: var(--bg-hover);
}

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

/* ============================================
   STATUS BADGES - CLEAR INDICATORS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1.4;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.badge-info {
  background: var(--info-light);
  color: var(--info-dark);
}

.badge-neutral {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* ============================================
   ALERTS - HIGH VISIBILITY
   ============================================ */

.alert {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid transparent;
}

.alert-icon {
  flex-shrink: 0;
  font-size: var(--text-xl);
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.alert-message {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.alert-success {
  background: var(--success-light);
  border-left-color: var(--success);
}

.alert-success .alert-icon {
  color: var(--success-dark);
}

.alert-warning {
  background: var(--warning-light);
  border-left-color: var(--warning);
}

.alert-warning .alert-icon {
  color: var(--warning-dark);
}

.alert-danger {
  background: var(--danger-light);
  border-left-color: var(--danger);
}

.alert-danger .alert-icon {
  color: var(--danger-dark);
}

.alert-info {
  background: var(--info-light);
  border-left-color: var(--info);
}

.alert-info .alert-icon {
  color: var(--info-dark);
}

/* ============================================
   EMPTY STATES - VISIBLE BUT SUBDUED
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  color: var(--text-tertiary);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================
   LOADING STATES - NEVER INVISIBLE
   ============================================ */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  color: var(--text-secondary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-light) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ============================================
   FOCUS VISIBLE - ACCESSIBILITY
   ============================================ */

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

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   REDUCED MOTION - ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .spinner {
    animation: none;
    border-top-color: var(--text-tertiary);
  }
}

/* ============================================
   PHOSPHOR ICON SYSTEM
   ============================================
   Clean, professional healthcare/admin icons
   Use: <i class="ph ph-[icon-name]"></i>
   
   Common icons:
   - ph-squares-four (dashboard)
   - ph-user-plus (applications)
   - ph-handshake (care requests)
   - ph-heartbeat (caregivers)
   - ph-users (clients)
   - ph-calendar (schedules)
   - ph-clock (timesheets)
   - ph-clipboard-text (visit updates)
   - ph-gear (settings)
   - ph-sign-out (logout)
   - ph-user (avatar)
*/

.ph {
  font-size: 1.25em;
  vertical-align: middle;
  line-height: 1;
}

.ph-sm { font-size: 1em; }
.ph-lg { font-size: 1.5em; }
.ph-xl { font-size: 2em; }

/* Icon in buttons */
.btn .ph,
.nav-item .ph {
  font-size: 1.25em;
  margin-right: 0.5em;
}

/* Icon only buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-icon .ph {
  margin: 0;
  font-size: 1.25em;
}

/* ============================================
   UNIFIED CALENDAR SYSTEM
   ============================================
   Both mini calendar and full scheduling calendar
   share these styles for visual consistency.
*/

/* Calendar Container */
.calendar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.calendar-container.compact {
  border-radius: var(--radius-md);
}

/* Calendar Header */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.calendar-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.calendar-nav {
  display: flex;
  gap: var(--space-2);
}

.calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.calendar-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Day Headers (Sun, Mon, Tue...) */
.calendar-day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.calendar-day-header {
  padding: var(--space-3) var(--space-2);
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-secondary);
}

.calendar-day-header.weekend {
  color: var(--text-tertiary);
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-light);
}

/* Calendar Day Cell */
.calendar-day {
  position: relative;
  min-height: 100px;
  padding: var(--space-2);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-day.compact {
  min-height: auto;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-2);
}

.calendar-day:hover {
  background: var(--bg-hover);
}

.calendar-day.other-month {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

.calendar-day.other-month:hover {
  background: var(--bg-hover);
}

.calendar-day.weekend {
  background: var(--bg-secondary);
}

/* Today Highlight */
.calendar-day.today {
  background: var(--brand-primary-light);
  box-shadow: inset 0 0 0 2px var(--brand-primary);
}

.calendar-day.today .calendar-day-number {
  background: var(--brand-primary);
  color: var(--text-inverse);
  font-weight: var(--font-bold);
}

.calendar-day.compact.today {
  background: var(--brand-primary-light);
}

/* Selected Date */
.calendar-day.selected {
  box-shadow: inset 0 0 0 2px var(--brand-secondary);
}

.calendar-day.selected .calendar-day-number {
  background: var(--brand-secondary);
  color: var(--text-inverse);
}

/* Day Number */
.calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-2);
}

.calendar-day.compact .calendar-day-number {
  width: 24px;
  height: 24px;
  font-size: var(--text-xs);
  margin-bottom: var(--space-1);
}

.calendar-day.other-month .calendar-day-number {
  color: var(--text-tertiary);
}

/* Events Container */
.calendar-events {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow: hidden;
}

.calendar-events.compact {
  flex-direction: row;
  gap: 2px;
  margin-top: auto;
}

/* Event Pills - Unified Status Colors */
.calendar-event {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-event:hover {
  filter: brightness(0.95);
  transform: translateX(1px);
}

/* Status-based Event Colors */
.calendar-event.scheduled {
  background: var(--info-light);
  color: var(--info-dark);
  border-left-color: var(--info);
}

.calendar-event.confirmed {
  background: var(--info-light);
  color: var(--info-dark);
  border-left-color: var(--info);
}

.calendar-event.in_progress {
  background: var(--warning-light);
  color: var(--warning-dark);
  border-left-color: var(--warning);
}

.calendar-event.completed {
  background: var(--success-light);
  color: var(--success-dark);
  border-left-color: var(--success);
}

.calendar-event.cancelled {
  background: var(--danger-light);
  color: var(--danger-dark);
  border-left-color: var(--danger);
  text-decoration: line-through;
  opacity: 0.8;
}

.calendar-event.no_show {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  border-left-color: var(--text-tertiary);
}

.calendar-event.unassigned {
  background: var(--warning-light);
  color: var(--warning-dark);
  border-left-color: var(--warning);
  border-style: dashed;
}

/* Compact Event Indicators (for mini calendar) */
.calendar-event-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.calendar-event-dot.scheduled,
.calendar-event-dot.confirmed { background: var(--info); }

.calendar-event-dot.in_progress { background: var(--warning); }

.calendar-event-dot.completed { background: var(--success); }

.calendar-event-dot.cancelled { background: var(--danger); }

.calendar-event-dot.no_show { background: var(--text-tertiary); }

.calendar-event-dot.unassigned { background: var(--warning); }

/* More Events Indicator */
.calendar-more-events {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
  padding: var(--space-1);
  cursor: pointer;
}

.calendar-more-events:hover {
  color: var(--text-secondary);
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.calendar-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

/* Week View Styles */
.calendar-week-container {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-week-time-slot {
  background: var(--bg-card);
  padding: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: right;
  border-right: 1px solid var(--border-light);
}

.calendar-week-day {
  background: var(--bg-card);
  min-height: 60px;
  padding: var(--space-2);
}

.calendar-week-day-header {
  text-align: center;
  padding: var(--space-3) var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.calendar-week-day-header.weekend {
  color: var(--text-tertiary);
}

/* Day View Styles */
.calendar-day-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.calendar-day-header-large {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--border-light);
}

.calendar-day-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.calendar-day-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Time Slot in Day View */
.calendar-time-slot {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

.calendar-time-slot:last-child {
  border-bottom: none;
}

.calendar-time-label {
  width: 60px;
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  text-align: right;
}

.calendar-time-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Current Time Indicator */
.calendar-current-time {
  position: relative;
  height: 2px;
  background: var(--danger);
  margin: var(--space-2) 0;
}

.calendar-current-time::before {
  content: '';
  position: absolute;
  left: -6px;
  top: -4px;
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: var(--radius-full);
}

/* Calendar Empty State */
.calendar-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
}

.calendar-empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  color: var(--text-tertiary);
}

.calendar-empty-state-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .calendar-day {
    min-height: 80px;
    padding: var(--space-1);
  }
  
  .calendar-day.compact {
    min-height: 40px;
  }
  
  .calendar-day-number {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
  }
  
  .calendar-event {
    font-size: 10px;
    padding: 1px var(--space-1);
  }
  
  .calendar-week-container {
    grid-template-columns: 40px repeat(7, 1fr);
  }
  
  .calendar-week-time-slot {
    font-size: 10px;
  }
}
