/* ============================================================
   Altiora Analytics — Global Styles
   Premium dark UI · iOS-optimized · shared components
   ============================================================ */

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

:root {
  --navy:    #0A1628;
  --navy2:   #0E1E38;
  --blue:    #1A6FD8;
  --blue2:   #2280F0;
  --blue-lt: #6EB3FF;
  --white:   #FFFFFF;
  --gray:    #8FA3BF;
  --gray-dk: #5A7A9A;
  --light:   #EDF2FB;
  --green:   #4ADE80;
  --gold:    #F5C842;
  --card:    rgba(255,255,255,0.04);
  --card-hi: rgba(255,255,255,0.06);
  --border:  rgba(255,255,255,0.08);
  --border-hi: rgba(26,111,216,0.45);

  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow:    0 8px 30px rgba(0,0,0,0.35);
  --shadow-blue: 0 8px 30px rgba(26,111,216,0.35);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --nav-h: 68px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ── Base / iOS hardening ── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--navy);
  color: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; font-family: inherit; }
img { max-width: 100%; }
::selection { background: rgba(26,111,216,0.4); color: #fff; }

/* Prevent iOS auto-zoom on focus: inputs must be >=16px */
input, textarea, select, button { font-size: 16px; }

/* Subtle global background glow */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 80% -5%, rgba(26,111,216,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(26,111,216,0.08) 0%, transparent 60%);
}

/* ============================================================
   Auth loading guard — hides page until auth resolves
   ============================================================ */
html.az-loading body { visibility: hidden; }
html.az-loading::before {
  content: ''; position: fixed; inset: 0; z-index: 9999;
  background: var(--navy); visibility: visible;
}
html.az-loading::after {
  content: ''; position: fixed; top: 50%; left: 50%; z-index: 10000;
  width: 38px; height: 38px; margin: -19px 0 0 -19px; visibility: visible;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--blue-lt);
  border-radius: 50%;
  animation: az-spin 0.7s linear infinite;
}
@keyframes az-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Navigation
   ============================================================ */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(20px, 5vw, 48px);
  padding-top: calc(14px + var(--safe-t));
  background: rgba(10,22,40,0.72);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
nav.scrolled { background: rgba(10,22,40,0.92); border-bottom-color: rgba(255,255,255,0.12); }

.nav-logo { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.nav-logo img { height: 34px; width: auto; }
.nav-logo span { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.4px; white-space: nowrap; }

.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a {
  font-size: 0.92rem; font-weight: 500; color: var(--gray);
  position: relative; transition: color 0.2s var(--ease); padding: 4px 0;
}
.nav-links a:hover, .nav-links a.active { color: var(--white); }
.nav-links a.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--blue); border-radius: 2px;
}
.nav-premium { color: var(--gold) !important; font-weight: 600 !important; }
.nav-premium::before { content: '★'; margin-right: 5px; font-size: 0.8em; }

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

.btn-nav {
  background: var(--blue); color: var(--white);
  padding: 10px 22px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 600; white-space: nowrap;
  transition: background 0.2s var(--ease), transform 0.12s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 2px 14px rgba(26,111,216,0.3);
}
.btn-nav:hover { background: var(--blue2); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(26,111,216,0.45); }
.btn-nav:active { transform: translateY(0) scale(0.98); }

