/* base.css — Core styles: body, fonts, animations, toast, hub cards */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

    body {
      font-family: 'Inter', sans-serif;
      margin: 0;
      padding: 0;
      background-color: #0f172a;
      /* slate-900 */
      color: #f1f5f9;
      /* slate-100 */
      overflow-x: hidden;
    }

    @keyframes successBounce {

      0%,
      20%,
      50%,
      80%,
      100% {
        transform: translateY(0) scale(1.03);
      }

      40% {
        transform: translateY(-15px) scale(1.03);
      }

      60% {
        transform: translateY(-7px) scale(1.03);
      }
    }

    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }

      100% {
        transform: rotate(360deg);
      }
    }


    .wrong-cross::before,
    .wrong-cross::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 60%;
      height: 12px;
      background-color: rgba(239, 68, 68, 0.7);
      border-radius: 6px;
      transform-origin: center;
      z-index: 20;
    }

    .wrong-cross::before {
      transform: translate(-50%, -50%) rotate(45deg);
    }

    .wrong-cross::after {
      transform: translate(-50%, -50%) rotate(-45deg);
    }

    .wrong-ban::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 80px;
      height: 80px;
      border: 12px solid rgba(239, 68, 68, 0.7);
      border-radius: 50%;
      transform: translate(-50%, -50%);
      z-index: 20;
    }

    .wrong-ban::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 80px;
      height: 12px;
      background-color: rgba(239, 68, 68, 0.7);
      border-radius: 6px;
      transform: translate(-50%, -50%) rotate(-45deg);
      z-index: 20;
    }

    .wrong-question::before {
      content: '?';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-size: 100px;
      font-weight: 800;
      color: rgba(239, 68, 68, 0.7);
      z-index: 20;
      line-height: 1;
    }

    .wrong-dash::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 60%;
      height: 12px;
      background-color: rgba(239, 68, 68, 0.7);
      border-radius: 6px;
      transform: translate(-50%, -50%);
      z-index: 20;
    }

    #toast-container {
      position: fixed;
      bottom: 2rem;
      right: 2rem;
      z-index: 1000;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .toast {
      background: rgba(15, 23, 42, 0.9);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(51, 65, 85, 0.5);
      color: #f1f5f9;
      padding: 1rem 1.5rem;
      border-radius: 1rem;
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
      display: flex;
      align-items: center;
      gap: 0.75rem;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      transform: translateX(100%);
      opacity: 0;
    }

    .toast.show {
      transform: translateX(0);
      opacity: 1;
    }

    /* Hub Card Styling */
    .hub-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 1rem;
      width: 100%;
      max-width: 1100px;
      margin: 0 auto;
    }

    .hub-card {
      background: rgba(30, 41, 59, 0.4);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.05);
      border-radius: 1.5rem;
      padding: 1.5rem 1.25rem;
      text-align: center;
      transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
      cursor: pointer;
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.75rem;
    }

    .hub-card::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, var(--tw-gradient-from), var(--tw-gradient-to));
      opacity: 0;
      transition: opacity 0.5s ease;
      z-index: -1;
    }

    .hub-card:hover {
      transform: translateY(-10px) scale(1.02);
      border-color: rgba(255, 255, 255, 0.2);
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }

    .hub-card:hover::before {
      opacity: 0.1;
    }

    .hub-card .icon-box {
      width: 56px;
      height: 56px;
      border-radius: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 0.1rem;
      transition: all 0.5s ease;
      background: rgba(15, 23, 42, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hub-card .icon-box svg {
      width: 28px;
      height: 28px;
    }

    .hub-card:hover .icon-box {
      transform: rotate(12deg) scale(1.1);
      background: var(--tw-gradient-from);
      color: white;
      box-shadow: 0 0 20px var(--tw-gradient-from);
    }

    .hub-card h3 {
      font-size: 1rem;
      font-weight: 800;
      color: #f1f5f9;
      letter-spacing: -0.025em;
    }

    .hub-card p {
      font-size: 0.78rem;
      color: #94a3b8;
      line-height: 1.4;
    }


/* Math Game Styles */
    #math-game-viewport {
      position: relative;
      width: 100%;
      height: 600px;
      background: #1e1b4b;
      /* deep indigo */
      border-radius: 2rem;
      overflow: hidden;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .math-bubble {
      position: absolute;
      width: 120px;
      height: 120px;
      background: white;
      border: 8px solid #3b82f6;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2.5rem;
      font-weight: 900;
      color: #1e293b;
      cursor: pointer;
      user-select: none;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .math-bubble:hover {
      transform: scale(1.1);
      box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
    }


/* Win Overlay (Peppa) */
    /* Win Overlay */
    #peppa-win-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.95);
      backdrop-filter: blur(16px);
      z-index: 20000;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #peppa-win-overlay.show {
      opacity: 1;
      pointer-events: auto;
    }

    /* Cinematic Victory Animations */
    .peppa-bus.victory-hero {
      left: 50% !important;
      top: 55.7% !important;
      /* Centered in Middle Lane */
      transform: translate(-50%, -50%) rotateX(-45deg) translateZ(150px) scale(2) !important;
      transition: all 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
      z-index: 50000 !important;
    }

    .peppa-celebration-friend {
      position: absolute;
      width: 10vw;
      height: 10vw;
      z-index: 60000;
      pointer-events: none;
      background-size: contain;
      background-repeat: no-repeat;
      background-position: bottom center;
      filter: url(#sticker-border);
      transform: translateY(40px) scale(0);
      opacity: 0;
      transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    }

    .peppa-celebration-friend.visible {
      transform: translateY(0) scale(1);
      opacity: 1;
    }

    .win-card {
      background: linear-gradient(135deg, #1e293b, #0f172a);
      border: 2px solid rgba(16, 185, 129, 0.3);
      border-radius: 3rem;
      padding: 4rem;
      text-align: center;
      max-width: 500px;
      width: 90%;
      box-shadow: 0 0 100px rgba(16, 185, 129, 0.15);
      transform: scale(0.8) translateY(20px);
      transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    #peppa-win-overlay.show .win-card {
      transform: scale(1) translateY(0);
    }

    .victory-badge {
      width: 120px;
      height: 120px;
      background: #10b981;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 2rem;
      box-shadow: 0 0 40px rgba(16, 185, 129, 0.5);
      animation: badgePulse 2s infinite;
    }

    @keyframes badgePulse {

      0%,
      100% {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.5);
      }

      50% {
        transform: scale(1.1);
        box-shadow: 0 0 80px rgba(16, 185, 129, 0.7);
      }
    }

/* Win Card */
    .win-card {
      background: linear-gradient(135deg, #1e293b, #0f172a);
      border: 2px solid rgba(16, 185, 129, 0.3);
      border-radius: 3rem;
      padding: 4rem;
      text-align: center;
      max-width: 500px;
      width: 90%;
      box-shadow: 0 0 100px rgba(16, 185, 129, 0.15);
      transform: scale(0.8) translateY(20px);
      transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    #peppa-win-overlay.show .win-card {
      transform: scale(1) translateY(0);
    }

    .victory-badge {
      width: 120px;
      height: 120px;
      background: #10b981;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 2rem;
      box-shadow: 0 0 40px rgba(16, 185, 129, 0.5);
      animation: badgePulse 2s infinite;
    }

    @keyframes badgePulse {

      0%,
      100% {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.5);
      }

      50% {
        transform: scale(1.1);
        box-shadow: 0 0 80px rgba(16, 185, 129, 0.7);
      }
    }

/* ============================================================
   ADMIN PANEL STYLES
   ============================================================ */

#view-admin {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 4rem;
}

.admin-title {
  font-size: 1.75rem;
  font-weight: 900;
  background: linear-gradient(90deg, #f87171, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.admin-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #f87171;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

/* Stats row */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 1.25rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: #f1f5f9;
  line-height: 1;
}

.admin-stat-value.red    { color: #f87171; }
.admin-stat-value.purple { color: #c084fc; }
.admin-stat-value.emerald{ color: #34d399; }
.admin-stat-value.blue   { color: #60a5fa; }

/* Search + filter bar */
.admin-search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.admin-search-input {
  flex: 1;
  min-width: 200px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 0.875rem;
  padding: 0.6rem 1rem;
  color: #f1f5f9;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-search-input:focus {
  border-color: #c084fc;
  box-shadow: 0 0 0 3px rgba(192,132,252,0.15);
}

.admin-search-input::placeholder { color: #475569; }

/* Users table */
.admin-table-wrap {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 1.5rem;
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.admin-table thead th {
  background: rgba(30, 41, 59, 0.8);
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(51,65,85,0.4);
}

.admin-table tbody tr {
  border-bottom: 1px solid rgba(51,65,85,0.2);
  transition: background 0.15s;
}

.admin-table tbody tr:last-child { border-bottom: none; }

.admin-table tbody tr:hover { background: rgba(30,41,59,0.5); }

.admin-table td {
  padding: 0.875rem 1rem;
  vertical-align: middle;
  color: #cbd5e1;
}

.admin-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.admin-email-cell { display: flex; align-items: center; }

.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-pill.admin-yes {
  background: rgba(220,38,38,0.15);
  border: 1px solid rgba(220,38,38,0.35);
  color: #fca5a5;
}

.admin-pill.admin-no {
  background: rgba(51,65,85,0.3);
  border: 1px solid rgba(51,65,85,0.4);
  color: #64748b;
}

.admin-pill.active {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  color: #34d399;
}

/* Action buttons in table */
.admin-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  background: none;
}

.admin-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.admin-action-btn.view  { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #93c5fd; }
.admin-action-btn.view:hover { background: rgba(59,130,246,0.2); }

.admin-action-btn.edit  { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.admin-action-btn.edit:hover { background: rgba(245,158,11,0.2); }

.admin-action-btn.grant { background: rgba(220,38,38,0.1); border-color: rgba(220,38,38,0.3); color: #fca5a5; }
.admin-action-btn.grant:hover { background: rgba(220,38,38,0.2); }

.admin-action-btn.revoke{ background: rgba(100,116,139,0.1); border-color: rgba(100,116,139,0.3); color: #94a3b8; }
.admin-action-btn.revoke:hover { background: rgba(100,116,139,0.2); }

.admin-action-btn.delete{ background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); color: #f87171; }
.admin-action-btn.delete:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.5); }

.admin-actions-cell { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* Admin content viewer modal */
#admin-content-modal {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

#admin-content-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-box {
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.75rem;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
}

#admin-content-modal.open .admin-modal-box { transform: scale(1); }

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(51,65,85,0.4);
  padding-bottom: 1rem;
}

.admin-modal-title { font-size: 1.1rem; font-weight: 800; color: #f1f5f9; }

.admin-modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(51,65,85,0.4);
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 1rem;
  line-height: 1;
}
.admin-modal-close:hover { background: rgba(239,68,68,0.2); color: #f87171; }

/* Q&A viewer */
.admin-qa-list { display: flex; flex-direction: column; gap: 1rem; }

.admin-qa-card {
  background: rgba(30,41,59,0.5);
  border: 1px solid rgba(51,65,85,0.35);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
}

.admin-qa-question { font-size: 0.875rem; font-weight: 700; color: #e2e8f0; margin-bottom: 0.5rem; }

.admin-qa-answers { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.admin-qa-answer {
  padding: 0.25rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(51,65,85,0.4);
  border: 1px solid rgba(51,65,85,0.4);
  color: #94a3b8;
}

.admin-qa-answer.correct {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.35);
  color: #34d399;
}

/* Activity log */
.admin-activity-list { display: flex; flex-direction: column; gap: 0.5rem; }

.admin-activity-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(51,65,85,0.2);
}

.admin-activity-row:last-child { border-bottom: none; }

.admin-activity-time { color: #475569; white-space: nowrap; font-family: monospace; flex-shrink: 0; font-size: 0.68rem; }

.admin-activity-type {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.admin-activity-type.login   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.admin-activity-type.logout  { background: rgba(100,116,139,0.15); color: #94a3b8; }
.admin-activity-type.content { background: rgba(245,158,11,0.15); color: #fcd34d; }
.admin-activity-type.quiz    { background: rgba(139,92,246,0.15); color: #c4b5fd; }

/* Empty state */
.admin-empty { text-align: center; padding: 3rem 1rem; color: #475569; font-size: 0.875rem; }

/* Loading spinner */
.admin-spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(192,132,252,0.2);
  border-top-color: #c084fc;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Section tabs inside modal */
.admin-modal-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.admin-modal-tab {
  padding: 0.4rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(51,65,85,0.4);
  background: rgba(30,41,59,0.4);
  color: #64748b;
  transition: all 0.15s;
}

.admin-modal-tab.active {
  background: rgba(192,132,252,0.15);
  border-color: rgba(192,132,252,0.4);
  color: #c084fc;
}

/* Hub card admin highlight */
#admin-hub-card {
  position: relative;
}
