/* ============================================================
   AFCO BOTSWANA — ADMIN STYLES
   ============================================================ */

.admin-body {
  font-family: 'Lato', sans-serif;
  background: #f0f2f7;
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   LOGIN SCREEN — split-panel layout
   ============================================================ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: #0a1628;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(212, 175, 55, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(37, 81, 160, 0.25) 0%, transparent 50%),
    linear-gradient(155deg, #081320 0%, #0d1f3c 40%, #152c55 100%);
}

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 920px;
  min-height: 580px;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.05),
    0 24px 80px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(212, 175, 55, 0.15);
}

/* ── Brand panel (left) ── */
.login-panel-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 2.25rem;
  background: linear-gradient(160deg, #0a1628 0%, #102447 55%, #0d1f3c 100%);
  color: #fff;
  overflow: hidden;
}

.login-panel-brand::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.07);
  pointer-events: none;
}

.login-brand-inner {
  position: relative;
  z-index: 1;
}

.login-emblem {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.login-brand-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 0.65rem;
}

.login-brand-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: #fff;
}

.login-brand-title em {
  color: #d4af37;
  font-style: italic;
}

.login-brand-tagline {
  font-size: 0.92rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 1.75rem;
  max-width: 280px;
}

.login-brand-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.login-brand-features li {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.8);
  padding-left: 1.25rem;
  position: relative;
}

.login-brand-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d4af37;
}

.login-brand-footer {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
}

/* ── Form panel (right) ── */
.login-panel-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2.5rem;
  background: #fff;
  overflow-y: auto;
}

.login-form-inner {
  width: 100%;
  max-width: 360px;
}

.login-form-header {
  margin-bottom: 1.75rem;
}

.login-form-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #0a1628;
  margin: 0 0 0.4rem;
}

.login-form-header p {
  font-size: 0.9rem;
  color: #7a8aaa;
  margin: 0;
  line-height: 1.5;
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: 1.15rem;
}

.login-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.login-field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #152c55;
  margin-bottom: 0.4rem;
}

.login-label-row label {
  margin-bottom: 0;
}

.login-field label .req {
  color: #c0392b;
}

.login-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border: 1.5px solid #dde3ef;
  border-radius: 10px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  color: #0a1628;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-field input::placeholder {
  color: #aab4c8;
}

.login-field input:focus {
  outline: none;
  border-color: #152c55;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(21, 44, 85, 0.08);
}

.login-field.has-error input {
  border-color: #e74c3c;
  background: #fff8f8;
}

.field-error {
  display: block;
  min-height: 1rem;
  font-size: 0.78rem;
  color: #c0392b;
  margin-top: 0.35rem;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 3rem;
}

.pwd-toggle {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: #7a8aaa;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.pwd-toggle:hover {
  color: #152c55;
  background: rgba(21, 44, 85, 0.06);
}

.pwd-icon-show[hidden],
.pwd-icon-hide[hidden] {
  display: none;
}

.forgot-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7a8aaa;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  white-space: nowrap;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: #d4af37;
}

.login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.95rem 1.25rem;
  background: linear-gradient(135deg, #0a1628 0%, #1a3a6b 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Lato', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 14px rgba(10, 22, 40, 0.25);
}

.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(10, 22, 40, 0.35);
}

