/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-layout > main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

/* Sidebar — override Pico CSS <nav> defaults */
.sidebar {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  flex-shrink: 0;
  background: var(--pico-card-background-color);
  border-right: 1px solid var(--pico-muted-border-color);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Reset Pico nav overrides */
  justify-content: flex-start;
}

.sidebar-header {
  padding: 0.5rem 0 1rem;
  font-size: 1.2rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  margin-bottom: 1rem;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-direction: column;
  display: block;
}

.sidebar ul ul {
  padding-left: 1rem;
  display: block;
}

.sidebar li {
  display: list-item;
  width: 100%;
  padding: 0;
  margin: 0;
}

.sidebar a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--pico-color);
  font-size: 0.9rem;
  width: auto;
  margin: 0;
}

.sidebar a:hover {
  background: var(--pico-primary-focus);
}

.sidebar a.active {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

.nav-section {
  display: block;
  padding: 0.6rem 0.6rem 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--pico-muted-color);
  letter-spacing: 0.05em;
}

/* Sidebar status indicators */
.sidebar-status {
  margin-top: auto;
  padding: 0.75rem 0.6rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #adb5bd;
}

.status-dot.ok { background: #2d7d46; }
.status-dot.error { background: #c0392b; }

.sidebar-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--pico-muted-border-color);
  font-size: 0.85rem;
}

.sidebar-footer a {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

/* Switch hint text (below toggle labels) */
.switch-hint {
  display: block;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  color: var(--pico-muted-color);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-active {
  background: #d4edda;
  color: #155724;
}

.status-inactive {
  background: #e2e3e5;
  color: #383d41;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
}

/* Stats */
.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

/* Button group */
.btn-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

.btn-xs {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

/* Header row */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Error text */
.error-text {
  color: #c0392b;
  font-weight: 600;
}

/* Flash messages */
.flash-message {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Warning box */
.warning-box {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

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

.login-card header {
  text-align: center;
}

/* Tables */
.overflow-auto {
  overflow-x: auto;
}

.row-acknowledged {
  opacity: 0.6;
}

/* Pagination */
.pagination-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

/* Search results table */
.search-results-table {
  font-size: 0.85rem;
  margin-bottom: 0;
}

.search-results-table th,
.search-results-table td {
  padding: 0.3rem 0.5rem;
}

/* Group list */
.group-list {
  columns: 2;
  column-gap: 2rem;
}

.group-list label {
  break-inside: avoid;
}

/* Responsive */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--pico-muted-border-color);
  }

  .group-list {
    columns: 1;
  }
}
