/* ============================================
   Vitality — Custom Design System
   Light mode, Geist font, teal accent
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', monospace;

  /* Vitality Chiropractic brand teal — matched from familyvitality.net */
  --accent: #43897d;
  --accent-light: #f0f9f7;
  --accent-hover: #377167;

  /* Neutrals — warm off-white to match the practice's warmth */
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f2f0ed;
  --border: #e8e4df;
  --border-strong: #d4cfc9;

  /* Text */
  --text-primary: #1a1614;
  --text-secondary: #4a453f;
  --text-muted: #9c9189;

  /* Status */
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --error: #dc2626;
  --error-bg: #fef2f2;
}

/* Base */
html, body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ============ NAVBAR ============ */
.vt-navbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.vt-navbar-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
}

.vt-logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
  margin-right: 2rem;
}

.vt-logo svg {
  color: var(--accent);
}

.vt-nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.vt-nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  transition: background 150ms ease, color 150ms ease;
  letter-spacing: -0.01em;
}

.vt-nav-link:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.vt-nav-link.active {
  background: var(--surface-3);
  color: var(--text-primary);
  font-weight: 600;
}

.vt-nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  transition: background 150ms ease;
  position: relative;
}

.vt-nav-user:hover {
  background: var(--surface-3);
}

.vt-nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============ LAYOUT ============ */
.vt-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ============ CARDS ============ */
.vt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: box-shadow 150ms ease;
}

.vt-card:hover {
  box-shadow: 0 4px 16px -4px rgba(0,0,0,0.08);
}

.vt-card-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

/* ============ BUTTONS ============ */
.vt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.vt-btn:active {
  transform: scale(0.98);
}

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

.vt-btn-primary:hover {
  background: var(--accent-hover);
}

.vt-btn-secondary {
  background: var(--surface-3);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

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

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

.vt-btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fecaca;
}

.vt-btn-danger:hover {
  background: #fee2e2;
}

.vt-btn-sm {
  font-size: 0.8125rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 6px;
}

.vt-btn-xs {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 5px;
}

/* ============ FORMS ============ */
.vt-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  letter-spacing: -0.005em;
}

.vt-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.5625rem 0.875rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  -webkit-appearance: none;
}

.vt-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.vt-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.vt-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.5625rem 0.875rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.vt-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.vt-select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.5625rem 2rem 0.5625rem 0.875rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.vt-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.vt-error-text {
  font-size: 0.8125rem;
  color: var(--error);
  margin-top: 0.375rem;
}

.vt-field {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ============ BADGES ============ */
.vt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  letter-spacing: 0;
}

.vt-badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.vt-badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.vt-badge-neutral {
  background: var(--surface-3);
  color: var(--text-secondary);
}

.vt-badge-accent {
  background: var(--accent-light);
  color: var(--accent);
}

/* ============ TABLE ============ */
.vt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vt-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
}

.vt-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.vt-table tr:hover td {
  background: var(--surface-2);
}

/* ============ DASHBOARD SPECIFIC ============ */
.vt-action-card {
  background: var(--accent);
  border-radius: 14px;
  padding: 1.5rem;
  color: white;
}

.vt-action-card .vt-select,
.vt-action-card .vt-input,
.vt-action-card .vt-textarea {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.25);
  color: white;
}

.vt-action-card .vt-select:focus,
.vt-action-card .vt-input:focus,
.vt-action-card .vt-textarea:focus {
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15);
}

.vt-action-card .vt-select option {
  background: var(--accent-hover);
  color: white;
}

.vt-action-card .vt-label {
  color: rgba(255,255,255,0.75);
}

.vt-action-card input::placeholder,
.vt-action-card textarea::placeholder {
  color: rgba(255,255,255,0.5);
}

.vt-action-card .vt-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

/* ============ DIVIDERS ============ */
.vt-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ============ PAGE HEADERS ============ */
.vt-page-header {
  margin-bottom: 1.5rem;
}

.vt-page-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.vt-page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ============ UTILITY ============ */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vt-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.vt-empty-state p {
  font-size: 0.9375rem;
  margin-top: 0.5rem;
}

/* ============ HTMX INDICATOR ============ */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

/* ============ DROPDOWN ============ */
.vt-dropdown {
  position: relative;
  display: inline-block;
}

.vt-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.12);
  min-width: 140px;
  z-index: 100;
  overflow: hidden;
  padding: 0.25rem;
}

.vt-dropdown:focus-within .vt-dropdown-menu,
.vt-dropdown:hover .vt-dropdown-menu {
  display: block;
}

.vt-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background 100ms ease;
}

.vt-dropdown-item:hover {
  background: var(--surface-3);
}

.vt-dropdown-item.danger {
  color: var(--error);
}

.vt-dropdown-item.danger:hover {
  background: var(--error-bg);
}

/* ============ TOAST ============ */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.vt-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.12);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: toast-in 200ms ease;
  max-width: 320px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(1rem); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============ SEARCH ============ */
.vt-search-wrapper {
  position: relative;
}

.vt-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.vt-search-input {
  padding-left: 2.25rem;
}
