/* ════════════════════════════════════════
   HALEON PARTNERS CLUB — styles.css
   ════════════════════════════════════════ */

:root {
  --bg: #000000;
  --surface: #111418;
  --surface2: #181c21;
  --border: #1e2329;
  --green: #2ee701;
  --green-dark: #2ee701;
  --green-dim: rgba(74, 222, 128, 0.12);
  --text: #f0f4f8;
  --muted: #6b7a8d;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; font-weight: 600; cursor: pointer; }

.app-logo { max-width: 200px; height: auto; margin: 0 auto; display: block; }

.app {
  width: 100%; max-width: 1440px; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden; position: relative; margin: 0 auto;
}

.swipe-container { display: flex; flex: 1; overflow: hidden; touch-action: pan-y; }

.view { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding-bottom: 76px; }
.view.active { display: flex; }

/* AUTH */
.auth-view { padding: clamp(48px, 8vw, 80px) clamp(28px, 5vw, 60px) 32px; justify-content: center; max-width: 600px; margin: 0 auto; width: 100%; }
.auth-logo { text-align: center; margin-bottom: clamp(32px, 6vw, 48px); }
.auth-logo .sub { font-size: clamp(0.75rem, 1.5vw, 0.9rem); letter-spacing: 4px; color: var(--muted); text-transform: uppercase; margin-top: 14px; }
.auth-title { font-weight: 700; font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 28px; text-align: center; }
.field { margin-bottom: 14px; }
.field input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; color: var(--text); font-family: 'Poppins', sans-serif; font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.field input:focus { border-color: var(--green); }
.field input::placeholder { color: var(--muted); }
.btn-primary { width: 100%; background: var(--green); color: #000; border: none; border-radius: 10px; padding: 15px; font-family: 'Poppins', sans-serif; font-size: 1.1rem; font-weight: 700; letter-spacing: 1px; cursor: pointer; margin-top: 8px; transition: opacity 0.2s, transform 0.1s; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { width: 100%; background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 13px; font-family: 'Poppins', sans-serif; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { border-color: var(--muted); color: var(--text); }
.auth-switch { text-align: center; margin-top: 20px; color: var(--muted); font-size: 0.9rem; }

/* GLOBAL HEADER & FOOTER */
.global-header {
  width: 100%;
  flex-shrink: 0;
  z-index: 3;
  line-height: 0;
  position: relative;
  background: var(--bg);
}
.global-header img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 200px;
}

.global-footer {
  width: 100%;
  flex-shrink: 0;
  z-index: 3;
  line-height: 0;
  position: relative;
  background: var(--bg);
}
.global-footer img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 15vh;
}

/* NAVBAR */
.top-navbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 8px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 10; }
.top-nav-greeting { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.top-nav-greeting span { color: var(--green); }
.logout-btn { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); border-radius: 8px; padding: 6px 14px; font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; letter-spacing: 0.5px; font-family: 'Poppins', sans-serif; }
.logout-btn:hover { background: rgba(239, 68, 68, 0.22); }

/* Changed to relative to sit naturally above the footer */
.bottom-nav { 
  display: none; 
  background: var(--surface); 
  border-top: 1px solid var(--border); 
  height: 50px;         /* Sets the exact height */
  align-items: center;   /* Vertically centers the tabs */
  padding: 0;            /* Removes the old padding so items sit perfectly in the middle */
  position: relative; 
  width: 100%; 
  z-index: 3; 
  flex-shrink: 0; 
}
.bottom-nav.visible { display: flex; }
.nav-tabs { display: flex; width: 100%; justify-content: space-around; }
.nav-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.5px; padding: 4px 12px; border-radius: 10px; transition: color 0.2s; cursor: pointer; border: none; background: none; font-family: 'Poppins', sans-serif; }
.nav-tab svg { width: 18px; height: 18px; }
.nav-tab.active { color: var(--green); }

/* Changed padding-bottom since nav is no longer fixed on top of it */
.view { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding-bottom: 24px; }
.view.active { display: flex; }

