:root {
  --admin-bg: #f5f5f5;
  --admin-sidebar: rgba(33, 37, 41, 1);
  --admin-sidebar-text: rgba(255, 255, 255, 0.9);
  --admin-sidebar-hover: rgba(255, 255, 255, 0.12);
}

/* ===== Admin Layout ===== */
.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--admin-bg);
}

.admin-menu {
  flex-shrink: 0;
}

/* ===== Sidebar ===== */
.admin-sidebar {
  width: 250px;
  background: var(--admin-sidebar);
  color: var(--admin-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 100vh;
}

.admin-sidebar-super {
  --admin-sidebar: rgba(22, 27, 34, 1);
}

.admin-sidebar .sidebar-brand {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.admin-sidebar .sidebar-brand a {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  display: block;
}

.admin-sidebar .sidebar-brand span {
  font-size: 0.8rem;
  opacity: 0.7;
  display: block;
  margin-top: 0.2rem;
}

.admin-sidebar .sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  opacity: 0.85;
}

.admin-sidebar nav ul {
  list-style: none;
  padding: 0.5rem 0;
}

.admin-sidebar nav ul li a {
  display: block;
  padding: 0.7rem 1.25rem;
  color: var(--admin-sidebar-text);
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}

.admin-sidebar nav ul li a:hover,
.admin-sidebar nav ul li a.active {
  background: var(--admin-sidebar-hover);
  border-left-color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}

/* ===== Admin Main Area ===== */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-header {
  background: #fff;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  font-size: 1.4rem;
  color: var(--text-secondary);
  margin: 0;
}

.admin-content {
  flex: 1;
  padding: 1.5rem 2rem;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: #28a745;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ===== Admin Cards ===== */
.admin-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.admin-card h2 {
  color: var(--text-secondary);
  font-size: 1.15rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* ===== Dashboard Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-primary);
  opacity: 0.7;
  margin-top: 0.25rem;
}

/* ===== Admin Tables ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

.admin-table .actions {
  white-space: nowrap;
}

.admin-table .actions a {
  margin-right: 0.5rem;
  font-size: 0.85rem;
}

/* ===== Status Badges ===== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

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

.badge-inactive {
  background: #f8d7da;
  color: #721c24;
}

/* ===== Admin Forms ===== */
.admin-form {
  max-width: 700px;
}

.admin-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .admin-form .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Top action bar ===== */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.action-bar .btn {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

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

  .admin-menu {
    width: 100%;
  }

  .admin-sidebar {
    width: 100%;
    min-height: auto;
  }

  .admin-sidebar nav ul {
    display: flex;
    flex-wrap: wrap;
  }

  .admin-content {
    padding: 1.0rem 0;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
  }

  .admin-table tr {
    background: #fff;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .admin-table td {
    border: none;
    padding: 0;
  }

  .admin-table td:first-child {
    flex: 1;
    min-width: 0;
  }

  .admin-table td .mobile-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .admin-table td .mobile-meta {
    font-size: 0.78rem;
    color: var(--text-primary);
    opacity: 0.65;
    margin-top: 0.15rem;
  }

  .admin-table td.actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .admin-table td.actions a,
  .admin-table td.actions button {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  .admin-table td[data-hide-mobile] {
    display: none;
  }
}
