/* ═══════════════════════════════════════════════════════════════════
   ADMIN PANEL — Command-centre aesthetic
   Tone: authoritative / operational / refined dark-navy
   Palette extends base.css variables with admin-specific tokens
   ═══════════════════════════════════════════════════════════════════ */

/* ── Admin-specific design tokens ───────────────────────────────── */
:root {
  --admin-bg-start:   #0a1f45;
  --admin-bg-end:     #0d2a5e;
  --admin-surface:    rgba(255, 255, 255, 0.055);
  --admin-surface-2:  rgba(255, 255, 255, 0.09);
  --admin-border:     rgba(255, 255, 255, 0.11);
  --admin-border-hi:  rgba(100, 160, 255, 0.35);
  --admin-text:       #e8eef8;
  --admin-text-dim:   rgba(232, 238, 248, 0.55);
  --admin-accent:     #4a90e8;
  --admin-accent-glow:rgba(74, 144, 232, 0.28);
  --admin-success:    #2dd882;
  --admin-success-bg: rgba(45, 216, 130, 0.12);
  --admin-success-bd: rgba(45, 216, 130, 0.32);
  --admin-error:      #ff5a72;
  --admin-error-bg:   rgba(255, 90, 114, 0.1);
  --admin-error-bd:   rgba(255, 90, 114, 0.3);
  --admin-warn:       #f5a623;
  --admin-step-size:  28px;
}

/* ── Gear icon ───────────────────────────────────────────────────── */

.admin-gear-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: var(--admin-bg-start);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  width: 34px;
  padding: 0;
  box-shadow: 0 2px 12px rgba(10, 31, 69, 0.4);
  transition: background 200ms ease, transform 400ms ease, box-shadow 200ms ease;
  position: relative;
}

.admin-gear-button::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  background: conic-gradient(from 0deg, var(--admin-accent), transparent 60%);
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: -1;
}

.admin-gear-button:hover {
  background: var(--admin-bg-end);
  box-shadow: 0 4px 18px rgba(74, 144, 232, 0.35);
}

.admin-gear-button:hover::after { opacity: 1; }

.admin-gear-button:hover svg { transform: rotate(72deg); }

.admin-gear-button svg {
  fill: currentColor;
  height: 18px;
  width: 18px;
  transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Admin panel full-screen backdrop ────────────────────────────── */

.admin-panel {
  width: 100%;
  min-height: calc(100vh - 80px);
  padding: 90px 24px 64px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex: 1;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(74, 144, 232, 0.12) 0%, transparent 70%),
    linear-gradient(160deg, var(--admin-bg-start) 0%, var(--admin-bg-end) 100%);
  position: relative;
  overflow: hidden;
}

/* Blueprint grid texture */
.admin-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 144, 232, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 144, 232, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* Ambient glow orbs */
.admin-panel::after {
  content: '';
  position: absolute;
  top: -180px;
  right: -120px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74, 144, 232, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Panel card ──────────────────────────────────────────────────── */

.admin-panel-inner {
  width: min(780px, 100%);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Panel header ────────────────────────────────────────────────── */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-header h2 {
  font-size: clamp(1.6rem, 2vw + 0.8rem, 2.2rem);
  margin: 0;
  color: #fff;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.admin-header-subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--admin-text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
}

.admin-close-button {
  appearance: none;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: var(--admin-surface);
  color: var(--admin-text-dim);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  height: 36px;
  width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.admin-close-button:hover {
  background: var(--admin-surface-2);
  color: #fff;
  border-color: var(--admin-border-hi);
}

/* ── Step cards ──────────────────────────────────────────────────── */

.admin-step-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 24px 26px;
  margin-bottom: 16px;
  transition: border-color 200ms ease, background 200ms ease;
  position: relative;
  overflow: hidden;
}

.admin-step-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(74, 144, 232, 0.5), transparent);
  opacity: 0;
  transition: opacity 200ms ease;
}

.admin-step-card:focus-within {
  border-color: var(--admin-border-hi);
  background: var(--admin-surface-2);
}

.admin-step-card:focus-within::before { opacity: 1; }

.admin-step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.admin-step-badge {
  flex-shrink: 0;
  width: var(--admin-step-size);
  height: var(--admin-step-size);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-accent), #2563b8);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px rgba(74, 144, 232, 0.2);
  letter-spacing: 0;
}

.admin-step-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: -0.01em;
}

.admin-step-desc {
  font-size: 0.8rem;
  color: var(--admin-text-dim);
  margin: 2px 0 0;
}

/* ── Form fields ─────────────────────────────────────────────────── */

.admin-upload-form {
  display: grid;
  gap: 16px;
}

.admin-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-field {
  display: grid;
  gap: 8px;
  text-align: left;
}

.admin-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--admin-text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-field input[type="text"],
.admin-field select {
  width: 100%;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--admin-text);
  background: rgba(255, 255, 255, 0.06);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.admin-field input[type="text"]::placeholder {
  color: rgba(232, 238, 248, 0.28);
}

.admin-field input[type="text"]:focus,
.admin-field select:focus {
  border-color: var(--admin-accent);
  background: rgba(74, 144, 232, 0.07);
  box-shadow: 0 0 0 3px var(--admin-accent-glow);
}