/* HOME */
.home-view { padding: 0; flex-direction: column; }
.home-header { background: linear-gradient(180deg, #0d1a12 0%, var(--bg) 100%); padding: clamp(16px, 3vw, 32px) clamp(24px, 5vw, 48px) clamp(24px, 5vw, 48px); text-align: center; }
.points-big { font-weight: 800; font-size: clamp(3.2rem, 8vw, 4.5rem); letter-spacing: -1px; line-height: 1; color: var(--text); }
.tier-badge { display: inline-block; background: var(--green-dim); border: 1px solid rgba(74, 222, 128, 0.3); color: var(--green); font-size: 0.75rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; padding: 4px 14px; border-radius: 20px; margin: 8px 0 20px; }

/* Progress Ring */
.progress-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto; }
.progress-wrap svg { transform: rotate(-90deg); }
.progress-track { stroke: #1a2820; fill: none; stroke-width: 8; }
.progress-fill { fill: none; stroke: var(--green); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.progress-pct { font-weight: 700; font-size: 2rem; color: var(--green); line-height: 1; }
.progress-label { font-size: 0.62rem; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }

.section { padding: 20px 24px 0; }
.section-title { font-weight: 600; font-size: 0.8rem; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; margin-bottom: 14px; }

/* Badges */
.badges-row { display: flex; gap: 12px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
.badges-row::-webkit-scrollbar { display: none; }
.badge-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; flex: 0 0 auto; min-width: 100px; text-align: center; cursor: pointer; transition: all 0.2s; }
.badge-chip.locked { opacity: 0.38; cursor: default; }
.badge-chip.claimable { opacity: 1; border-color: rgba(74, 222, 128, 0.4); cursor: pointer; box-shadow: 0 0 12px rgba(74, 222, 128, 0.15); }
.badge-chip.claimed { opacity: 1; border-color: var(--green); background: var(--green-dim); cursor: default; }
.badge-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.badge-name { font-size: 0.68rem; color: var(--muted); line-height: 1.3; font-weight: 500; }
.badge-pts { font-size: 0.62rem; color: var(--green); font-weight: 600; margin-top: 2px; }

/* Carousel */
.carousel-wrap { position: relative; border-radius: var(--radius); overflow: hidden; margin: 0 -8px; padding: 0 8px; }
.carousel-track { display: flex; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.carousel-slide { min-width: 100%; height: 120px; border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; flex-shrink: 0; }
.carousel-title { font-weight: 700; font-size: 1.3rem; color: #fff; margin-bottom: 4px; }
.carousel-sub { font-size: 0.78rem; color: rgba(255, 255, 255, 0.65); font-weight: 400; }
.carousel-emoji { font-size: 3rem; }
.carousel-dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 4px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); cursor: pointer; transition: background 0.2s; }
.dot.active { background: var(--green); }

/* ════════════════════════════════════════
   QUIZ GRID (GAMES HUB) - FIXED SIZE
   ════════════════════════════════════════ */
.quiz-grid {
  display: grid; 
  grid-template-columns: 1fr 1fr; /* Strict 2 columns */
  gap: 12px; 
  padding: 0 8px 24px; 
}
.quiz-grid-card {
  background: var(--surface2); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  padding: 16px 12px; 
  display: flex; flex-direction: column; align-items: center; gap: 8px; 
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.quiz-grid-card:hover { border-color: rgba(74, 222, 128, 0.35); }
.quiz-grid-card.answered { border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.05); cursor: default; }

.quiz-grid-num {
  width: 40px; height: 40px; 
  border-radius: 50%; background: var(--green-dim); border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--green); font-weight: 700; font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
}
.quiz-grid-card.answered .quiz-grid-num { background: var(--green); color: #000; border-color: var(--green); }

.quiz-grid-label { font-weight: 600; font-size: 0.95rem; }
.quiz-grid-status { font-size: 0.72rem; color: var(--muted); }
.quiz-grid-card.answered .quiz-grid-status { color: var(--green); }

/* REWARDS */
.rewards-view { padding: 0; flex-direction: column; }
.rewards-header { padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 40px) 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.page-title { font-weight: 700; font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: clamp(0.85rem, 1.5vw, 1rem); margin-bottom: 14px; font-weight: 400;}
.rewards-pts-bar { display: flex; align-items: center; justify-content: space-between; background: var(--green-dim); border: 1px solid rgba(74, 222, 128, 0.3); border-radius: 10px; padding: 10px 16px; max-width: 600px; }
.rewards-pts-label { font-size: 0.8rem; color: var(--muted); font-weight: 500;}
.rewards-pts-val { font-weight: 700; font-size: 1.2rem; color: var(--green); }
.rewards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 2vw, 24px); padding: clamp(16px, 3vw, 32px) clamp(24px, 5vw, 48px); } 
.reward-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.reward-img { height: clamp(100px, 15vw, 180px); background: linear-gradient(135deg, #1a2820, #0d1a12); display: flex; align-items: center; justify-content: center; font-size: clamp(2.2rem, 5vw, 4rem); }
.reward-info { padding: clamp(14px, 2vw, 24px); display: flex; flex-direction: column; flex-grow: 1; justify-content: space-between;}
.reward-title { font-weight: 600; font-size: clamp(0.9rem, 1.5vw, 1.1rem); line-height: 1.3; margin-bottom: 12px; }
.redeem-btn { width: 100%; background: var(--green); color: #000; border: none; border-radius: 8px; padding: clamp(10px, 2vw, 14px); font-weight: 600; font-size: clamp(0.85rem, 1.5vw, 1rem); letter-spacing: 0.5px; cursor: pointer; transition: opacity 0.2s; font-family: 'Poppins', sans-serif; }
.redeem-btn:hover:not(:disabled) { opacity: 0.85; }
.redeem-btn:disabled { background: var(--surface); color: var(--muted); border: 1px solid var(--border); cursor: not-allowed; opacity: 0.6; }

/* PROFILE — CARD  */
.profile-view { padding: clamp(20px, 4vw, 40px) clamp(24px, 5vw, 48px) 80px; flex-direction: column; } 
.card-scene { perspective: 1200px; width: 100%; max-width: 500px; margin-inline: auto; aspect-ratio: 1.586 / 1; margin-bottom: clamp(20px, 4vw, 40px); cursor: pointer; flex-shrink: 0; outline: none; -webkit-tap-highlight-color: transparent; }
.card-scene:focus { outline: none; box-shadow: none; }
.card-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1); }
.card-inner.flipped { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.55); }
.card-back-face { transform: rotateY(180deg); }

/* The card image fills the face completely */
.card-png-fill {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill;          /* fill = stretches to exactly match, no crop */
  border-radius: 16px;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* ── BACK FACE overlays — percentage-positioned so they stay locked
      regardless of screen width. Values measured from Card-Back.png. ── */

/* QR code lives in the white square: top-right of card
   Image: ~62% from left, ~8% from top, ~32% wide, ~45% tall       */
.cb-qr-overlay {
  position: absolute;
  top:   15%;
  right: 1%;
  width: 32%;
  aspect-ratio: 1 / 1;
  z-index: 2;
  pointer-events: none;
}
.cb-qr {
  width: 85%; height: 85%;
  background: #fff;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 4%;
}
.cb-qr img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* Member name sits in the green stripe on the left
   Image: starts ~38% from top, ends ~56%, left portion only (~62% wide) */
.cb-name-overlay {
  position: absolute;
  top:    47%;
  left:   3%;
  width:  58%;
  height: 18%;
  display: flex;
  align-items: center;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
#card-name-back {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  /* font-size scales with the card width using 3vw, clamped for all screens */
  font-size: clamp(10px, 3.5vw, 22px);
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}

.stats-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 10px; text-align: center; }
.stat-val { font-weight: 700; font-size: 1.5rem; color: var(--green); }
.stat-lbl { font-size: 0.7rem; color: var(--muted); margin-top: 2px; font-weight: 500;}

.profile-section { margin-bottom: 24px; }
.profile-badges-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.profile-badge-item { display: inline-flex; align-items: center; gap: 6px; background: var(--green-dim); border: 1px solid rgba(74, 222, 128, 0.3); color: var(--green); border-radius: 20px; padding: 5px 12px; font-size: 0.82rem; font-weight: 600; margin: 4px 4px 4px 0; }
.profile-badge-empty { font-size: 0.82rem; color: var(--muted); padding: 10px 0; }

.profile-info-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--muted); }
.info-row strong { color: var(--text); font-weight: 600; text-align: right;} 

