/* ── AdminKit-style light theme override ───────────────────────────────────── */

:root {
  --sidebar-bg: #222e3c;
  --sidebar-text: #adb5bd;
  --sidebar-text-hover: #e9ecef;
  --sidebar-active-bg: rgba(255,255,255,0.075);
  --sidebar-brand-text: #fff;
  --sidebar-header-color: #6c757d;
  --sidebar-width: 260px;

  --body-bg: #f5f7fb;
  --navbar-bg: #fff;
  --card-bg: #fff;
  --card-border: #dee2e6;

  --primary: #3b7ddd;
  --primary-dark: #2f65b8;
  --danger: #dc3545;
  --warning: #ffc107;
  --success: #1cbb8c;
  --info: #3b82f6;

  --text: #212529;
  --text-muted: #6c757d;
  --font: 'Inter', system-ui, sans-serif;
}

/* ── Bootstrap overrides ── */
body {
  font-family: var(--font);
  font-size: 0.875rem;
  background: var(--body-bg);
  color: var(--text);
}

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

a { color: var(--primary); }

/* ── Layout wrapper ── */
.wrapper { display: flex; width: 100%; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1030;
  transition: margin-left 0.35s ease-in-out, width 0.35s ease-in-out;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.15rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--sidebar-brand-text);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand:hover { color: var(--sidebar-brand-text); text-decoration: none; }
.sidebar-brand svg { color: var(--primary); flex-shrink: 0; }
.sidebar-brand-text { margin-left: 0.6rem; }

.sidebar-nav {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  flex: 1;
}

.sidebar-header {
  padding: 0.375rem 1.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-header-color);
  margin-top: 0.5rem;
}

.sidebar-item { position: relative; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s ease, color 0.15s ease;
  border-radius: 0;
}
.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--sidebar-text);
  transition: color 0.15s ease;
}
.sidebar-link:hover,
.sidebar-item.active > .sidebar-link {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-active-bg);
  text-decoration: none;
}
.sidebar-item.active > .sidebar-link svg { color: var(--sidebar-text-hover); }

.sidebar-bottom {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Main content area ── */
.main {
  min-width: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.35s ease-in-out, width 0.35s ease-in-out;
}

/* ── Top navbar ── */
.navbar-bg {
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 0 2rem 0 rgba(33,37,41,0.05);
}

.navbar-bg .nav-link { color: var(--text-muted); }
.navbar-bg .nav-link:hover { color: var(--text); }

.hamburger {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  position: relative;
}
.hamburger::before,
.hamburger::after {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  position: absolute;
}
.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

/* ── Page content ── */
.content {
  padding: 1.5rem;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.35rem;
  box-shadow: 0 0 0.875rem 0 rgba(33,37,41,0.05);
  margin-bottom: 1.25rem;
}
.card-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  padding: 0.875rem 1.25rem;
  font-weight: 600;
}

/* ── Tables ── */
.table thead th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--card-border);
}

/* ── Status badges ── */
.badge-active    { background: rgba(28,187,140,0.15); color: #0d7a5f; }
.badge-pending,
.badge-provisioning { background: rgba(255,193,7,0.15); color: #856404; }
.badge-disconnected,
.badge-suspended { background: rgba(220,53,69,0.15); color: #842029; }
.badge-qr_pending,
.badge-connecting { background: rgba(59,125,221,0.15); color: #1a3f7a; }
.badge-deleted   { background: rgba(108,117,125,0.15); color: #495057; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25em 0.65em;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Auth pages ── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--body-bg);
}
.auth-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.35rem;
  box-shadow: 0 0 0.875rem 0 rgba(33,37,41,0.05);
  padding: 2.5rem;
  width: 420px;
}
.auth-title  { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 1.75rem; font-size: 0.875rem; }

/* ── Loading ── */
.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Alerts ── */
.alert-error   { background: rgba(220,53,69,0.08);  border: 1px solid rgba(220,53,69,0.25);  color: #842029; }
.alert-success { background: rgba(28,187,140,0.08); border: 1px solid rgba(28,187,140,0.25); color: #0d7a5f; }
.alert-info    { background: rgba(59,125,221,0.08); border: 1px solid rgba(59,125,221,0.25); color: #1a3f7a; }

/* ── QR Code ── */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
}
.qr-container img { border-radius: 0.35rem; background: #fff; padding: 6px; }

/* ── Page header ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; }

/* ── Key display ── */
.key-display {
  background: #f8f9fa;
  border: 1px solid var(--card-border);
  border-radius: 0.35rem;
  padding: 0.625rem 0.875rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--primary);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state p { margin-top: 0.5rem; font-size: 0.875rem; }

/* ── Toggle switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--card-border);
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text);
}
.toggle-label.disabled { color: var(--text-muted); }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #dee2e6;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.45; cursor: not-allowed; }

/* ── Tooltip icon ── */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  color: var(--text-muted);
  font-size: 10px;
  cursor: help;
  flex-shrink: 0;
}

/* ── Settings section labels ── */
.settings-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem;
}
.settings-section-title:first-child { margin-top: 0; }

/* ── Password reveal input group ── */
.input-reveal-group { display: flex; gap: 0.5rem; }
.input-reveal-group .form-control { flex: 1; }

/* ── Sidebar collapsed (hamburger toggle) ── */
.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}
.sidebar.collapsed ~ .main,
.sidebar.collapsed + .main {
  margin-left: 0;
}

/* Target .main sibling when sidebar is collapsed inside .wrapper */
.wrapper:has(.sidebar.collapsed) .main {
  margin-left: 0;
}

@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    margin-left: calc(-1 * var(--sidebar-width));
    transition: margin-left 0.2s ease;
  }
  .sidebar.show { margin-left: 0; }
  .main { margin-left: 0; }
}
