/* css/style.css */

/* ── Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  --brand:         #1a7f5a;
  --brand-light:   #e8f7f1;
  --brand-dark:    #0f5c40;
  --brand-muted:   #52b78833;
  --surface:       #ffffff;
  --surface-2:     #f7f9f8;
  --surface-3:     #eef2f0;
  --border:        #e2e8e5;
  --border-strong: #c8d4ce;
  --text-1:        #0d1f17;
  --text-2:        #3d5448;
  --text-3:        #7a9387;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:     0 12px 28px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     22px;
  --sidebar-w:     248px;
  --topbar-h:      60px;
  --font-head:     'Sora', sans-serif;
  --font-body:     'DM Sans', sans-serif;
  --transition:    .18s cubic-bezier(.4,0,.2,1);
  /* Status colors */
  --c-pending:  #f59e0b;
  --c-confirm:  #10b981;
  --c-reject:   #ef4444;
  --c-cancel:   #6b7280;
  --c-active:   #10b981;
  --c-inactive: #ef4444;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea {
  font-family: var(--font-body);
  font-size: 14px;
}
img { max-width: 100%; }

/* ── Layout Shell ───────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  transition: transform var(--transition);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  flex-shrink: 0;
}
.sidebar-logo-text { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--text-1); }
.sidebar-logo-sub  { font-size: 10px; color: var(--text-3); letter-spacing: .04em; }

.sidebar-nav { padding: 12px 12px 0; flex: 1; overflow-y: auto; }
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 8px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 400;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .7; }
.nav-link:hover { background: var(--surface-3); color: var(--text-1); }
.nav-link.active {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 500;
}
.nav-link.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.warn { background: #f59e0b; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: default;
}
.user-chip-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.user-chip-name  { font-size: 13px; font-weight: 500; }
.user-chip-role  { font-size: 11px; color: var(--text-3); }
.logout-btn {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 17px;
  display: flex; align-items: center;
  transition: color var(--transition);
}
.logout-btn:hover { color: var(--c-reject); }

/* Sidebar overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 190;
  background: rgba(0,0,0,.35);
}
#sidebar-overlay.overlay-visible { display: block; }

/* ── Main Content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; }
.topbar-spacer { flex: 1; }
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 4px;
  color: var(--text-2);
}
.sidebar-toggle svg { width: 22px; height: 22px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-3);
  width: 210px;
}

/* ── Page Content ───────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header-title { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.page-header-sub { font-size: 13px; color: var(--text-3); margin-top: 1px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--brand); color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--surface-3); }
.btn-danger  { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.btn-success:hover { background: #a7f3d0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; gap: 0; }
.btn-icon svg { width: 16px; height: 16px; }

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px; flex-wrap: wrap;
}
.card-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; }
.card-body  { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 4px;
}
.stat-icon.green  { background: #d1fae5; color: #065f46; }
.stat-icon.blue   { background: #dbeafe; color: #1e40af; }
.stat-icon.amber  { background: #fef3c7; color: #92400e; }
.stat-icon.red    { background: #fee2e2; color: #991b1b; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 400; }
.stat-value { font-family: var(--font-head); font-size: 28px; font-weight: 700; line-height: 1; }
.stat-delta { font-size: 11.5px; display: flex; align-items: center; gap: 3px; }
.delta-up   { color: #059669; }
.delta-dn   { color: #dc2626; }
.stat-card::after {
  content: '';
  position: absolute;
  right: -14px; bottom: -14px;
  width: 72px; height: 72px;
  border-radius: 50%;
  opacity: .06;
}
.stat-card.green::after { background: #10b981; }
.stat-card.blue::after  { background: #3b82f6; }
.stat-card.amber::after { background: #f59e0b; }
.stat-card.red::after   { background: #ef4444; }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 550px; }
th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
  color: var(--text-1);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }
.avatar-cell { display: flex; align-items: center; gap: 10px; }
.table-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}
.avatar-initials {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
  color: #fff;
}
.cell-name  { font-weight: 500; font-size: 13.5px; }
.cell-sub   { font-size: 11.5px; color: var(--text-3); }
.action-cell { display: flex; gap: 6px; align-items: center; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-amber   { background: #fef3c7; color: #92400e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: var(--surface-3); color: var(--text-3); }
.badge-purple  { background: #ede9fe; color: #5b21b6; }

/* ── Form Controls ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-1);
  font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-muted);
}
.form-control.error { border-color: var(--c-reject); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { font-size: 11.5px; color: var(--c-reject); margin-top: 3px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.45);
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 20px; line-height: 1;
  padding: 2px;
}
.modal-close:hover { color: var(--text-1); }
.modal-body   { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ── Search / Filter bar ────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 180px; max-width: 300px;
}
.search-input-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-3);
}
.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--brand); }
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer; outline: none;
  min-width: 130px;
}

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; align-items: center; gap: 9px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  max-width: 360px;
}
.toast-visible { opacity: 1; transform: none; }
.toast-success { background: #064e3b; color: #d1fae5; }
.toast-error   { background: #7f1d1d; color: #fecaca; }
.toast-info    { background: #1e3a5f; color: #bfdbfe; }
.toast-icon    { font-size: 16px; flex-shrink: 0; }

/* ── Global Spinner ─────────────────────────────────────── */
#global-spinner {
  display: none;
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(255,255,255,.6);
  align-items: center; justify-content: center;
}
.spinner-ring {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Photo preview ──────────────────────────────────────── */
.photo-preview-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.photo-preview {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  border: 2px solid var(--border);
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 20px;
}
.empty-state svg { width: 48px; height: 48px; color: var(--text-3); margin: 0 auto 12px; display: block; }
.empty-state-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.empty-state-sub   { font-size: 13px; color: var(--text-3); }

/* ── Tabs ───────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 16px;
}
.tab-btn {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 12.5px; cursor: pointer;
  border: none; background: none;
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
}
.tab-btn.active {
  background: var(--surface);
  color: var(--text-1);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* ── Grid layouts ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── Rating stars ───────────────────────────────────────── */
.stars { color: #f59e0b; letter-spacing: 1px; font-size: 13px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-248px);
    width: 248px;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .topbar-search { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-input-wrap { max-width: 100%; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}