/* TOAST */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-80px); background: var(--green); color: #000; padding: 12px 24px; border-radius: 30px; font-weight: 600; font-size: 1rem; letter-spacing: 1px; z-index: 9999; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; white-space: nowrap; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* DIALOGS */
.dialog-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); display: none; align-items: center; justify-content: center; z-index: 9990; padding: 24px; backdrop-filter: blur(4px); }
.dialog-overlay.open { display: flex; }
.dialog-box { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px; width: 100%; max-width: 340px; text-align: center; animation: dialogPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes dialogPop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.dialog-icon { font-size: 3.5rem; margin-bottom: 16px; }
.dialog-title { font-weight: 700; font-size: 1.6rem; margin-bottom: 8px; }
.dialog-msg { color: var(--green); font-weight: 600; font-size: 1.1rem; margin-bottom: 8px; }
.dialog-sub { color: var(--muted); font-size: 0.9rem; line-height: 1.4;}

.qr-dialog-code { margin: 16px auto 12px; background: white; border-radius: 12px; width: 200px; height: 200px; display: flex; align-items: center; justify-content: center; padding: 10px; }
.qr-dialog-code img { display: block; width: 100%; height: 100%;}
.qr-countdown { font-weight: 700; font-size: 1.1rem; color: var(--green); margin-bottom: 6px; }

/* LOADING */
.loading-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 99999; gap: 24px; }
.loading-spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--green); animation: loadSpin 0.8s linear infinite; }
@keyframes loadSpin { to { transform: rotate(360deg); } }

