/* ============================================================
   GullyCric — components.css
   Reusable UI pieces: reset, buttons, cards, inputs,
   nav, header, sidebar, modals, toast, celebration.
   ============================================================ */

/* ----------------------------------------------------------
   RESET & BASE
---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------------
   BUTTONS
---------------------------------------------------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(30,86,49,.28);
}
.btn-primary:hover { background: var(--green-mid); }

.btn-secondary {
  background: var(--green-pale);
  color: var(--green);
  border: 1.5px solid var(--border);
}

.btn-gold {
  background: var(--gold);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(230,168,23,.35);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--green);
  color: var(--green);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-danger {
  background: var(--red-pale);
  color: var(--red);
  border: 1.5px solid var(--red);
}

/* Small variant */
.btn-sm {
  width: auto;
  padding: 10px 18px;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------
   CARDS
---------------------------------------------------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: var(--space-16);
}

.card-pressable {
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.card-pressable:active {
  transform: scale(0.97);
  box-shadow: none;
}

/* ----------------------------------------------------------
   FORM INPUTS
---------------------------------------------------------- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.field-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--duration) var(--ease);
  appearance: none;
}
.field-input:focus { border-color: var(--green); }
.field-input::placeholder { color: var(--text-muted); }

/* Select arrow */
select.field-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a9985' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* OTP boxes */
.otp-boxes { display: flex; gap: var(--space-8); }
.otp-box {
  flex: 1;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 22px;
  font-weight: var(--weight-bold);
  text-align: center;
  color: var(--green);
  background: var(--white);
  outline: none;
  transition: all var(--duration) var(--ease);
}
.otp-box:focus {
  border-color: var(--green);
  background: var(--green-pale);
}

/* ----------------------------------------------------------
   BADGES
---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.badge-win    { background: var(--green-pale); color: var(--green); }
.badge-loss   { background: var(--red-pale);   color: var(--red);   }
.badge-draw   { background: #fff3e0;           color: #e65100;      }
.badge-gold   { background: var(--gold-light); color: var(--gold-dark); }
.badge-live {
  background: var(--red-pale);
  color: var(--red);
  animation: pulse 1.4s infinite;
}

/* Live dot */
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* ----------------------------------------------------------
   APP HEADER
---------------------------------------------------------- */
.app-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-20);
  gap: var(--space-12);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-logo {
  flex: 1;
  font-size: var(--text-md);
  font-weight: var(--weight-black);
  color: var(--green);
}
.header-logo span { color: var(--gold); }

.header-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: background var(--duration);
  position: relative;
}
.header-icon-btn:active { background: var(--green-pale); }

.header-notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--white);
}

/* ----------------------------------------------------------
   BOTTOM NAVIGATION
---------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: var(--space-8);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border: none;
  background: none;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--duration);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--duration);
}
.nav-item.active .nav-icon { transform: scale(1.1); }

.nav-label {
  font-size: 10px;
  font-weight: var(--weight-semi);
  color: var(--text-muted);
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition: color var(--duration);
}
.nav-item.active .nav-label { color: var(--green); }

.nav-pip {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0;
  transition: opacity var(--duration);
  margin-top: -2px;
}
.nav-item.active .nav-pip { opacity: 1; }

/* ----------------------------------------------------------
   SIDEBAR
---------------------------------------------------------- */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-md);
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--white);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform var(--duration-md) var(--ease);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar.open { transform: translateX(0); }

.sidebar-top {
  background: var(--green);
  padding: 44px var(--space-24) var(--space-24);
}

.sidebar-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: var(--space-12);
  border: 2px solid rgba(255,255,255,.25);
}
.sidebar-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--white);
}
.sidebar-city {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.65);
  margin-top: 3px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  padding: 14px var(--space-24);
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--duration);
}
.sidebar-item:active { background: var(--green-pale); }
.sidebar-item-icon { font-size: 20px; width: 28px; text-align: center; }
.sidebar-item.danger { color: var(--red); }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-8) var(--space-24);
}

/* ----------------------------------------------------------
   MODAL (bottom sheet)
---------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-md);
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  width: 100%;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-24) var(--space-24) 36px;
  transform: translateY(100%);
  transition: transform var(--duration-md) var(--ease);
}
.modal-overlay.show .modal-sheet { transform: none; }

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-20);
}
.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  color: var(--text);
  margin-bottom: var(--space-8);
}
.modal-body {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-20);
}

/* ----------------------------------------------------------
   TOAST
---------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--white);
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  z-index: 500;
  opacity: 0;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------
   CELEBRATION OVERLAY
---------------------------------------------------------- */
.celebration {
  position: fixed; inset: 0;
  background: rgba(30,86,49,.72);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
}
.celebration.show {
  opacity: 1;
  pointer-events: all;
}
.celebration-inner {
  text-align: center;
  animation: celebPop 0.35s var(--ease);
}
.celebration-icon { font-size: 88px; display: block; }
.celebration-text {
  font-size: 44px;
  font-weight: var(--weight-black);
  color: var(--white);
  margin-top: var(--space-12);
  letter-spacing: -1px;
}
.celebration-sub {
  font-size: var(--text-md);
  color: rgba(255,255,255,.75);
  margin-top: var(--space-4);
}
.celebration-hint {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.4);
  margin-top: var(--space-20);
}

@keyframes celebPop {
  from { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); }
  to   { transform: scale(1);   opacity: 1; }
}

/* ----------------------------------------------------------
   CONFETTI
---------------------------------------------------------- */
.confetti-piece {
  position: fixed;
  border-radius: 2px;
  animation: confettiFall var(--duration) ease-in forwards;
  z-index: 401;
  pointer-events: none;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ----------------------------------------------------------
   SECTION HEADER
---------------------------------------------------------- */
.section { padding: var(--space-20) var(--space-20) 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-12);
}
.section-title {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text);
}
.section-link {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--green);
  cursor: pointer;
}

/* ----------------------------------------------------------
   DIVIDER & SPACERS
---------------------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: 0 var(--space-20); }
.spacer-8  { height: 8px; }
.spacer-16 { height: 16px; }
.spacer-24 { height: 24px; }

/* ----------------------------------------------------------
   UTILITY
---------------------------------------------------------- */
.hidden          { display: none !important; }
.text-center     { text-align: center; }
.text-green      { color: var(--green); }
.text-gold       { color: var(--gold); }
.text-red        { color: var(--red); }
.text-muted      { color: var(--text-muted); }
.font-bold       { font-weight: var(--weight-bold); }
.font-black      { font-weight: var(--weight-black); }

/* ----------------------------------------------------------
   RESPONSIVE — centre on tablet / desktop
---------------------------------------------------------- */
@media (min-width: 480px) {
  .screen          { max-width: 480px; margin: 0 auto; }
  .bottom-nav      { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .sidebar         { max-width: 480px; }
  .toast           { max-width: 400px; }
  .modal-overlay   { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .celebration     { max-width: 480px; left: 50%; transform: translateX(-50%); }
}