/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --primary-light: #EEF0FF;
  --secondary: #4ECDC4;
  --success: #2ECC71;
  --warning: #F39C12;
  --danger: #E74C3C;
  --info: #3498DB;
  --bg: #F7F8FC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1A202C;
  --text-muted: #718096;
  --text-light: #A0AEC0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.05);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-width: 240px;
  --header-height: 64px;
}

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ─── Typography ─────────────────────────────────────────────────────────────── */
h1 { font-size: 1.875rem; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-lg { font-size: 1.125rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Spacing ─────────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: .5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.p-2 { padding: .5rem; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { margin: 0; }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }

/* ─── Buttons ─────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .875rem; cursor: pointer; border: 1.5px solid transparent; transition: all .15s; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #27AE60; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background: #E67E22; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #C0392B; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-light); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: .5rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }

/* ─── Form ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .4rem; }
.form-group label .required { color: var(--danger); margin-left: 2px; }
.form-control { width: 100%; padding: .55rem .85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.15); }
.form-control:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .875rem; }
table thead th { padding: .75rem 1rem; text-align: left; font-weight: 600; color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; background: var(--bg); border-bottom: 1px solid var(--border); }
table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
table tbody tr:last-child { border-bottom: none; }
table tbody tr:hover { background: var(--bg); }
table tbody td { padding: .875rem 1rem; vertical-align: middle; color: var(--text); }

/* ─── Badge ──────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #D4EFDF; color: #1E8449; }
.badge-warning { background: #FDEBD0; color: #B7770D; }
.badge-danger { background: #FADBD8; color: #C0392B; }
.badge-info { background: #D6EAF8; color: #1F618D; }
.badge-gray { background: #EAECEE; color: #566573; }

/* ─── Alert ──────────────────────────────────────────────────────────────────── */
.alert { padding: .875rem 1.25rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; border-left: 4px solid; }
.alert-success { background: #D4EFDF; border-color: var(--success); color: #1E8449; }
.alert-danger { background: #FADBD8; border-color: var(--danger); color: #C0392B; }
.alert-warning { background: #FDEBD0; border-color: var(--warning); color: #B7770D; }
.alert-info { background: #D6EAF8; border-color: var(--info); color: #1F618D; }
.hidden { display: none !important; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: modalIn .2s ease; }
.modal-lg { max-width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }
.btn-close { background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--text-muted); padding: .25rem; border-radius: 4px; }
.btn-close:hover { color: var(--text); background: var(--bg); }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: var(--text); color: #fff; padding: .875rem 1.25rem; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; max-width: 340px; display: flex; align-items: center; gap: .75rem; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ─── Avatar ─────────────────────────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; font-size: .875rem; flex-shrink: 0; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-sm { width: 28px; height: 28px; font-size: .75rem; }

/* ─── Status colors ──────────────────────────────────────────────────────────── */
.status-pending { color: #B7770D; }
.status-confirmed { color: #1E8449; }
.status-cancelled { color: #C0392B; }
.status-completed { color: #1F618D; }
.status-no_show { color: #7D3C98; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
}
