/* =====================================================
   Rocket Examica — Periodic Table Game
   CSS Theme System
   Product of Tech Eagles | Mahakumbrix Innovation
===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Nunito:wght@400;500;600;700;800&display=swap');

/* ---- CSS Variables: Light Mode ---- */
:root {
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'Nunito', sans-serif;

  /* Brand */
  --brand-saffron: #FF6B00;
  --brand-navy: #0D2137;
  --brand-gold: #FFC107;
  --brand-cream: #FFF8F0;

  /* Background */
  --bg-page: #F4F6FB;
  --bg-card: #FFFFFF;
  --bg-card2: #F8F9FE;
  --bg-nav: #0D2137;
  --bg-modal: rgba(13,33,55,0.85);

  /* Text */
  --text-primary: #0D2137;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --text-on-dark: #FFFFFF;
  --text-on-brand: #FFFFFF;

  /* Borders */
  --border: #E2E8F0;
  --border-hover: #CBD5E0;

  /* Element category colors */
  --c-alkali: #FF6B6B;
  --c-alkali-bg: #FFF5F5;
  --c-alkaline: #FF9F43;
  --c-alkaline-bg: #FFF7EC;
  --c-lanthanide: #00CEC9;
  --c-lanthanide-bg: #E8FFFE;
  --c-actinide: #6C5CE7;
  --c-actinide-bg: #F0EEFF;
  --c-transition: #4A90D9;
  --c-transition-bg: #EBF4FF;
  --c-post-transition: #78909C;
  --c-post-transition-bg: #F0F4F7;
  --c-metalloid: #26D0A8;
  --c-metalloid-bg: #E8FFF9;
  --c-nonmetal: #54A0FF;
  --c-nonmetal-bg: #EBF5FF;
  --c-halogen: #1DD1A1;
  --c-halogen-bg: #E8FFF7;
  --c-noble: #A29BFE;
  --c-noble-bg: #F0EEFF;

  /* Game UI */
  --success: #00B894;
  --success-bg: #E8FFF7;
  --danger: #E74C3C;
  --danger-bg: #FFF0EF;
  --warning: #F39C12;
  --warning-bg: #FFF8EC;
  --info: #3498DB;
  --info-bg: #EBF5FB;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --shadow-card: 0 2px 8px rgba(13,33,55,0.08);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-mid: 0.25s ease;
  --t-slow: 0.4s ease;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
  --bg-page: #0A1628;
  --bg-card: #112240;
  --bg-card2: #0D1B33;
  --bg-nav: #060E1A;
  --bg-modal: rgba(0,0,0,0.88);

  --text-primary: #E8EEFA;
  --text-secondary: #A8B9D0;
  --text-muted: #6B7F96;
  --text-on-dark: #E8EEFA;

  --border: #1E3357;
  --border-hover: #2A4572;

  --c-alkali-bg: rgba(255,107,107,0.12);
  --c-alkaline-bg: rgba(255,159,67,0.12);
  --c-lanthanide-bg: rgba(0,206,201,0.10);
  --c-actinide-bg: rgba(108,92,231,0.12);
  --c-transition-bg: rgba(74,144,217,0.12);
  --c-post-transition-bg: rgba(120,144,156,0.12);
  --c-metalloid-bg: rgba(38,208,168,0.10);
  --c-nonmetal-bg: rgba(84,160,255,0.12);
  --c-halogen-bg: rgba(29,209,161,0.10);
  --c-noble-bg: rgba(162,155,254,0.12);

  --success-bg: rgba(0,184,148,0.12);
  --danger-bg: rgba(231,76,60,0.12);
  --warning-bg: rgba(243,156,18,0.12);
  --info-bg: rgba(52,152,219,0.12);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--t-mid), color var(--t-mid);
  overflow-x: hidden;
}

/* ---- Navigation ---- */
.navbar {
  background: var(--bg-nav);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: var(--brand-saffron);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
}

.brand-text { line-height: 1.2; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}
.brand-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--t-fast);
}
.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255,107,0,0.25);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.8);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.theme-toggle:hover { background: rgba(255,107,0,0.3); color: #fff; }

.btn-login {
  background: var(--brand-saffron);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--t-fast);
}
.btn-login:hover { background: #e55c00; transform: translateY(-1px); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--brand-saffron);
  object-fit: cover;
  cursor: pointer;
}
.user-name {
  color: rgba(255,255,255,0.9);
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Footer ---- */
.footer {
  background: var(--bg-nav);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  margin-top: auto;
}
.footer a { color: var(--brand-saffron); text-decoration: none; }
.footer .footer-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  color: rgba(255,255,255,0.8);
  font-weight: 700;
  margin-bottom: 4px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn-primary { background: var(--brand-saffron); color: #fff; }
.btn-primary:hover { background: #e55c00; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-card2); color: var(--text-primary); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--brand-saffron); color: var(--brand-saffron); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card2); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  transition: all var(--t-mid);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-hover:hover { transform: translateY(-2px); }

/* ---- Page Container ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
.page-header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.page-sub {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ---- Toast / Alert ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  min-width: 240px;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-modal);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  padding: 2rem;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--t-mid);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--bg-card2);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ---- Progress Bar ---- */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-saffron), var(--brand-gold));
  border-radius: var(--r-pill);
  transition: width var(--t-mid);
}

/* ---- Mobile Hamburger ---- */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: all var(--t-fast);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg-nav);
    padding: 1rem;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  }
  .hamburger { display: flex; }
  .page-title { font-size: 1.7rem; }
  .user-name { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 0.75rem; }
  .btn-lg { padding: 12px 20px; font-size: 0.95rem; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-saffron); }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-saffron { color: var(--brand-saffron); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
