/* public/css/style.css */
:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.85);
  --text-dim: rgba(255, 255, 255, 0.65);
  --border-color: rgba(255, 255, 255, 0.1);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --sidebar-bg: #1e293b;
}

.text-accent {
  color: var(--accent);
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-dim {
  color: var(--text-dim) !important;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
}

/* ── Login Page ── */
.login-page {
  overflow: hidden;
  position: relative;
}

.login-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  z-index: -1;
  animation: float 20s infinite alternate;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: #6366f1;
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: #3b82f6;
  bottom: -50px;
  right: -50px;
  animation-delay: -5s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: #8b5cf6;
  top: 50%;
  left: 50%;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(40px, 40px);
  }
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

.login-brand-name {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-brand-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-input {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  color: white;
}

.login-input:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  color: white;
}

.login-input-icon {
  background: rgba(15, 23, 42, 0.5);
  border-right: none;
  color: var(--text-muted);
}

.btn-login {
  background: var(--accent);
  border: none;
  color: white;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-login:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.brand-icon {
  font-size: 1.5rem;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 1.25rem;
  white-space: nowrap;
}

.sidebar-nav {
  flex-grow: 1;
  padding: 12px;
  overflow-y: auto;
}

.nav-section-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px;
  white-space: nowrap;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  white-space: nowrap;
}

.nav-link-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-link-item.active {
  background: var(--accent);
  color: white;
}

.nav-link-item i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-link-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-details {
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ── Main Layout ── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-wrapper.expanded {
  margin-left: var(--sidebar-collapsed-width);
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 950;
  display: none;
}

.sidebar-backdrop.show {
  display: block;
}

.topbar {
  height: 64px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  margin-right: 16px;
  cursor: pointer;
}

.topbar-title {
  font-weight: 700;
  font-size: 1.1rem;
  flex-grow: 1;
}

.page-content {
  flex-grow: 1;
  padding-bottom: 40px;
}

/* ── Components ── */
.card-glass {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
}

.card-glass__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-glass__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.card-glass__body {
  padding: 24px;
}

.stat-card {
  padding: 24px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card-link {
  text-decoration: none !important;
  color: inherit !important;
  display: block;
}

.stat-card-link:hover .stat-card {
  transform: translateY(-5px);
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--accent);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.stat-card-link:hover .stat-card__trend {
  opacity: 1;
  color: var(--accent);
}

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card__label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.stat-card__trend {
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: 0.3;
}

.stat-card--purple .stat-card__icon {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
}

.stat-card--cyan .stat-card__icon {
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
}

.stat-card--green .stat-card__icon {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.stat-card--orange .stat-card__icon {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

.btn-accent {
  background: var(--accent);
  border: none;
  color: white;
}

.btn-accent:hover {
  background: var(--accent-hover);
  color: white;
}

.btn-outline-accent {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  transition: all 0.2s ease;
}

.btn-outline-accent:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-check:checked+.btn-outline-accent {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.table {
  color: var(--text-main);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-color);
}

.table thead th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 16px 24px;
  border-bottom-width: 1px;
}

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

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

.member-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
}

.member-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 2rem;
  margin-bottom: 16px;
}

.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-status--active {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.badge-status--inactive {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

.badge-status--expired {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.badge-status--orange {
  background: rgba(249, 115, 22, 0.1);
  color: #fb923c;
}

.badge-status--yellow {
  background: rgba(234, 179, 8, 0.1);
  color: #facc15;
}

.badge-status--out {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.member-code {
  font-family: monospace;
  background: rgba(15, 23, 42, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.member-email {
  color: #38bdf8;
  font-size: 0.85rem;
  opacity: 0.9;
}

.plan-date {
  color: #fbbf24;
  font-weight: 500;
  font-size: 0.85rem;
}

.badge-plan {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ── Timeline ── */
.visit-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.visit-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 1px;
  background: var(--border-color);
}

.visit-timeline__item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 24px;
}

.visit-timeline__item:last-child {
  padding-bottom: 0;
}

.visit-timeline__dot {
  position: absolute;
  left: 0;
  top: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid var(--border-color);
  z-index: 1;
}

.visit-timeline__dot--active {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.visit-timeline__body {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}


.scanner-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.scanner-frame {
  width: 200px;
  height: 200px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
  position: relative;
}

.scanner-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--accent);
  top: 0;
  left: 0;
  animation: scan 2s linear infinite;
  box-shadow: 0 0 8px var(--accent);
}

@keyframes scan {
  0% {
    top: 0;
  }

  100% {
    top: 100%;
  }
}

.scanner-idle {
  position: absolute;
  z-index: 20;
  color: white;
  text-align: center;
}

.scanner-idle i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.bmi-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.3);
}

.bmi-card--underweight {
  border-color: var(--warning);
}

.bmi-card--normal {
  border-color: var(--success);
}

.bmi-card--overweight {
  border-color: #fb923c;
}

.bmi-card--obese {
  border-color: var(--danger);
}

.bmi-card__value {
  font-size: 2rem;
  font-weight: 800;
}

.bmi-card__label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
  }

  .sidebar.show {
    transform: translateX(0);
    width: var(--sidebar-width) !important;
  }

  .sidebar.show .brand-name,
  .sidebar.show .nav-link-item span,
  .sidebar.show .nav-section-label,
  .sidebar.show .user-details {
    display: block !important;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .topbar {
    padding: 0 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    width: 100%;
  }

  .login-card {
    padding: 30px 20px;
  }
}

@media (max-width: 575.98px) {
  .stat-card {
    padding: 16px;
    gap: 12px;
  }

  .stat-card__value {
    font-size: 1.5rem;
  }

  .card-glass__body {
    padding: 16px;
  }

  .table thead th,
  .table tbody td {
    padding: 12px 16px;
  }
}

.plan-card--inactive {
  opacity: 0.6;
  filter: grayscale(0.5);
  border-style: dashed;
  border-color: red;
}

/* ── Global Loader ── */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.progress-bar-top {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 10000;
  width: 0;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--accent);
}

.loader-content {
  animation: fadeInDown 0.4s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}