/* =========================================================================
   Gym Management System — Design System v4
   Dark bento-card UI, neon-lime accent, icon-only sidebar rail, compact type.
   ========================================================================= */

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

:root {
  --side-w: 76px;
  --brand: #d6ff3f;
  --brand-ink: #12130c;   /* text color placed ON TOP of the lime accent */
  --brand-dim: rgba(214,255,63,0.14);
  --shadow-brand: 0 8px 20px rgba(214,255,63,0.18);
}

:root[data-theme="dark"] {
  --bg: #0a0a0c;
  --surface: #131316;
  --surface-alt: #0f0f12;
  --surface-hover: #1a1b1f;
  --text: #f2f2ef;
  --text-muted: #86868c;
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);
  --navbar-bg: rgba(10,10,12,0.7);

  --success: #4ade80;
  --success-bg: rgba(74,222,128,0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,0.12);
  --danger: #ff5c66;
  --danger-bg: rgba(255,92,102,0.12);
  --info: #60a5fa;
  --info-bg: rgba(96,165,250,0.12);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 56px rgba(0,0,0,0.6);
}

:root[data-theme="light"] {
  --bg: #f1f1ee;
  --surface: #ffffff;
  --surface-alt: #f7f7f5;
  --surface-hover: #ececea;
  --text: #17181a;
  --text-muted: #83848a;
  --border: #e6e6e2;
  --border-strong: #d8d8d3;
  --navbar-bg: rgba(255,255,255,0.75);

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #2563eb;
  --info-bg: #dbeafe;

  --shadow-sm: 0 1px 2px rgba(20,20,20,0.05);
  --shadow-md: 0 8px 24px rgba(20,20,20,0.07);
  --shadow-lg: 0 20px 48px rgba(20,20,20,0.11);
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }

/* ===== Bootstrap variable overrides — makes Bootstrap's own dark-mode
   components (tables, dropdowns, modals, borders) use OUR exact palette
   instead of its generic dark gray defaults. Paired with data-bs-theme="dark"
   set in the page <html> tag. ===== */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-bg: var(--surface-alt);

  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-alt);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-hover);
  --bs-table-hover-color: var(--text);
  --bs-table-active-bg: var(--surface-hover);

  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-color: var(--text);
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--surface-hover);
  --bs-dropdown-link-hover-color: var(--text);
  --bs-dropdown-header-color: var(--text-muted);
  --bs-dropdown-divider-bg: var(--border);

  --bs-modal-bg: var(--surface);
  --bs-modal-color: var(--text);
  --bs-modal-border-color: var(--border);
  --bs-modal-header-border-color: var(--border);
  --bs-modal-footer-border-color: var(--border);

  --bs-form-control-bg: var(--surface-alt);
  --bs-form-select-bg: var(--surface-alt);
  --bs-input-border-color: var(--border);
}

[data-bs-theme="light"] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-table-hover-bg: var(--surface-hover);
  --bs-table-striped-bg: var(--surface-alt);
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-link-hover-bg: var(--surface-hover);
  --bs-modal-bg: var(--surface);
}

