/* -------------------------------------------------------------
   Wealthcrop Admin Portal — Production-Grade Admin CSS
   (High-contrast • TOTP-safe • Fintech standard)
--------------------------------------------------------------*/

/* RESET + BASE ------------------------------------------------*/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* -------------------------------------------------------------
   THEME VARIABLES
--------------------------------------------------------------*/
:root {
  --bg: #f7fafc;
  --text: #0f172a;

  /* Sidebar */
  --sidebar-bg: #0f172a;        /* slate-900 */
  --sidebar-text: #e5e7eb;      /* gray-200 */
  --sidebar-hover: #1e293b;     /* slate-800 */
  --sidebar-active: #2563eb;    /* blue-600 */

  /* Cards / UI */
  --card-bg: #ffffff;
  --border: #e5e7eb;

  /* Primary */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  /* Status */
  --muted: #6b7280;
  --success: #16a34a;
  --danger: #ef4444;
}

/* Dark mode hook (future ready) */
[data-theme="dark"] {
  --bg: #020617;
  --text: #e5e7eb;
  --card-bg: #020617;
  --border: #1f2937;
}

/* -------------------------------------------------------------
   LAYOUT
--------------------------------------------------------------*/
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* -------------------------------------------------------------
   SIDEBAR
--------------------------------------------------------------*/
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand .logo {
  height: 40px;
}

.brand .brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

/* Navigation */
.nav {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

/* ✅ ACTIVE MENU (CRITICAL FIX) */
.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
}

/* Footer */
.sidebar-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* -------------------------------------------------------------
   MAIN AREA
--------------------------------------------------------------*/
.main {
  background: var(--bg);
  overflow: auto;
}

/* Top bar */
.topbar {
  height: 64px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
}

.user-badge {
  padding: 6px 14px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}

/* Page content */
.content {
  padding: 28px;
}

.footer {
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* -------------------------------------------------------------
   CARDS
--------------------------------------------------------------*/
.card {
  background: var(--card-bg);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.04);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

/* KPI */
.kpis {
  display: flex;
  gap: 18px;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
}

/* -------------------------------------------------------------
   TABLES
--------------------------------------------------------------*/
.fullwidth {
  width: 100%;
  border-collapse: collapse;
}

.fullwidth th,
.fullwidth td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.fullwidth th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.fullwidth tr:hover {
  background: rgba(2, 6, 23, 0.03);
}

/* -------------------------------------------------------------
   FORMS & BUTTONS
--------------------------------------------------------------*/
input,
select {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* -------------------------------------------------------------
   MODAL
--------------------------------------------------------------*/
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.modal.hidden {
  display: none;
}

.modal-dialog {
  width: 520px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* -------------------------------------------------------------
   UTILITIES
--------------------------------------------------------------*/
.hidden {
  display: none;
}

.icon-button {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* ============================= */
/* SEMANTIC TEXT COLORS          */
/* (Dark-mode safe)              */
/* ============================= */

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

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

.warning {
  color: #f59e0b; /* amber-500 */
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

/* ============================= */
/* STATUS BADGES                 */
/* ============================= */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-muted {
  background: rgba(107, 114, 128, 0.15);
  color: var(--muted);
}


/* -------------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------------*/
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    z-index: 50;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    padding-top: 64px;
  }
}
/* ============================= */
/* ACTIVE MENU STATE             */
/* ============================= */
.nav-item.active {
  background: var(--primary);
  color: #ffffff;
}

/* ============================= */
/* TOPBAR ACTIONS                */
/* ============================= */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============================= */
/* MOBILE SIDEBAR                */
/* ============================= */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 100;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-button {
    font-size: 20px;
  }
}
/* ======================================================
   AUTH SCREENS (LOGIN / TOTP)
====================================================== */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a, #020617);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  padding: 28px;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  text-align: center;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #0f172a;
}

.login-card .muted {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 18px;
}

.login-card label {
  display: block;
  text-align: left;
  margin: 14px 0 6px;
  font-weight: 600;
  color: #334155;
}

.login-card input {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 4px;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
}

.login-card .btn.full {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
}

.login-card .error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 14px;
}

/* ======================================================
   AUTH SCREENS OVERRIDE (LOGIN / TOTP)
   This MUST override admin grid layout
====================================================== */

body.login-body {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100vh !important;
  background: linear-gradient(135deg, #0f172a, #020617) !important;
}

/* Disable admin grid completely on auth pages */
body.login-body .layout,
body.login-body .sidebar,
body.login-body .topbar,
body.login-body .footer {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  padding: 28px;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  text-align: center;
}

.login-card input {
  width: 100%;
  font-size: 20px;
  text-align: center;
  letter-spacing: 4px;
}

.login-card .btn.full {
  width: 100%;
  margin-top: 18px;
}
