/* ===========================================================================
   Man Cave Health — Admin Panel Styles
   Uses brand palette + Outfit font matching public site
   =========================================================================== */

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/outfit-300.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/outfit-400.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/outfit-500.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/outfit-600.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/outfit-700.woff2") format("woff2");
}

:root {
  /* Brand */
  --blue:    #17599a;
  --navy:    #1b2673;
  --cyan:    #19a1c8;
  --orange:  #ee8e11;
  --ink:     #141414;
  --text:    #363636;
  --muted:   #6b7280;
  --bg:      #f4f6fb;
  --surface: #ffffff;
  --border:  #e4e8f0;

  --success: #10b981;
  --warning: #f59e0b;
  --error:   #ef4444;
  --info:    #3b82f6;

  --font:    "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:    0 2px 8px rgba(20, 20, 20, 0.06);
  --shadow-lg: 0 10px 30px rgba(20, 20, 20, 0.08);

  --sidebar-w: 260px;
  --topbar-h:  64px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--orange); }

button { font-family: inherit; cursor: pointer; border: 0; background: transparent; }

img, svg { display: block; max-width: 100%; }

/* ─────────── Layout ─────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ─────────── Sidebar ─────────── */
.sidebar {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__brand img {
  height: 36px;
  filter: brightness(0) invert(1);
}

.sidebar__brand small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar__nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.sidebar__section-title {
  padding: 12px 24px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar__link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar__link.is-active {
  color: #fff;
  background: rgba(25, 161, 200, 0.12);
  border-left-color: var(--cyan);
}

.sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__link-badge {
  margin-left: auto;
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.sidebar__footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-name {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar__logout {
  color: rgba(255, 255, 255, 0.4);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.sidebar__logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

/* ─────────── Main ─────────── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  background: var(--surface);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.topbar__title small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search input {
  width: 280px;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus {
  outline: 0;
  border-color: var(--cyan);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(25, 161, 200, 0.15);
}

.search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: var(--bg);
  border-color: var(--cyan);
  color: var(--blue);
}

.icon-btn__dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ─────────── Content ─────────── */
.content { padding: 32px; flex: 1; }

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.page-header__lead {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-header__actions { display: flex; gap: 10px; }

/* ─────────── Buttons ─────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn--primary {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.btn--primary:hover { background: #d77c0c; color: #fff; }

.btn--secondary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn--secondary:hover { background: #144b85; color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover {
  background: var(--bg);
  border-color: var(--cyan);
  color: var(--blue);
}

.btn--danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn--danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
}

.btn--sm { padding: 7px 12px; font-size: 12px; }

.btn svg { width: 16px; height: 16px; }

/* ─────────── Stats cards ─────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .stats { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--surface);
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.stat-card__value {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
}

.stat-card__trend--up { color: var(--success); }
.stat-card__trend--down { color: var(--error); }

.stat-card__icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stat-card__icon--orange { background: rgba(238, 142, 17, 0.12); color: var(--orange); }
.stat-card__icon--blue   { background: rgba(23, 89, 154, 0.12); color: var(--blue); }
.stat-card__icon--cyan   { background: rgba(25, 161, 200, 0.12); color: var(--cyan); }
.stat-card__icon--green  { background: rgba(16, 185, 129, 0.12); color: var(--success); }

.stat-card__icon svg { width: 22px; height: 22px; }

/* ─────────── Cards / Panels ─────────── */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 28px;
}

.panel__header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.panel__body { padding: 24px; }
.panel__body--flush { padding: 0; }

/* Two-column grid for dashboard rows */
.row-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

@media (max-width: 1000px) { .row-grid { grid-template-columns: 1fr; } }

/* ─────────── Table ─────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 14px 24px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
}

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

.table tr:hover td { background: rgba(244, 246, 251, 0.5); }

.table__name {
  font-weight: 600;
  color: var(--ink);
}

.table__email {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.table__amount {
  font-weight: 700;
  color: var(--ink);
}

/* ─────────── Badges ─────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 9999px;
}

.badge--success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge--warning { background: rgba(245, 158, 11, 0.14); color: #a35a04; }
.badge--error   { background: rgba(239, 68, 68, 0.12);  color: var(--error); }
.badge--info    { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.badge--neutral { background: var(--bg); color: var(--muted); }

/* ─────────── Activity feed ─────────── */
.activity {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.activity li:last-child { border-bottom: 0; padding-bottom: 0; }

.activity__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity__icon svg { width: 16px; height: 16px; }

.activity__text { font-size: 13px; color: var(--text); }
.activity__text strong { color: var(--ink); font-weight: 600; }
.activity__time { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ─────────── Form ─────────── */
.form-field { margin-bottom: 18px; }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-textarea { min-height: 160px; resize: vertical; font-family: inherit; }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: 0;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(25, 161, 200, 0.15);
}

.form-grid { display: grid; gap: 18px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .form-grid--2 { grid-template-columns: 1fr; } }

.form-help { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-actions__spacer { flex: 1; }

/* ─────────── Filter bar ─────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-pill {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-pill:hover {
  border-color: var(--cyan);
  color: var(--blue);
}

.filter-pill.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ─────────── Login ─────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) { .login-shell { grid-template-columns: 1fr; } }

.login-side {
  background: linear-gradient(180deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff;
  padding: 60px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (max-width: 900px) { .login-side { display: none; } }

.login-side__logo img { height: 48px; filter: brightness(0) invert(1); }

.login-side__copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
}

.login-side__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 12px;
}

.login-side h1 {
  font-size: 38px;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 16px;
}

.login-side p { font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, 0.85); }

.login-side__ribbon {
  position: absolute;
  bottom: -60px;
  right: -60px;
  width: 300px;
  opacity: 0.16;
}

.login-form-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}

.login-form {
  width: 100%;
  max-width: 380px;
}

.login-form__brand-mobile {
  display: none;
  text-align: center;
  margin-bottom: 32px;
}
.login-form__brand-mobile img { height: 40px; margin: 0 auto; }

@media (max-width: 900px) { .login-form__brand-mobile { display: block; } }

.login-form h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.login-form__lead {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
}

.login-form__forgot {
  text-align: right;
  font-size: 12px;
  color: var(--blue);
  margin-top: -10px;
  margin-bottom: 18px;
}

.login-form__forgot a { font-weight: 600; }

.login-form__btn { width: 100%; padding: 13px; font-size: 14px; }

.login-form__footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ─────────── Empty state ─────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty svg { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--border); }
.empty h3 { font-size: 16px; color: var(--ink); margin: 0 0 6px; }
.empty p  { margin: 0 0 16px; font-size: 13px; }

/* ─────────── Avatar ─────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─────────── Toast (success/error notifications) ─────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─────────── Mobile sidebar toggle ─────────── */
.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-backdrop.is-visible { display: block; opacity: 1; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }

  /* Topbar: hide the desktop search, tighten layout */
  .topbar { padding: 0 16px; height: 60px; }
  .topbar__title { font-size: 16px; }
  .topbar__title small { font-size: 11px; }
  .topbar__right { gap: 8px; }
  .search { display: none; }

  /* Page header: stack heading + actions */
  .content { padding: 20px 16px; }
  .page-header { gap: 12px; margin-bottom: 20px; }
  .page-header h1 { font-size: 22px; }
  .page-header__actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-header__actions .btn { flex: 1 1 auto; }

  /* Stat cards: tighter padding, icon doesn't crowd value */
  .stat-card { padding: 18px; }
  .stat-card__value { font-size: 26px; }
  .stat-card__icon { top: 14px; right: 14px; width: 34px; height: 34px; }
  .stat-card__icon svg { width: 18px; height: 18px; }

  /* Tables scroll horizontally inside their panel */
  .panel__body--flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  .table th, .table td { padding: 12px 14px; }

  /* Activity feed compact */
  .activity li { gap: 10px; }

  /* Forms: full-width inputs / split grids */
  .row-grid[style*="2fr 1fr"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .content { padding: 16px 12px; }
  .page-header h1 { font-size: 20px; }
  .page-header__lead { font-size: 13px; }
  .stat-card { padding: 16px; }
  .stat-card__value { font-size: 22px; }
  .panel__header { padding: 14px 16px; }
  .panel__body { padding: 16px; }
  .table th, .table td { padding: 10px 12px; font-size: 12px; }
  .btn { padding: 9px 14px; font-size: 12px; }
}
