/* ===== LAYOUT ===== */

html, body { height: 100%; }

.login-layout,
.install-layout {
  padding-top: 60px;
}

.login-card {
  border: none;
  border-radius: 10px;
}

.login-card .card-header {
  background: #1a1a2e;
  color: #89b4fa;
  border-radius: 10px 10px 0 0 !important;
  font-size: 1.05em;
  font-weight: 600;
}

/* ===== ADMIN LAYOUT ===== */

.admin-layout {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.admin-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */

.sidebar {
  width: 230px;
  min-width: 230px;
  background: #1a1a2e;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0,0,0,0.4);
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.2s;
}

.sidebar-header {
  padding: 16px 18px;
  background: #12122a;
  font-size: 1em;
  font-weight: 700;
  color: #89b4fa;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #2a2a4a;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-section-label {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #45475a;
  padding: 14px 18px 4px;
  pointer-events: none;
}

.sidebar-nav li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #a6adc8;
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 0.9em;
  transition: background 0.12s, color 0.12s;
}

.sidebar-nav li > a i {
  width: 18px;
  text-align: center;
  font-size: 0.95em;
}

.sidebar-nav li > a:hover {
  background: rgba(137,180,250,0.07);
  color: #cdd6f4;
}

.sidebar-nav li.active > a {
  background: rgba(137,180,250,0.13);
  border-left-color: #89b4fa;
  color: #89b4fa;
  font-weight: 500;
}

.sidebar-footer {
  padding: 12px 16px;
  background: #12122a;
  font-size: 0.82em;
  color: #6c7086;
  border-top: 1px solid #2a2a4a;
}

.sidebar-credit {
  padding: 8px 16px 10px;
  background: #12122a;
  font-size: 0.75em;
  text-align: center;
  border-top: 1px solid #1e1e38;
}

.sidebar-credit a {
  color: #45475a;
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-credit a:hover {
  color: #89b4fa;
}

/* ===== MAIN CONTENT ===== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f4f4f8;
  overflow: hidden;
  min-width: 0;
}

/* ===== TOPBAR ===== */

.topbar {
  background: #181825;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #313244;
  flex-shrink: 0;
}

.topbar-title {
  color: #cdd6f4;
  font-size: 0.95em;
  font-weight: 600;
}

.topbar .btn {
  font-size: 0.82em;
}

/* ===== STATS ROW ===== */

.stats-row {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: #ededf4;
  border-bottom: 1px solid #d8d8e8;
  flex-shrink: 0;
}

.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  text-align: center;
  min-width: 0;
}

.stat-card .stat-value {
  font-size: 1.9em;
  font-weight: 700;
  line-height: 1.1;
  color: #333;
}

.stat-card .stat-label {
  font-size: 0.72em;
  color: #888;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.stat-online .stat-value  { color: #27ae60; }
.stat-card.stat-disabled .stat-value { color: #e74c3c; }
.stat-card.stat-logs .stat-value    { color: #2980b9; }

/* ===== PAGE CONTENT ===== */

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.tab-pane-page {
  display: none;
}

.tab-pane-page.active {
  display: block;
}

/* Inner padding on page content */
.tab-content > .p-3 .tab-pane-page {
  padding: 4px 0;
}

/* ===== TABLES ===== */

.table-sm td, .table-sm th {
  font-size: 0.875em;
  vertical-align: middle;
}

tr.user-expired td {
  background-color: rgba(220, 53, 69, 0.06) !important;
}

tr.user-expired td:first-child {
  border-left: 3px solid #dc3545;
}

/* ===== TOGGLE SWITCH ===== */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: background 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider { background: #5cb85c; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ===== LED INDICATORS ===== */

.led {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
}

.led-green {
  background: #80FF00;
  box-shadow: #7D7B80 0 -1px 6px 1px, inset #460 0 -1px 8px, #80FF00 0 3px 11px;
}

.led-red {
  background: #F00;
  box-shadow: #7D7B80 0 -1px 6px 1px, inset #600 0 -1px 8px, #F00 0 3px 11px;
}

/* ===== PASSWORD CELL ===== */

.pass-mask {
  letter-spacing: 2px;
  color: #aaa;
  font-size: 1em;
  margin-right: 6px;
}

/* ===== CERT STATUS BADGES ===== */

.badge-cert-v { background-color: #198754; color: #fff; }
.badge-cert-r { background-color: #dc3545; color: #fff; }
.badge-cert-e { background-color: #6c757d; color: #fff; }

/* ===== CONFIG TEXTAREA ===== */

.cfg-textarea {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.82em;
  resize: vertical;
}

/* ===== TOAST ===== */

.toast-container .toast {
  min-width: 260px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

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

  .stats-row {
    flex-wrap: wrap;
  }

  .stat-card {
    flex: 1 1 calc(50% - 14px);
  }
}

/* Fail2Ban */
#fail2ban-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1rem;
}
#fail2ban-summary .stat-card {
  min-width: 120px;
}
#page-fail2ban .card-header strong {
  font-size: 0.9em;
  letter-spacing: 0.02em;
}
#page-fail2ban .card-header .small {
  font-size: 0.8em;
  opacity: 0.9;
}

/* Notification unread highlight */
.notif-unread {
  background-color: #eef5ff;
}
.notif-unread .small {
  font-weight: 600;
}
