/* Nexa Admin – custom styles */

body {
  background: #f4f6f9;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: #1e2329;
  width: 220px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform .25s ease;
}

.sidebar .brand {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 20px 16px 16px;
  border-bottom: 1px solid #2d333b;
  flex-shrink: 0;
}

.sidebar a {
  display: block;
  color: #9ba3ab;
  text-decoration: none;
  padding: 7px 16px;
  font-size: .875rem;
  transition: background .15s;
}

.sidebar a:hover,
.sidebar a.active {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.sidebar .section-label {
  font-size: .7rem;
  color: #6c757d;
  text-transform: uppercase;
  padding: 14px 16px 4px;
  letter-spacing: .08em;
}

/* ── Main content ────────────────────────────────────────── */
.main {
  margin-left: 220px;
  padding: 32px;
}

/* ── Top navbar (user info) ──────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 8px 32px;
  margin-left: 220px;
  position: sticky;
  top: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  font-size: .875rem;
}

/* ── Tables ──────────────────────────────────────────────── */
.table th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6c757d;
  font-weight: 600;
}

/* ── Status badges ───────────────────────────────────────── */
.badge-status-received     { background-color: #6c757d; }
.badge-status-processing   { background-color: #0dcaf0; color: #000; }
.badge-status-pending_review { background-color: #ffc107; color: #000; }
.badge-status-ready_to_sync { background-color: #0d6efd; }
.badge-status-synced       { background-color: #198754; }
.badge-status-failed       { background-color: #dc3545; }

/* ── Forms ───────────────────────────────────────────────── */
.form-card {
  max-width: 720px;
}

/* ── HTMX loading indicator ──────────────────────────────── */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator {
  display: inline-block;
}

/* ── Login page ──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f6f9;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

/* ── Mobile / responsive ─────────────────────────────────── */
.sidebar-toggle { display: none; }
.topbar-brand { display: none; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1030;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 24px rgba(0, 0, 0, .25);
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
  .topbar {
    margin-left: 0;
    padding: 8px 12px;
    gap: 8px;
  }
  .main {
    margin-left: 0;
    padding: 16px 12px;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .topbar-brand {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
  }
  /* Allow tables inside cards to scroll horizontally */
  .card > .card-body.p-0 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Long monospace strings (NIFs, hashes, etc.) shouldn't overflow */
  code, .font-monospace {
    word-break: break-word;
  }
}

@media (max-width: 575.98px) {
  .main {
    padding: 12px 8px;
  }
  /* Compact KPI numbers on small screens */
  .card .h1, .card .display-4, .card .display-5 {
    font-size: 1.6rem;
  }
}
