/* Storefront /admin shell */

/* ---------------------------------------------------------------------------
 * Shared Plunder design tokens. This stylesheet is loaded by every operator
 * surface (shop /admin, owner portal, platform super-admin) AFTER each
 * layout's inline <style>, so we only DEFAULT tokens the layouts don't set —
 * never --accent/--bg (those stay per-surface: the shop's brand on /admin, the
 * canonical Plunder brand on the portals). This is what makes the whole product
 * feel like one system even where the accent intentionally differs.
 * -------------------------------------------------------------------------- */
:root {
  --surface: #111118;      /* card / panel background */
  --surface-2: #1f2937;    /* input / inset background */
  --border: #1f2937;       /* hairline borders */
  --border-strong: #374151;
  --muted: #9ca3af;        /* secondary text */
  --accent-ink: #1a1209;   /* text ON the accent (dark, for a light/gold accent) */
  --radius: 1rem;
  --radius-sm: 0.75rem;
  --ok: #34d399;
  --err: #f87171;
}

/* Portal chrome shared by the owner + platform top-nav surfaces so they read as
 * siblings of the /admin shell rather than a different product. */
.plunder-topbar {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, #0b0b12);
  backdrop-filter: blur(6px);
}
.plunder-brand { color: var(--accent); font-weight: 800; letter-spacing: -0.01em; }
.plunder-flash {
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  border: 1px solid;
}
.plunder-flash.ok  { background: color-mix(in srgb, var(--ok) 12%, transparent);
                     border-color: color-mix(in srgb, var(--ok) 40%, transparent);
                     color: var(--ok); }
.plunder-flash.err { background: color-mix(in srgb, var(--err) 12%, transparent);
                     border-color: color-mix(in srgb, var(--err) 40%, transparent);
                     color: var(--err); }

.admin-shell {
  display: grid;
  grid-template-columns: 15rem 1fr;
  min-height: 100vh;
}

.admin-sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: 15rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.6);
  }
  .admin-sidebar-backdrop.open { display: block; }
}

.admin-sidebar {
  background: #0a0a12;
  border-right: 1px solid color-mix(in srgb, var(--accent) 15%, #222);
  display: flex;
  flex-direction: column;
}

.admin-sidebar-wordmark {
  display: block;
  width: auto;
  max-width: 100%;
  height: 2.25rem;
  object-fit: contain;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  font-size: 0.875rem;
  font: inherit;
  color: #9ca3af;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.admin-nav-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.admin-nav-link.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 600;
}

.admin-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--accent);
  color: #1a1209;
  border-radius: 9999px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.4rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f87171;
  vertical-align: middle;
}

.admin-live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: admin-live-pulse 1.6s infinite;
}

@keyframes admin-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 0.4rem rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.admin-card {
  background: #111118;
  border: 1px solid #1f2937;
  border-radius: 1rem;
  padding: 1.25rem;
}

.admin-stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.admin-input {
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #f3f4f6;
}

.admin-input:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-label {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.35rem;
}

.admin-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.admin-nav-group { margin-top: 0.25rem; }

.admin-nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #9ca3af;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.admin-nav-group-toggle:hover { color: #e5e7eb; background: rgba(255, 255, 255, 0.04); }

.admin-nav-group.open .admin-nav-group-toggle { color: var(--accent); }

.admin-nav-group-meta { display: flex; align-items: center; gap: 0.35rem; }

.admin-nav-chevron {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.admin-nav-group.open .admin-nav-chevron { transform: rotate(180deg); }

.admin-nav-sub {
  display: none;
  padding-left: 0.35rem;
  margin-bottom: 0.15rem;
}

.admin-nav-group.open .admin-nav-sub { display: block; }

.admin-nav-sublink { font-size: 0.8125rem; padding-left: 1rem; }

.admin-settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.admin-settings-subnav a {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
  border: 1px solid #374151;
}

.admin-settings-subnav a:hover { color: var(--accent); border-color: var(--accent); }

.admin-settings-subnav a.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  border-color: var(--accent);
}

.admin-status-ok { color: #4ade80; }
.admin-status-warn { color: #fbbf24; }
.admin-status-muted { color: #6b7280; }

.admin-table { width: 100%; border-collapse: collapse; }

.admin-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #1f2937;
}

.admin-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #1f2937;
  font-size: 0.875rem;
  vertical-align: top;
}

.admin-btn-secondary {
  background: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
}

.admin-btn-secondary:hover {
  border-color: var(--accent);
}

.admin-btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #0b0b12;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.admin-btn-primary:hover {
  filter: brightness(1.08);
}

.admin-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #1f2937;
}

.admin-checklist-item:last-child { border-bottom: none; }

.admin-login-shell {
  min-height: calc(100vh - 4rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 5vh, 2rem) 0;
}

.admin-login-shell .admin-card {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

@media (max-width: 480px) {
  .admin-login-shell {
    min-height: calc(100svh - 4rem);
    align-items: flex-start;
    padding-top: clamp(3rem, 18svh, 6rem);
    padding-bottom: 1rem;
  }

  .admin-login-shell .admin-card {
    padding: 1.5rem;
  }

  .admin-login-shell .admin-input {
    font-size: 1rem;
    min-height: 2.75rem;
  }

  .admin-login-shell .btn-accent {
    min-height: 2.75rem;
  }
}
