/* =========================================================================
   Evoke Photo Manager — Design System
   A clinical, trustworthy interface for staff managing patient progress
   photos. Built around the brand's deep clinical green, a calm neutral
   canvas, and a "before/after" split motif that echoes what this tool
   actually does.
   ========================================================================= */

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

:root {
  /* Brand */
  --brand-900: #06251d;
  --brand-700: #0b4a3a;
  --brand-600: #0f6b52;
  --brand-500: #128c63;
  --brand-300: #6fe3b4;
  --brand-100: #e3f8ee;

  /* Neutrals */
  --ink-900: #0f172a;
  --ink-700: #33414f;
  --ink-500: #64748b;
  --ink-300: #94a3b8;
  --line: #e3e8e6;
  --line-strong: #cbd3d0;
  --canvas: #f3f6f5;
  --surface: #ffffff;

  /* Status */
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --warning: #a15c00;
  --warning-bg: #fff4e0;
  --success: #0f6b3f;
  --success-bg: #e6f6ec;
  --info: #0b5fa5;
  --info-bg: #e8f2fb;

  /* Type */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  /* Shape / elevation */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.14);

  --nav-height: 68px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  background-color: var(--canvas);
  color: var(--ink-900);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* -------------------------------------------------------------------------
   Signature motif: a two-tone "split" rule, standing in for the
   before/after divide that is the whole point of this product.
   ------------------------------------------------------------------------- */
.split-rule {
  height: 3px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-700) 0 50%, var(--brand-300) 50% 100%);
}

/* =============================== Navbar ================================ */
.app-navbar {
  height: var(--nav-height);
  background: var(--brand-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 1.25rem;
}

.app-navbar .navbar-brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.01em;
}

.app-navbar .navbar-brand .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-300), var(--brand-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-900);
  font-size: 1rem;
  flex: none;
}

.app-navbar .nav-link {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-navbar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.app-navbar .nav-link.active {
  color: #fff;
  background: rgba(111, 227, 180, 0.16);
}

.app-navbar .user-chip {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-navbar .user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.app-navbar .btn-logout {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
}

.app-navbar .btn-logout:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.navbar-spacer { height: var(--nav-height); }

/* =============================== Layout ================================ */
.page-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1.5rem;
}

.page-header .page-subtitle {
  color: var(--ink-500);
  font-size: 0.92rem;
  margin: 0;
}

/* =============================== Cards ================================= */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.card .card-body { padding: 1.5rem; }

.card-title { font-size: 1.05rem; margin-bottom: 0.9rem; }

.stat-card {
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  color: var(--brand-700);
  line-height: 1;
}

/* =============================== Buttons ================================ */
.btn {
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  border: 1px solid transparent;
  transition: transform 0.06s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-primary:disabled { background: var(--ink-300); border-color: var(--ink-300); }

.btn-success { background: var(--brand-500); border-color: var(--brand-500); }
.btn-success:hover { background: var(--brand-600); border-color: var(--brand-600); }

.btn-outline-primary { color: var(--brand-700); border-color: var(--line-strong); background: #fff; }
.btn-outline-primary:hover { background: var(--brand-100); border-color: var(--brand-500); color: var(--brand-700); }

.btn-outline-secondary { color: var(--ink-700); border-color: var(--line-strong); background: #fff; }
.btn-outline-secondary:hover { background: var(--canvas); }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #8f1e17; border-color: #8f1e17; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: btn-spin 0.6s linear infinite;
}
.btn-outline-primary.is-loading::after,
.btn-outline-secondary.is-loading::after { border-color: rgba(15, 23, 42, 0.25); border-top-color: var(--ink-700); }

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

/* =============================== Forms ================================= */
.form-label { font-weight: 600; font-size: 0.85rem; color: var(--ink-700); margin-bottom: 0.35rem; }

.form-control, .form-select {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font-size: 0.92rem;
  color: var(--ink-900);
  background-color: #fff;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(18, 140, 99, 0.15);
}

.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--danger);
  background-image: none;
}

.field-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.3rem;
  display: none;
}
.field-error.show { display: block; }

.form-control-lg, .btn-lg { border-radius: var(--radius-md); padding: 0.75rem 1.1rem; font-size: 1rem; }

/* =============================== Alerts ================================= */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f3c9c5; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f0dcae; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bfe4cc; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #bcdbf3; }

/* =============================== Badges ================================= */
.badge { font-weight: 600; font-size: 0.75rem; padding: 0.35em 0.65em; border-radius: 999px; }
.bg-primary { background: var(--brand-600) !important; }

/* ============================ Empty states =============================== */
.empty-state {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink-500);
  background: var(--surface);
}
.empty-state .empty-icon {
  font-size: 1.8rem;
  color: var(--brand-300);
  margin-bottom: 0.6rem;
}
.empty-state h6 { color: var(--ink-700); margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.88rem; margin: 0; }

/* ============================ Skeleton loading ============================ */
.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, #eef2f0 37%, var(--line) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* =============================== Tables ================================= */
.table-responsive { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--line); }
.table { margin: 0; }
.table thead th {
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 0.7rem 1rem;
}
.table tbody td { padding: 0.75rem 1rem; vertical-align: middle; font-size: 0.9rem; border-color: var(--line); }
.table-hover tbody tr:hover { background-color: var(--brand-100); }

/* Guest / patient codes rendered in mono for scannability */
.code-chip {
  font-family: var(--font-mono);
  background: var(--canvas);
  border: 1px solid var(--line);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--brand-700);
}

/* ============================ Session timeline ============================ */
.session-timeline { overflow-x: auto; padding-bottom: 0.75rem; scrollbar-width: thin; }
.session-card {
  min-width: 280px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.session-card .split-rule { margin: 0.6rem 0 0.9rem; }

/* =============================== Dropdowns =============================== */
.dropdown-menu {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: 0.4rem;
}
.dropdown-item { border-radius: 8px; font-size: 0.88rem; padding: 0.5rem 0.7rem; }
.dropdown-item:hover { background: var(--brand-100); color: var(--brand-700); }
.dropdown-item:disabled, .dropdown-item.disabled { color: var(--ink-300); }

/* =============================== Misc ==================================== */
.chart-container { position: relative; width: 100%; height: 280px; }
.table-responsive.thin::-webkit-scrollbar,
.session-timeline::-webkit-scrollbar { height: 8px; }
.session-timeline::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }

.quick-action-btn { transition: transform 0.15s ease; }
.quick-action-btn:hover { transform: translateY(-2px); }

@media (max-width: 768px) {
  .page-container { padding: 1.25rem 0.9rem 3rem; }
  .app-navbar .navbar-brand span.brand-text { font-size: 0.95rem; }
}