body {
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  transition: background .2s ease, color .2s ease;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6,.fw-bold { font-family: 'Plus Jakarta Sans','Inter',sans-serif; letter-spacing: -0.01em; }
h4 { font-size: .92rem; }
h6 { font-size: .74rem; }
a { color: var(--brand); text-decoration: none; }
small, .small { font-size: .71rem; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* ===== Top navbar — slim, dark, minimal ===== */
.top-navbar {
  background: var(--navbar-bg);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  height: 58px;
  position: sticky; top: 0; z-index: 1030;
}
.navbar-brand { font-weight: 700; font-size: .95rem; color: var(--text) !important; display: none; }
@media (max-width: 991.98px) { .navbar-brand { display: flex; } }
.navbar-brand i { color: var(--brand); }

.btn-icon {
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted);
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s ease; font-size: .95rem;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }

/* ===== Layout ===== */
.app-wrapper { display: flex; min-height: calc(100vh - 58px); }

/* ===== Sidebar — icon-only floating rail ===== */
.sidebar {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1rem .5rem;
  display: flex; flex-direction: column; align-items: center;
  transition: transform .2s ease;
  min-height: calc(100vh - 58px);
}

.sidebar .brand-block {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
  margin-bottom: 1.4rem;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar .brand-block img { width: 100%; height: 100%; object-fit: cover; }
.sidebar .brand-block i { color: var(--brand-ink); font-size: 1.15rem; }
.sidebar .brand-block .brand-name, .sidebar .brand-block .brand-role { display: none; }

.sidebar-section-label { display: none; } /* icon rail has no room for text labels */
.sidebar-divider { width: 26px; height: 1px; background: var(--border); margin: .5rem 0; }

.sidebar nav.nav { width: 100%; align-items: center; gap: 4px; display: flex; flex-direction: column; }

.sidebar .nav-link {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
  margin-bottom: 2px;
}
.sidebar .nav-link i { font-size: 1.15rem; }
.sidebar .nav-link span { display: none; }
.sidebar .nav-link:hover { background: var(--surface-hover); color: var(--text); }
.sidebar .nav-link.active {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow-brand);
}

/* Tooltip on hover — desktop only. On mobile the sidebar widens and shows
   labels inline instead (see responsive block below), since touch devices
   have no hover state to reveal these. */
@media (min-width: 992px) {
  .sidebar .nav-link[data-title]:hover::after {
    content: attr(data-title);
    position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    background: var(--surface-hover); color: var(--text);
    border: 1px solid var(--border-strong);
    padding: .35rem .7rem; border-radius: 8px;
    font-size: .74rem; font-weight: 600; white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 2000; pointer-events: none;
  }
}

.main-content { flex: 1; padding: 1.3rem 1.6rem; min-width: 0; }

/* ===== Page header (minimal, flat — replaces the old gradient hero) ===== */
.hero-banner {
  background: transparent; box-shadow: none; border: none; padding: 0;
  margin-bottom: 1.4rem; border-radius: 0; color: var(--text); overflow: visible;
}
.hero-banner::after { display: none; }
.hero-banner h4 { font-weight: 700; font-size: 1.15rem; }
.hero-banner .sub { color: var(--text-muted); font-size: .8rem; opacity: 1; }

/* ===== Cards ===== */
.card, .dropdown-menu { background: var(--surface); color: var(--text); border-color: var(--border); }
.dropdown-menu { border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; border: 1px solid var(--border); font-size: .76rem; }
.dropdown-item { border-radius: 8px; font-size: .76rem; padding: .4rem .6rem; }
.dropdown-item:hover { background: var(--surface-hover); color: var(--text); }

.kpi-card {
  border-radius: 16px;
  padding: .95rem 1.05rem;
  border: 1px solid var(--border);
  background: var(--surface);
  height: 100%;
  box-shadow: var(--shadow-sm);
  transition: all .18s ease;
  position: relative;
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card .kpi-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-alt); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; flex-shrink: 0; color: var(--text-muted);
}
.kpi-card .kpi-value { font-size: 1.08rem; font-weight: 800; line-height: 1.15; font-family: 'Plus Jakarta Sans', sans-serif; }
.kpi-card .kpi-label { color: var(--text-muted); font-size: .65rem; font-weight: 500; margin-top: 1px; }

