/* ============================================================
   Admin Layout
   ============================================================ */

.admin {
  min-height: 100vh;
}

.admin__layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Mobile Header ---- */

.admin__mobile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  padding: 0 16px;
  background-color: #fff;
  border-bottom: 1px solid var(--color-border);
  z-index: 20;
}

@media (min-width: 768px) {
  .admin__mobile-header {
    display: none;
  }
}

.admin__mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: #374151;
  cursor: pointer;
}

.admin__mobile-toggle:hover {
  background-color: #f3f4f6;
}

/* ---- Sidebar Overlay ---- */

.admin__sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 29;
}

.admin__layout--menu-open .admin__sidebar-overlay {
  display: block;
}

body:has(.admin__layout--menu-open) {
  overflow: hidden;
}

@media (min-width: 768px) {
  .admin__sidebar-overlay {
    display: none !important;
  }

  body:has(.admin__layout--menu-open) {
    overflow: auto;
  }
}

/* ---- Sidebar ---- */

.admin__sidebar {
  display: none;
  width: var(--sidebar-width);
  flex-direction: column;
  background-color: var(--color-sidebar);
  color: var(--color-sidebar-text);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  transition: transform 0.2s ease;
}

@media (max-width: 767px) {
  .admin__sidebar {
    display: flex;
    transform: translateX(-100%);
  }

  .admin__layout--menu-open .admin__sidebar {
    transform: translateX(0);
  }
}

@media (min-width: 768px) {
  .admin__sidebar {
    display: flex;
  }
}

.admin__sidebar-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.admin__logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--color-sidebar-text);
}

/* ---- Nav ---- */

.admin__nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin__nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin__nav-label {
  display: block;
  padding: 0 12px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.admin__nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #9ca3af;
  border-radius: var(--radius-md);
  transition: background-color 0.15s, color 0.15s;
  text-decoration: none;
}

.admin__nav-item:hover {
  background-color: var(--color-sidebar-hover);
  color: var(--color-sidebar-text);
}

.admin__nav-item--active {
  background-color: var(--color-sidebar-active);
  color: var(--color-sidebar-text);
}

/* ---- Sidebar Footer ---- */

.admin__sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--color-sidebar-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin__sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
}

.admin__sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--color-sidebar-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-sidebar-text);
  flex-shrink: 0;
}

.admin__sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin__sidebar-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin__sidebar-email {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin__sidebar-footer-links {
  display: flex;
  gap: 4px;
}

.admin__sidebar-footer-link {
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  transition: background-color 0.15s, color 0.15s;
  text-decoration: none;
}

.admin__sidebar-footer-link:hover {
  background-color: var(--color-sidebar-hover);
  color: var(--color-sidebar-text);
}

.admin__sidebar-footer-link--danger:hover {
  color: #f87171;
}

/* ---- Main ---- */

.admin__main {
  flex: 1;
  background-color: #f9fafb;
  padding: 32px;
  min-height: 100vh;
}

@media (min-width: 768px) {
  .admin__main {
    margin-left: var(--sidebar-width);
  }
}

@media (max-width: 767px) {
  .admin__main {
    padding: 16px;
    padding-top: 72px;
  }
}

/* ---- Page Structure ---- */

.admin__page {
  max-width: 100%;
}

.admin__page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin__page-title {
  font-size: 24px;
  font-weight: 700;
  color: #2d2d2d;
}

.admin__page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin__section-title {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 16px;
  color: #2d2d2d;
}

.admin__filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.admin__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.admin__content-preview {
  margin-top: 24px;
}

.admin__content-preview h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted-foreground);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* ---- Dashboard Stats ---- */

.admin__stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.admin__stat-card {
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin__stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted-foreground);
}

.admin__stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #2d2d2d;
}

/* ---- Sortable ---- */

.sortable--dragging {
  opacity: 0.5;
}

.table__row[draggable="true"] {
  cursor: grab;
}

.table__row[draggable="true"]:active {
  cursor: grabbing;
}