.auth-error { color: #f87171; font-size: 0.85rem; min-height: 20px; margin: -4px 0 10px; text-align: center; }
.sync-status { font-size: 0.8rem; color: var(--green); text-align: center; margin-top: 16px; opacity: 0; transition: opacity 0.4s; }
#welcome-dialog .dialog-box { background: linear-gradient(160deg, var(--surface) 0%, #0d1a12 100%); border-color: rgba(74, 222, 128, 0.35); }
#welcome-dialog .dialog-title { line-height: 1.3; margin-bottom: 12px; }

/* ════════════════════════════════════════
   RESPONSIVE MEDIA QUERIES
   ════════════════════════════════════════ */
@media (min-width: 600px) {
  .section { padding: clamp(20px, 4vw, 32px) clamp(24px, 5vw, 48px) 0; }
  .quiz-grid { padding: 0 clamp(24px, 5vw, 48px) clamp(24px, 5vw, 48px); gap: 16px; }
}

@media (min-width: 768px) {
  .quiz-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .rewards-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 20px; max-width: 800px; margin: 0 auto 32px; }
  .badges-row { gap: 16px; }
  .badge-chip { min-width: 140px; padding: 20px; }
  .badge-icon { width: 56px; height: 56px; font-size: 1.5rem; }
  .carousel-wrap { margin: 0 auto; max-width: 900px; }
  .profile-info-box { max-width: 800px; margin: 0 auto; }
  .profile-section .section-title { text-align: center; margin-top: 20px; }
  .profile-badges-row { justify-content: center; }
  .nav-tabs { max-width: 700px; margin: 0 auto; }
}

@media (min-width: 1024px) {
  .quiz-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
  .rewards-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .bottom-nav { height: 60px; }
  .nav-tab svg { width: 22px; height: 22px; }
  .nav-tab { font-size: 0.8rem; }
  .home-header { padding-bottom: 40px; }
  .page-title { margin-bottom: 12px; }
  .global-header img { max-height: 250px; }
}

@media (min-width: 1440px) {
  .quiz-grid { grid-template-columns: repeat(5, 1fr); }
  .rewards-grid { grid-template-columns: repeat(5, 1fr); }
}