/* Subtle icon tint variants — muted, not loud gradients, to match reference's flat look */
.kpi-icon.icon-rose   { color: #ff8a94; }
.kpi-icon.icon-teal   { color: #5ee6b0; }
.kpi-icon.icon-amber  { color: #ffcf5c; }
.kpi-icon.icon-blue   { color: #7fb1ff; }
.kpi-icon.icon-purple { color: #c7a9ff; }

.chart-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.chart-card:hover { border-color: var(--border-strong); }
.chart-card.d-block:hover { transform: translateY(-2px); border-color: var(--brand); transition: all .18s ease; }
.chart-card h6.fw-bold { font-size: .77rem; margin-bottom: .15rem !important; }
.chart-card p.text-muted, .chart-card .text-muted.small { font-size: .68rem; }

/* ===== Buttons ===== */
.btn { font-weight: 600; font-size: .71rem; border-radius: 9px; padding: .4rem .85rem; transition: all .15s ease; }
.btn-danger { background: var(--brand); border: none; color: var(--brand-ink); box-shadow: var(--shadow-brand); }
.btn-danger:hover { filter: brightness(1.05); transform: translateY(-1px); color: var(--brand-ink); }
.btn-outline-danger { border-color: var(--brand); color: var(--text); }
.btn-outline-danger:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-outline-secondary { border-color: var(--border-strong); color: var(--text-muted); background: var(--surface-alt); }
.btn-outline-secondary:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.btn-sm { padding: .24rem .55rem; font-size: .67rem; border-radius: 7px; }

/* ===== Forms ===== */
.form-control, .form-select {
  background: var(--surface-alt); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 9px;
  padding: .4rem .65rem; font-size: .72rem;
  transition: all .15s ease;
}
.form-control:focus, .form-select:focus {
  background: var(--surface); color: var(--text);
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dim);
}
.form-label { font-weight: 600; color: var(--text); margin-bottom: .28rem; font-size: .7rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ===== Auth pages ===== */
.auth-page { min-height: 100vh; display: flex; background: var(--bg); }
.auth-visual {
  flex: 1.1;
  background: radial-gradient(circle at 20% 20%, rgba(214,255,63,0.10), transparent 42%), #0d0d10;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 3.5rem; color: #f2f2ef; position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
}
.auth-visual::before { content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%; background: rgba(214,255,63,0.05); top: -140px; right: -140px; }
.auth-visual::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.08); bottom: -80px; left: -60px; }
.auth-visual .brand-mark { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: .55rem; position: relative; z-index: 1; }
.auth-visual .brand-mark i { color: var(--brand); }
.auth-visual .tagline { font-size: 1.7rem; font-weight: 800; line-height: 1.3; max-width: 420px; position: relative; z-index: 1; font-family: 'Plus Jakarta Sans', sans-serif; }
.auth-visual .subtext { opacity: .7; margin-top: .7rem; max-width: 380px; position: relative; z-index: 1; font-size: .85rem; }
.auth-visual .stat-row { display: flex; gap: 2rem; position: relative; z-index: 1; }
.auth-visual .stat-row .num { font-size: 1.4rem; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; color: var(--brand); }
.auth-visual .stat-row .lbl { font-size: .72rem; opacity: .65; }

.auth-form-panel { flex: 0.9; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { background: var(--surface); border-radius: 22px; padding: 2.5rem 2.25rem; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }

@media (max-width: 900px) {
  .auth-visual { display: none; }
  .auth-form-panel { flex: 1; }
}

/* ===== Responsive sidebar ===== */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; top: 58px; bottom: 0; left: 0; z-index: 1020;
    transform: translateX(-100%); box-shadow: var(--shadow-lg);
    width: 240px;                 /* wider than the desktop icon rail so labels fit */
    align-items: stretch;         /* let nav links stretch full width instead of centering as icons */
    overflow-y: auto;
    padding-bottom: 1.5rem;
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar .brand-block { align-self: center; }

  .sidebar .nav-link {
    width: 100%;
    height: auto;
    justify-content: flex-start;
    padding: .65rem .9rem;
    gap: .8rem;
  }
  /* Always show the label next to the icon on mobile (no hover available on touch) */
  .sidebar .nav-link[data-title]::after {
    content: attr(data-title);
    position: static;
    background: none; border: none; box-shadow: none;
    padding: 0; margin: 0;
    font-size: .8rem; font-weight: 600; white-space: nowrap;
    color: inherit; transform: none;
  }

  .sidebar-divider { width: calc(100% - 1.8rem); margin: .6rem auto; }

  .main-content { padding: 1rem; }
}

/* Backdrop overlay shown behind the mobile sidebar drawer when open */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; top: 58px;
  background: rgba(0,0,0,0.5);
  z-index: 1015;
}
.sidebar-backdrop.show { display: block; }

/* ===== Tables ===== */
.table { color: var(--text); font-size: .71rem; --bs-table-color: var(--text); --bs-table-bg: transparent; }
.table thead th {
  color: var(--text-muted); font-size: .6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; border-bottom-width: 1px; border-color: var(--border); padding-bottom: .55rem;
}
.table td, .table th { border-color: var(--border); vertical-align: middle; padding-top: .42rem; padding-bottom: .42rem; }
.table-hover tbody tr { transition: background-color .1s ease; }
.table-hover tbody tr:hover, .table-hover tbody tr:hover > * { background-color: var(--surface-hover); color: var(--text); }

.badge { font-weight: 600; font-size: .6rem; padding: .32em .55em; border-radius: 999px; }

/* ===== Alerts ===== */
.alert { border-radius: 12px; border: none; font-size: .76rem; padding: .6rem .9rem; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #c9860a; }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-secondary { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

/* ===== Modals ===== */
.modal-content { background: var(--surface); color: var(--text); border-radius: 18px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); padding: .9rem 1.2rem; }
.modal-title { font-size: .88rem; }