/* Account chip + dropdown */
.acct { position: relative; }
.acct-btn {
  display: flex; align-items: center; gap: 9px;
  background: var(--card-hi); border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 12px 5px 6px; cursor: pointer;
  color: var(--white); transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.acct-btn:hover { border-color: var(--border-hi); background: rgba(26,111,216,0.12); }
.acct-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--blue-lt));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: #fff; object-fit: cover;
}
.acct-name { font-size: 0.86rem; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-caret { font-size: 0.6rem; color: var(--gray); }
.acct-menu {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 230px;
  background: #0d1d36; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px; opacity: 0; visibility: hidden;
  transform: translateY(-6px); transition: all 0.18s var(--ease); z-index: 200;
}
.acct.open .acct-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.acct-menu .am-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.acct-menu .am-name { font-size: 0.92rem; font-weight: 700; }
.acct-menu .am-email { font-size: 0.78rem; color: var(--gray); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu .am-tier {
  display: inline-block; margin-top: 8px; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 100px;
}
.am-tier.free { background: rgba(143,163,191,0.15); color: var(--gray); }
.am-tier.premium { background: rgba(245,200,66,0.16); color: var(--gold); }
.acct-menu a, .acct-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 9px; border: none; background: none;
  color: var(--light); font-size: 0.88rem; font-weight: 500; cursor: pointer; text-align: left;
  transition: background 0.15s var(--ease);
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--card-hi); }
.acct-menu .am-signout { color: #FF8B8B; }

/* Hamburger (mobile) */
.nav-burger {
  display: none; width: 42px; height: 42px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card-hi); cursor: pointer;
  position: relative; flex-shrink: 0;
}
.nav-burger span, .nav-burger span::before, .nav-burger span::after {
  content: ''; position: absolute; left: 50%; width: 18px; height: 2px;
  background: var(--white); border-radius: 2px; transition: 0.25s var(--ease); transform: translateX(-50%);
}
.nav-burger span { top: 50%; margin-top: -1px; }
.nav-burger span::before { top: -6px; }
.nav-burger span::after { top: 6px; }
body.menu-open .nav-burger span { background: transparent; }
body.menu-open .nav-burger span::before { top: 0; transform: translateX(-50%) rotate(45deg); }
body.menu-open .nav-burger span::after { top: 0; transform: translateX(-50%) rotate(-45deg); }

/* Mobile slide-in menu */
.mobile-menu {
  position: fixed; inset: var(--nav-h) 0 0 0; z-index: 90;
  background: rgba(8,18,34,0.98);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 24px clamp(20px,5vw,40px) calc(40px + var(--safe-b));
  display: flex; flex-direction: column; gap: 4px;
  transform: translateX(100%); transition: transform 0.3s var(--ease);
  overflow-y: auto;
}
body.menu-open .mobile-menu { transform: translateX(0); }
.mobile-menu a {
  font-size: 1.15rem; font-weight: 600; color: var(--light);
  padding: 16px 4px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.mobile-menu a:active { color: var(--blue-lt); }
.mobile-menu .mm-cta {
  margin-top: 22px; background: var(--blue); color: #fff; text-align: center;
  justify-content: center; border: none; border-radius: 12px; padding: 16px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: var(--white);
  padding: 15px 32px; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; border: none;
  box-shadow: var(--shadow-blue);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.btn-primary:hover { background: var(--blue2); transform: translateY(-2px); box-shadow: 0 10px 34px rgba(26,111,216,0.5); }
.btn-primary:active { transform: translateY(0) scale(0.99); }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--border); color: var(--light);
  padding: 14px 30px; border-radius: 12px; cursor: pointer; background: rgba(255,255,255,0.02);
  font-size: 1rem; font-weight: 600;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-outline:hover { border-color: var(--blue); color: var(--white); background: rgba(26,111,216,0.08); }

/* Google sign-in button */
.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; background: #fff; color: #1f2937;
  padding: 15px 24px; border-radius: 12px; border: none; cursor: pointer;
  font-size: 1rem; font-weight: 600;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.btn-google:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.btn-google:active { transform: translateY(0) scale(0.99); }
.btn-google:disabled { opacity: 0.7; cursor: wait; }
.btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ============================================================
   Layout helpers
   ============================================================ */
section { padding: clamp(70px, 10vw, 110px) clamp(20px, 5vw, 24px); max-width: 1140px; margin: 0 auto; }
.section-label {
  font-size: 0.76rem; font-weight: 700; letter-spacing: 2.5px;
  color: var(--blue-lt); text-transform: uppercase; margin-bottom: 14px;
}
h1 { font-size: clamp(2.3rem, 6vw, 3.7rem); font-weight: 800; line-height: 1.12; letter-spacing: -1.4px; }
h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.18; letter-spacing: -0.8px; }
h3 { font-size: 1.18rem; font-weight: 700; letter-spacing: -0.3px; }
p.lead { font-size: 1.15rem; color: var(--gray); line-height: 1.75; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
}

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   Footer
   ============================================================ */