.login-submit:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-msg {
  display: none;
  margin-bottom: 1.25rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.login-msg.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.login-msg.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.login-footer-links {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eef1f7;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #7a8aaa;
  text-decoration: none;
  transition: color 0.2s;
}

.login-back:hover {
  color: #0a1628;
}

.login-back-gold {
  color: #b8860b !important;
  font-weight: 600;
}

@media (max-width: 768px) {
  .login-screen {
    padding: 0;
    align-items: stretch;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    max-width: none;
    border-radius: 0;
    border: none;
  }

  .login-panel-brand {
    padding: 2rem 1.5rem 1.5rem;
    min-height: auto;
  }

  .login-brand-tagline,
  .login-brand-features {
    display: none;
  }

  .login-brand-footer {
    display: none;
  }

  .login-panel-form {
    padding: 2rem 1.5rem 2.5rem;
    flex: 1;
  }

  .login-form-inner {
    max-width: none;
  }
}

@media (max-width: 380px) {
  .login-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Login-page primary button (dashboard uses .admin-btn-primary below) */
.login-panel-form .admin-btn-primary {
  width: 100%;
}

.admin-btn-primary {
  padding: 0.65rem 1.25rem;
  background: linear-gradient(135deg, #0a1628 0%, #1a3a6b 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.admin-btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.admin-btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.admin-btn-secondary {
  padding: 0.65rem 1.25rem;
  background: #eef1f7;
  color: #0a1628;
  border: 1.5px solid #dde3ef;
  border-radius: 6px;
  font-family: 'Lato', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-btn-secondary:hover { background: #dde3ef; }

/* ============================================================
   ADMIN APP LAYOUT
   ============================================================ */
.admin-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #0a1628;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand .logo-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.sidebar-brand .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: lighten;
}
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.sidebar-link.active { background: rgba(212,175,55,0.15); color: #D4AF37; }
.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Main */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-topbar {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.admin-topbar h2 {
  font-family: 'Lato', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0a1628;
}
.admin-datetime { font-size: 0.82rem; color: #7a8aaa; }

.admin-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}
.admin-tab-content.active { display: block; }

/* Cards */
.admin-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.75rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}
.admin-card h3 {
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #0a1628;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #eef1f7;
}

/* Form elements */
.aform-group { margin-bottom: 1.1rem; }
.aform-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #152c55;
  margin-bottom: 0.35rem;
}
.aform-group input,
.aform-group textarea,
.aform-group select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #dde3ef;
  border-radius: 6px;
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  color: #0a1628;
  background: #f8f9fc;
  transition: border-color 0.2s;
}
.aform-group input:focus,
.aform-group textarea:focus,
.aform-group select:focus {
  outline: none;
  border-color: #152c55;
  background: #fff;
}
.aform-group textarea { resize: vertical; min-height: 80px; }
.aform-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Dashboard */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border-top: 4px solid #D4AF37;
}
.stat-num {
  font-size: 2.5rem;
  font-weight: 700;
  color: #0a1628;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.stat-label { font-size: 0.82rem; color: #7a8aaa; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.dash-info h3 { font-size: 0.95rem; font-weight: 700; color: #0a1628; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.06em; }
.quick-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.quick-btn {
  padding: 0.65rem 1.25rem;
  background: #0a1628;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.quick-btn:hover { background: #152c55; }

/* Two column layout */
.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Event list items */
.admin-event-item {
  padding: 1rem;
  border: 1px solid #eef1f7;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border-left: 4px solid #D4AF37;
}
.admin-event-item-title { font-weight: 700; color: #0a1628; font-size: 0.9rem; margin-bottom: 0.3rem; }
.admin-event-item-meta { font-size: 0.8rem; color: #7a8aaa; margin-bottom: 0.75rem; }
.admin-event-item-actions { display: flex; gap: 0.5rem; }
.admin-event-item-actions button {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.admin-event-item-actions button:hover { opacity: 0.85; }
.btn-edit { background: #e8f0fe; color: #152c55; }
.btn-delete { background: #fef2f2; color: #dc2626; }

/* Registrations table */
.reg-table { width: 100%; border-collapse: collapse; }
.reg-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a8aaa;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eef1f7;
  background: #f8f9fc;
}
.reg-table td {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: #0a1628;
  border-bottom: 1px solid #f0f2f7;
}
.reg-table tr:hover td { background: #f8f9fc; }

/* Gallery admin */
.gallery-admin-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid #eef1f7;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.gallery-admin-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.gallery-admin-item-info { flex: 1; }
.gallery-admin-item-info p { font-size: 0.85rem; color: #0a1628; font-weight: 600; }
.gallery-admin-item-info span { font-size: 0.78rem; color: #7a8aaa; }

.empty-state { color: #aab0c0; font-size: 0.9rem; text-align: center; padding: 2rem; }

/* Responsive admin */
@media (max-width: 900px) {
  .admin-two-col { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .admin-sidebar { display: none; }
  .dash-stats { grid-template-columns: 1fr; }
}

/* ── SVG nav icons & realtime indicator ── */
.nav-icon { flex-shrink: 0; opacity: 0.85; }
.sidebar-link.active .nav-icon { opacity: 1; color: #D4AF37; }
.meta-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.5rem;
}
.btn-edit,
.btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.realtime-status {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.25);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.realtime-status.pulse {
  transform: scale(1.04);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.15);
}

.img-upload-preview {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8edf5;
  background: #f8fafc;
}

.img-upload-preview-label {
  display: block;
  font-size: 0.72rem;
  color: #8899aa;
  padding: 0.35rem 0.75rem;
  border-top: 1px solid #e8edf5;
}

/* ── Page Sections admin tab ── */
.sections-admin-card { max-width: 900px; }
.sections-intro {
  color: #667;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}
.sections-page-group { margin-bottom: 2rem; }
.sections-page-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8899aa;
  margin: 0 0 0.75rem;
}
.sections-panel {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.sections-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid #e8edf5;
  flex-wrap: wrap;
}
.sections-panel-head strong { display: block; color: #1a2a44; }
.sections-count {
  font-size: 0.78rem;
  color: #8899aa;
  font-weight: 400;
}
.sections-items { padding: 0.5rem; }
.sections-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  border-radius: 8px;
  transition: background 0.15s;
}
.sections-item:hover { background: #f5f8fc; }
.sections-item-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.sections-item-body { flex: 1; min-width: 0; }
.sections-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1a2a44;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sections-item-meta {
  font-size: 0.78rem;
  color: #8899aa;
  margin-top: 0.15rem;
}
.sections-item-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.sections-add-btn { white-space: nowrap; }

/* Section edit modal (admin) */
.admin-section-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 22, 40, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.admin-section-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.admin-section-modal .live-edit-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}
.admin-section-modal .live-edit-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: #999;
  line-height: 1;
}
.admin-section-modal .live-edit-hint {
  font-size: 0.82rem;
  color: #667;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.admin-section-modal .live-edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.admin-section-modal .form-group { margin-bottom: 1rem; }
.admin-section-modal .form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #445;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.admin-section-modal .form-group input,
.admin-section-modal .form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #dde3ed;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.admin-section-modal .form-group textarea { resize: vertical; min-height: 80px; }