.admin-field select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a90e8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.admin-field select option {
  background: #0d2a5e;
  color: #e8eef8;
}

/* ── Drop zones ──────────────────────────────────────────────────── */

.admin-drop-zone {
  position: relative;
  border: 1px dashed var(--admin-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
  overflow: hidden;
  cursor: pointer;
}

.admin-drop-zone:hover,
.admin-drop-zone:focus-within {
  border-color: var(--admin-accent);
  background: rgba(74, 144, 232, 0.06);
  box-shadow: 0 0 0 3px var(--admin-accent-glow);
}

.admin-drop-zone.has-file {
  border-color: var(--admin-success);
  background: rgba(45, 216, 130, 0.05);
  border-style: solid;
}

.admin-drop-zone-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  pointer-events: none;
}

.admin-drop-zone-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-accent);
  transition: background 200ms ease, color 200ms ease;
}

.admin-drop-zone.has-file .admin-drop-zone-icon {
  background: rgba(45, 216, 130, 0.15);
  border-color: rgba(45, 216, 130, 0.3);
  color: var(--admin-success);
}

.admin-drop-zone-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.admin-drop-zone-text {
  flex: 1;
  min-width: 0;
}

.admin-drop-zone-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-drop-zone.has-file .admin-drop-zone-label {
  color: var(--admin-success);
}

.admin-drop-zone-hint {
  font-size: 0.75rem;
  color: var(--admin-text-dim);
  margin-top: 2px;
}

.admin-drop-zone-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--admin-success);
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.admin-drop-zone.has-file .admin-drop-zone-check {
  display: flex;
}

.admin-drop-zone-check svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The actual file input is invisible over the zone */
.admin-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ── Submit button ───────────────────────────────────────────────── */

.admin-submit {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--admin-accent) 0%, #2563b8 100%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 13px 20px;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  transition: opacity 200ms ease, box-shadow 200ms ease, transform 120ms ease;
  box-shadow: 0 4px 16px rgba(74, 144, 232, 0.35);
}

.admin-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.admin-submit:hover {
  box-shadow: 0 6px 24px rgba(74, 144, 232, 0.5);
  transform: translateY(-1px);
}

.admin-submit:active { transform: translateY(0); }

.admin-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Divider between sections ────────────────────────────────────── */

.admin-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 16px;
  color: var(--admin-text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-divider::before,
.admin-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--admin-border);
}

/* ── Activate controls ───────────────────────────────────────────── */

.admin-activate-controls {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.admin-version-select {
  flex: 1;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 11px 36px 11px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--admin-text);
  background: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a90e8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.admin-version-select:focus {
  border-color: var(--admin-accent);
  background-color: rgba(74, 144, 232, 0.07);
  box-shadow: 0 0 0 3px var(--admin-accent-glow);
}

.admin-version-select option {
  background: #0d2a5e;
  color: #e8eef8;
}

.admin-activate-button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #cc1739 0%, #a81030 100%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 11px 22px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(204, 23, 57, 0.35);
  transition: box-shadow 200ms ease, transform 120ms ease, opacity 200ms ease;
}

.admin-activate-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.admin-activate-button:hover {
  box-shadow: 0 6px 22px rgba(204, 23, 57, 0.5);
  transform: translateY(-1px);
}

.admin-activate-button:active { transform: translateY(0); }

.admin-activate-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Status messages ─────────────────────────────────────────────── */

.admin-validation-result,
.admin-activate-result {
  margin-top: 14px;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
  animation: adminFadeIn 200ms ease both;
}

@keyframes adminFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.admin-validation-result.is-success,
.admin-activate-result.is-success {
  background: var(--admin-success-bg);
  border: 1px solid var(--admin-success-bd);
  color: var(--admin-success);
}

.admin-validation-result.is-error,
.admin-activate-result.is-error {
  background: var(--admin-error-bg);
  border: 1px solid var(--admin-error-bd);
  color: var(--admin-error);
}

.admin-validation-result.is-info,
.admin-activate-result.is-info {
  background: rgba(74, 144, 232, 0.1);
  border: 1px solid rgba(74, 144, 232, 0.28);
  color: var(--admin-accent);
}

/* Spinner for activating state */
.admin-activate-result.is-info::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(74, 144, 232, 0.3);
  border-top-color: var(--admin-accent);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  animation: adminSpin 700ms linear infinite;
}

@keyframes adminSpin {
  to { transform: rotate(360deg); }
}

/* ── Empty state for dropdown ────────────────────────────────────── */

.admin-empty-hint {
  font-size: 0.82rem;
  color: var(--admin-text-dim);
  font-style: italic;
  text-align: center;
  padding: 10px 0;
}

/* ── Panel open animation ────────────────────────────────────────── */

#section-admin:not(.hidden) .admin-panel-inner {
  animation: adminSlideIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes adminSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .admin-panel {
    padding: 80px 14px 48px;
  }

  .admin-row-2 {
    grid-template-columns: 1fr;
  }

  .admin-activate-controls {
    flex-direction: column;
  }

  .admin-activate-button {
    text-align: center;
  }
}