footer {
  text-align: center; padding: 56px 24px calc(48px + var(--safe-b));
  border-top: 1px solid var(--border);
  color: var(--gray); font-size: 0.85rem;
}
footer a { color: var(--gray); margin: 0 12px; transition: color 0.2s var(--ease); }
footer a:hover { color: var(--white); }

/* ============================================================
   Modal / popup (welcome, etc.)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5,12,24,0.72);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; visibility: hidden; transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  position: relative; width: 100%; max-width: 460px;
  background: linear-gradient(160deg, #122745 0%, #0c1c34 100%);
  border: 1px solid rgba(26,111,216,0.4); border-radius: var(--radius-xl);
  padding: 44px 36px 36px; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: translateY(20px) scale(0.96); transition: transform 0.35s var(--ease);
  max-height: calc(100vh - 48px); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal-overlay.show .modal { transform: none; }
.modal-glow { position: absolute; inset: 0; border-radius: var(--radius-xl); pointer-events: none;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(74,222,128,0.16) 0%, transparent 70%); }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: none; background: rgba(255,255,255,0.06);
  color: var(--gray); font-size: 1.2rem; cursor: pointer; line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.modal-badge {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #5ef193, #1fae5a);
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem;
  box-shadow: 0 10px 30px rgba(74,222,128,0.45); position: relative;
  animation: pop-in 0.5s var(--ease) both;
}
@keyframes pop-in { 0% { transform: scale(0); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.modal h2 { font-size: 1.6rem; margin-bottom: 10px; }
.modal p { color: var(--gray); font-size: 0.95rem; line-height: 1.65; margin-bottom: 22px; }
.modal .modal-sub { font-size: 0.78rem; color: var(--gray-dk); margin-top: 16px; margin-bottom: 0; }

/* Confetti dots */
.confetti { position: absolute; top: 0; left: 0; right: 0; height: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -10px; width: 8px; height: 8px; border-radius: 2px; opacity: 0;
  animation: fall 2.6s ease-in forwards;
}
@keyframes fall { 0% { opacity: 1; transform: translateY(-10px) rotate(0); } 100% { opacity: 0; transform: translateY(420px) rotate(540deg); } }

/* ============================================================
   Toast (small notices)
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: #102745; border: 1px solid var(--border-hi); border-radius: 12px;
  padding: 13px 20px; font-size: 0.9rem; font-weight: 600; color: #fff;
  box-shadow: var(--shadow); z-index: 1100; opacity: 0; visibility: hidden;
  transition: all 0.3s var(--ease); max-width: 90vw;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Discord button (shared)
   ============================================================ */
.btn-discord {
  display: inline-flex; align-items: center; gap: 12px;
  background: #5865F2; color: #fff; padding: 16px 34px; border-radius: 12px;
  font-size: 1rem; font-weight: 700; box-shadow: 0 6px 28px rgba(88,101,242,0.45);
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.btn-discord:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 10px 34px rgba(88,101,242,0.6); }
.btn-discord:active { transform: translateY(0) scale(0.99); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .nav-right .btn-nav { display: none; }
  .acct-name { display: none; }
  .acct-btn { padding: 4px; }
}
@media (min-width: 861px) {
  .mobile-menu { display: none; }
}
@media (max-width: 600px) {
  .modal { padding: 38px 24px 30px; }
  section { padding-left: 18px; padding-right: 18px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
