/* ============================================================
   GLOBAL STYLES — All Star Strategy
   ============================================================ */

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

:root {
  --bg-dark:        #0a0a0f;
  --bg-panel:       #12121a;
  --bg-card:        #1a1a2e;
  --bg-card-hover:  #1f1f38;
  --accent:         #7c3aed;
  --accent-glow:    #a855f7;
  --accent-light:   #c084fc;
  --gold:           #f59e0b;
  --gold-light:     #fcd34d;
  --red:            #ef4444;
  --green:          #22c55e;
  --blue:           #3b82f6;
  --yellow:         #eab308;
  --dark-el:        #6d28d9;
  --light-el:       #fde68a;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --border:         #2d2d44;
  --border-glow:    #7c3aed55;
  --rarity-r:       #94a3b8;
  --rarity-sr:      #22c55e;
  --rarity-ssr:     #3b82f6;
  --rarity-ur:      #a855f7;
  --rarity-lr:      #f59e0b;
  --rarity-mr:      #ef4444;
  --rarity-mr-glow: #ef444480;
  --shadow:         0 4px 24px rgba(0,0,0,0.6);
  --glow:           0 0 20px rgba(124,58,237,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ── Typography ── */
h1, h2, h3, .title-font { font-family: 'Orbitron', sans-serif; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 28px;
  border: none; border-radius: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem; font-weight: 700; letter-spacing: 1px;
  cursor: pointer; transition: all 0.2s ease;
  text-transform: uppercase;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: #fff;
  box-shadow: 0 4px 15px rgba(124,58,237,0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(124,58,237,0.6);
}
.btn-gold {
  background: linear-gradient(135deg, #b45309, var(--gold));
  color: #fff;
  box-shadow: 0 4px 15px rgba(245,158,11,0.4);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(245,158,11,0.6); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent-light);
}
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #b91c1c, var(--red)); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.15rem; }
.btn-full { width: 100%; }

/* ── Inputs ── */
.input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.input-group label { font-size: 0.85rem; color: var(--text-secondary); letter-spacing: 1px; text-transform: uppercase; }
.input-field {
  background: var(--bg-dark);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s;
  width: 100%;
}
.input-field:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.input-field::placeholder { color: var(--text-muted); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
}
.card:hover { border-color: var(--border-glow); box-shadow: var(--glow); }

/* ── Rarity Colors ── */
.rarity-r   { color: var(--rarity-r);  border-color: var(--rarity-r); }
.rarity-sr  { color: var(--rarity-sr); border-color: var(--rarity-sr); }
.rarity-ssr { color: var(--rarity-ssr);border-color: var(--rarity-ssr); }
.rarity-ur  { color: var(--rarity-ur); border-color: var(--rarity-ur); }
.rarity-lr  { color: var(--rarity-lr); border-color: var(--rarity-lr); }
.rarity-mr  { color: var(--rarity-mr); border-color: var(--rarity-mr);
              text-shadow: 0 0 8px var(--rarity-mr-glow);
              box-shadow: 0 0 10px var(--rarity-mr-glow); }

.rarity-badge {
  display: inline-block;
  padding: 2px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 1px;
  border: 1px solid;
}
.rarity-badge.rarity-r   { background: #94a3b820; }
.rarity-badge.rarity-sr  { background: #22c55e20; }
.rarity-badge.rarity-ssr { background: #3b82f620; }
.rarity-badge.rarity-ur  { background: #a855f720; }
.rarity-badge.rarity-lr  { background: #f59e0b20; }

/* ── Element Badges ── */
.el-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 1px;
}
.el-fire   { background: #ef444420; color: #f87171; border: 1px solid #ef4444; }
.el-water  { background: #3b82f620; color: #60a5fa; border: 1px solid #3b82f6; }
.el-wind   { background: #22c55e20; color: #4ade80; border: 1px solid #22c55e; }
.el-light  { background: #fde68a20; color: #fde68a; border: 1px solid #fde68a; }
.el-dark   { background: #6d28d920; color: #c084fc; border: 1px solid #6d28d9; }
.el-earth  { background: #f59e0b20; color: #fcd34d; border: 1px solid #f59e0b; }

/* ── Toast Notifications ── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 20px;
  min-width: 260px; max-width: 360px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  font-size: 0.95rem;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--accent); }
.toast.gold    { border-left: 4px solid var(--gold); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }

/* ── Loading Spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, #0f0520 0%, #080010 60%, #000 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0;
  z-index: 9998;
  overflow: hidden;
}

.loading-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, #7c3aed10 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, #4f46e510 0%, transparent 50%);
  animation: loadingBg 4s ease-in-out infinite alternate;
}

@keyframes loadingBg {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

.loading-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa, #818cf8, #f59e0b, #a78bfa);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logoShimmer 3s ease-in-out infinite;
  letter-spacing: 3px;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
  text-align: center;
}

@keyframes logoShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.loading-tagline {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  color: #64748b;
  letter-spacing: 4px;
  margin-bottom: 50px;
  position: relative;
  z-index: 1;
}

.loading-stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.loading-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  animation: starTwinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
  opacity: 0;
}

@keyframes starTwinkle {
  0%,100% { opacity: 0;   transform: scale(0.5); }
  50%      { opacity: 0.8; transform: scale(1.5); }
}

/* ── Top Nav Bar ── */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.top-bar .game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem; font-weight: 900;
  background: linear-gradient(135deg, var(--accent-light), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
}
.top-bar .currency-display {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px;
  font-size: 0.9rem; font-weight: 700;
}
.currency-display .gem-icon { font-size: 1rem; }
.currency-display .gold-icon { font-size: 1rem; }

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 100;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text-muted);
  font-size: 0.65rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; cursor: pointer; padding: 8px 12px;
  transition: all 0.2s; border-radius: 8px;
}
.nav-btn .nav-icon { font-size: 1.4rem; }
.nav-btn:hover, .nav-btn.active { color: var(--accent-light); }
.nav-btn.active .nav-icon { filter: drop-shadow(0 0 6px var(--accent)); }

/* ── Page wrapper ── */
.page {
  padding-top: 70px; padding-bottom: 74px;
  min-height: 100vh;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  padding: 16px;
  overflow-y: auto;
}
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px; width: 100%; max-width: 480px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: popIn 0.2s ease;
  margin: auto;
}
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem; margin-bottom: 20px;
  color: var(--accent-light);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.4rem; cursor: pointer;
}

/* ── Divider ── */
.divider {
  height: 1px; background: var(--border);
  margin: 20px 0;
}

/* ── Utility ── */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-accent { color: var(--accent-light); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============================================================
   LOGIN / SIGNUP PAGE
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(245,158,11,0.1) 0%, transparent 50%),
    var(--bg-dark);
}
.auth-logo {
  text-align: center; margin-bottom: 32px;
}
.auth-logo .logo-emoji { font-size: 4rem; display: block; margin-bottom: 8px; }
.auth-logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem; font-weight: 900;
  background: linear-gradient(135deg, var(--accent-light), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; }

.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow), var(--glow);
}

.auth-tabs {
  display: flex; gap: 0;
  background: var(--bg-dark); border-radius: 8px;
  padding: 4px; margin-bottom: 24px;
}
.auth-tab {
  flex: 1; padding: 10px;
  background: none; border: none; border-radius: 6px;
  color: var(--text-muted); font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; cursor: pointer; transition: all 0.2s;
}
.auth-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(124,58,237,0.4);
}

.auth-form { display: flex; flex-direction: column; }
.auth-form .hidden { display: none; }

.auth-error {
  background: #ef444420; border: 1px solid var(--red);
  border-radius: 8px; padding: 10px 14px;
  color: #fca5a5; font-size: 0.9rem;
  margin-bottom: 16px; display: none;
}
.auth-error.show { display: block; }

.auth-footer {
  text-align: center; margin-top: 20px;
  color: var(--text-muted); font-size: 0.85rem;
}

/* Starting banner on signup */
.starter-banner {
  background: linear-gradient(135deg, var(--bg-card), #1e1b4b);
  border: 1px solid var(--accent);
  border-radius: 12px; padding: 16px;
  margin-top: 20px; text-align: center;
  display: none;
}
.starter-banner.show { display: block; }
.starter-banner h3 { font-size: 1rem; color: var(--accent-light); margin-bottom: 8px; }
.starter-banner p { font-size: 0.85rem; color: var(--text-secondary); }
.starter-unit {
  font-size: 3rem; margin: 10px 0;
}

/* ── Nametag effect classes (global — used on leaderboard, friends, battle) ── */
.nametag-glow    { text-shadow: 0 0 10px currentColor; }
.nametag-rainbow { background: linear-gradient(90deg,#f87171,#fcd34d,#4ade80,#60a5fa,#c084fc); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.nametag-fire    { background: linear-gradient(90deg,#ef4444,#f97316,#fcd34d); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.nametag-ice     { background: linear-gradient(90deg,#bae6fd,#60a5fa,#e0f2fe); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.nametag-gold    { background: linear-gradient(90deg,#b45309,#f59e0b,#fcd34d); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.nametag-shadow  { color: #a78bfa; text-shadow: 2px 2px 8px #7c3aed, -1px -1px 4px #4c1d95; }
.nametag-divine  { background: linear-gradient(90deg,#fde68a,#fcd34d,#fff,#fcd34d); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; filter:drop-shadow(0 0 6px gold); }

/* ── VIP exclusive nametag styles ─────────────────────────── */
.nametag-vip3    { color: #94a3b8; filter: drop-shadow(0 0 4px #94a3b860); }
.nametag-vip7    { color: #a78bfa; filter: drop-shadow(0 0 6px #a78bfa80); animation: vipGlow 2s ease-in-out infinite; }
.nametag-vip10   { background: linear-gradient(90deg,#f59e0b,#fcd34d,#f59e0b); background-size:200%; -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; animation: shimmer 2s linear infinite; }
.nametag-vip15   { background: linear-gradient(90deg,#f43f5e,#f97316,#f43f5e); background-size:200%; -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; animation: shimmer 2s linear infinite; }
.nametag-vip16   { background: linear-gradient(90deg,#f43f5e,#f97316,#eab308,#22c55e,#3b82f6,#a855f7,#f43f5e); background-size:300%; -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; animation: shimmer 1.5s linear infinite; }
/* Bundle nametags */
.nametag-warrior { color: #ef4444; filter: drop-shadow(0 0 6px #ef444480); font-weight: 900; }
.nametag-legend  { background: linear-gradient(90deg,#f59e0b,#fbbf24,#f59e0b); background-size:200%; -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; animation: shimmer 2s linear infinite; font-weight: 900; }
.nametag-supreme { background: linear-gradient(90deg,#a855f7,#ec4899,#a855f7); background-size:200%; -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; animation: shimmer 1.5s linear infinite; font-weight: 900; }

@keyframes vipGlow { 0%,100% { filter: drop-shadow(0 0 4px #a78bfa60); } 50% { filter: drop-shadow(0 0 10px #a78bfacc); } }

/* ── MR Unit Card — Red Divine Glow ──────────────────────────── */
@keyframes mr-pulse {
  0%,100% { box-shadow: 0 0 20px #ef444460, 0 0 40px #ef444430, 0 0 60px #ef444415;
             border-color: #ef4444; }
  50%      { box-shadow: 0 0 30px #ef4444aa, 0 0 60px #ef444455, 0 0 90px #ef444430;
             border-color: #ff6666; }
}
@keyframes mr-bg-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.summon-card-mr, .unit-card-mr {
  animation: mr-pulse 2s ease-in-out infinite !important;
  background: linear-gradient(135deg, #1a0000, #2d0000, #4a0000, #2d0000) !important;
  background-size: 300% 300% !important;
}
.rarity-mr-glow {
  animation: mr-pulse 1.5s ease-in-out infinite;
  border-radius: 12px;
}

@keyframes shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }

/* ── Mobile top bar ──────────────────────────────────────────── */
.top-bar-desktop-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.top-bar-more-btn {
  display: none; /* hidden on desktop */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 14px;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  letter-spacing: 2px;
}

.mobile-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.mobile-menu-item:active {
  background: var(--bg-panel);
  border-color: var(--accent);
}

/* On mobile: hide desktop icons, show the ⋯ button */
@media (max-width: 600px) {
  .top-bar-desktop-icons { display: none !important; }
  .top-bar-more-btn      { display: flex !important; }
}

/* On desktop: hide the ⋯ button, show all icons */
@media (min-width: 601px) {
  .top-bar-desktop-icons { display: flex !important; }
  .top-bar-more-btn      { display: none !important; }
}

/* ── Notification dots ──────────────────────────────────────── */
.nav-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
  background: var(--red, #ef4444);
  border-radius: 50%;
  border: 1.5px solid var(--bg-panel);
  pointer-events: none;
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.8; }
}
