/* ============================================================
   FantaVacanza · styles.css
   Design system 2.0 — "Liquid Summer"
   Mesh gradients · glassmorphism · soft depth · live motion
   Mantiene il mood estate/emoji/social, ma più premium.
   ============================================================ */

:root {
  /* tema attivo (settato da JS) */
  --primary: #FF3D7F;
  --secondary: #8A5BFF;
  --accent: #FF7A4D;
  --gold: #FFC93C;
  --grad: linear-gradient(135deg, #FF7A4D 0%, #FF3D7F 52%, #8A5BFF 100%);
  --pos: #16B57A;
  --neg: #FF4D6D;

  /* superfici (light di default, sovrascritte da .night) */
  --bg: #FFF8F1;
  --surface: #FFFFFF;
  --surface2: #FBF1E6;
  --text: #1A1330;
  --dim: #7C7592;
  --border: rgba(26, 19, 48, 0.09);
  --glass: rgba(255, 255, 255, 0.65);
  --glass-brd: rgba(255, 255, 255, 0.8);
  --shadow: 0 14px 34px rgba(60, 40, 90, 0.12);
  --shadow-lg: 0 24px 60px rgba(60, 40, 90, 0.20);
  --navbg: rgba(255, 255, 255, 0.78);
  --chip: rgba(26, 19, 48, 0.05);
  --ring: rgba(255, 61, 127, 0.35);
}

.night {
  --bg: #0C1030;
  --surface: #171C46;
  --surface2: #222a5c;
  --text: #F4F1FF;
  --dim: #A8A4CE;
  --border: rgba(255, 255, 255, 0.11);
  --glass: rgba(23, 28, 70, 0.55);
  --glass-brd: rgba(255, 255, 255, 0.12);
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --navbg: rgba(16, 20, 52, 0.82);
  --chip: rgba(255, 255, 255, 0.07);
  --ring: rgba(255, 61, 127, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background: var(--bg);
  transition: background .5s ease, color .3s ease;
}

/* ---- animated mesh-gradient ambient background ---- */
body::before {
  content: '';
  position: fixed;
  inset: -20% -20% -20% -20%;
  z-index: -2;
  background:
    radial-gradient(40% 50% at 15% 12%, color-mix(in srgb, var(--accent) 50%, transparent), transparent 70%),
    radial-gradient(45% 55% at 85% 10%, color-mix(in srgb, var(--secondary) 45%, transparent), transparent 70%),
    radial-gradient(50% 50% at 50% 100%, color-mix(in srgb, var(--primary) 38%, transparent), transparent 70%);
  filter: blur(40px) saturate(1.1);
  opacity: .55;
  animation: meshDrift 22s ease-in-out infinite alternate;
}
.night body::before, body.night::before { opacity: .4; }
@keyframes meshDrift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

button { font-family: inherit; cursor: pointer; white-space: nowrap; border: none; background: none; }
input, textarea, select {
  font-family: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2.5px solid var(--ring); outline-offset: 2px;
}

/* ---- app shell ---- */
#app { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ---- hide scrollbars on horizontal scrollers ---- */
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- glass card ---- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow);
}

/* ---- card base ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* ---- gradient header used across screens ---- */
.gradhead {
  background: var(--grad);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.gradhead::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 80% 0%, rgba(255,255,255,.25), transparent 60%);
  pointer-events: none;
}

/* ---- primary button ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 15px;
  padding: 15px; border-radius: 16px;
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.05); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn-ghost {
  background: var(--chip); color: var(--text);
  box-shadow: none; border: 1px solid var(--border);
}
.btn-glass {
  background: rgba(255,255,255,0.16); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5); box-shadow: none;
}

/* ---- ripple feedback ---- */
.tap { position: relative; overflow: hidden; }
.tap::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,.35), transparent 60%);
  opacity: 0; transform: scale(0);
  transition: transform .4s ease, opacity .5s ease;
}
.tap:active::after { opacity: 1; transform: scale(2.4); transition: 0s; }

/* ---- live pulse dot ---- */
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; position: relative; display: inline-block; }
.pulse-dot::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor; animation: pulseRing 1.8s ease-out infinite;
}
@keyframes pulseRing {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(3.2); opacity: 0; }
}

/* ---- entrance animations ---- */
@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { from { transform: translate(-50%, 18px) scale(.92); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.anim-up { animation: up .45s cubic-bezier(.22,1,.36,1) both; }
.stagger > * { animation: up .5s cubic-bezier(.22,1,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .30s; }

/* ---- shimmer (count-up emphasis) ---- */
@keyframes shine { 0% { background-position: -120% 0; } 100% { background-position: 220% 0; } }

/* ---- avatar ---- */
.avatar {
  display: grid; place-items: center; color: #fff; font-weight: 800;
  border-radius: 14px; flex-shrink: 0; position: relative;
}
.avatar .badge {
  position: absolute; bottom: -4px; right: -4px; font-size: 13px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #15122A; color: #fff;
  padding: 13px 18px; border-radius: 15px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  font-weight: 700; font-size: 13.5px; max-width: 340px;
  z-index: 300; animation: pop .3s ease;
}
.night .toast { background: #2A2150; }

/* ---- modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 8, 24, 0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .25s ease;
}
.modal-box {
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 10px 20px 32px;
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  animation: up .35s cubic-bezier(.22,1,.36,1) both;
  box-shadow: var(--shadow-lg);
}
.modal-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 14px; }

/* ---- bottom nav ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: 76px;
  background: var(--navbg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding: 0 8px 6px; z-index: 90;
}
.navbtn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 10px; border-radius: 12px; transition: transform .12s; }
.navbtn:active { transform: scale(.9); }
.navfab {
  width: 56px; height: 56px; margin-top: -24px; border-radius: 19px;
  background: var(--grad); color: #fff; font-size: 27px; font-weight: 800;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 50%, transparent);
  transition: transform .15s ease;
}
.navfab:active { transform: scale(.92) rotate(90deg); }

/* ---- progress bar ---- */
.bar { height: 5px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 4px; transition: width .6s cubic-bezier(.22,1,.36,1); }

/* ---- confetti ---- */
.confetti-piece {
  position: fixed; top: -12px; width: 9px; height: 14px;
  z-index: 400; pointer-events: none; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* ---- skeleton ---- */
.skel {
  background: linear-gradient(90deg, var(--chip) 25%, color-mix(in srgb, var(--text) 6%, transparent) 37%, var(--chip) 63%);
  background-size: 400% 100%;
  animation: shine 1.4s ease infinite;
  border-radius: 12px;
}

/* ---- chip / pill ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 11px;
  font-size: 12.5px; font-weight: 700;
}

/* ---- segmented control ---- */
.seg { display: flex; gap: 5px; padding: 4px; border-radius: 13px; background: rgba(0,0,0,0.18); }
.seg button { flex: 1; padding: 9px; border-radius: 10px; font-weight: 700; font-size: 13px; transition: background .2s, color .2s; }

/* ---- count-up number ---- */
.countup { font-variant-numeric: tabular-nums; }

/* ---- crown bounce ---- */
@keyframes crownBounce { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }
.crown { animation: crownBounce 2.4s ease-in-out infinite; display: inline-block; }

/* ---- text gradient ---- */
.txt-grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- desktop niceties ---- */
@media (min-width: 520px) {
  #app {
    margin-top: 18px; margin-bottom: 18px;
    border-radius: 30px; overflow: hidden; min-height: 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-height: calc(100vh - 36px);
  }
}
