/* ===== Tema nadalenc ===== */
:root {
  --xmas-red: #b3001b;
  --xmas-red-dark: #8a0015;
  --xmas-green: #1f6f3f;
  --xmas-green-dark: #154d2c;
  --xmas-gold: #d4af37;
  --xmas-cream: #fbf6ec;
  --xmas-ink: #3b2a1a;
  --xmas-muted: #7a6a5a;
  --font-festive: "Mountains of Christmas", Georgia, serif;
}

html {
  font-size: 15px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* El peu queda al final de la pàgina sense posició absoluta: així pot créixer en pantalles estretes */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--xmas-ink);
  background-color: var(--xmas-cream);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(179, 0, 27, .05) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 60%, rgba(31, 111, 63, .06) 0 2px, transparent 3px);
  background-size: 60px 60px, 80px 80px;
}

h1, h2, h3, .festive {
  font-family: var(--font-festive);
  font-weight: 700;
  color: var(--xmas-red);
}

a {
  color: var(--xmas-green);
}

  a:hover {
    color: var(--xmas-red);
  }

/* ----- Capçalera i peu ----- */
.xmas-navbar {
  background: linear-gradient(90deg, var(--xmas-red-dark), var(--xmas-red) 50%, var(--xmas-red-dark));
  border-bottom: 4px solid var(--xmas-gold);
}

  .xmas-navbar .navbar-brand {
    font-family: var(--font-festive);
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
  }

  .xmas-navbar .nav-link {
    color: rgba(255, 255, 255, .9);
    font-weight: 500;
  }

    .xmas-navbar .nav-link:hover, .xmas-navbar .nav-link:focus {
      color: var(--xmas-gold);
    }

  .xmas-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, .6);
  }


.garland {
  height: 14px;
  background: repeating-linear-gradient(90deg, var(--xmas-green) 0 18px, var(--xmas-green-dark) 18px 36px);
  position: relative;
}

  .garland::after {
    content: "";
    position: absolute;
    inset: 4px 0 auto 0;
    height: 8px;
    background: radial-gradient(circle, var(--xmas-gold) 3px, transparent 4px) 0 0 / 36px 8px,
                radial-gradient(circle, #e8364f 3px, transparent 4px) 18px 0 / 36px 8px;
  }

.site-main {
  flex: 1 0 auto;
  width: 100%;
}

.footer {
  flex-shrink: 0;
  margin-top: 24px;
  padding: 16px 0;
  line-height: 1.6;
  background: var(--xmas-green-dark);
  color: rgba(255, 255, 255, .85);
  font-size: .9rem;
}

  .footer .footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
    text-align: center;
  }

  .footer .sep {
    opacity: .5;
  }

  .footer a {
    color: var(--xmas-gold);
  }

/* ----- Neu ----- */
.snow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

  .snow span {
    position: absolute;
    top: -2rem;
    color: #fff;
    text-shadow: 0 0 3px rgba(120, 140, 170, .7);
    animation: snowfall linear infinite;
    opacity: .85;
  }

@keyframes snowfall {
  to {
    transform: translateY(110vh) rotate(360deg);
  }
}

main, .navbar, footer {
  position: relative;
  z-index: 1;
}

/* ----- Components ----- */
.xmas-card {
  background: #fff;
  border-radius: 16px;
  border-top: 8px solid var(--xmas-red);
  box-shadow: 0 6px 24px rgba(59, 42, 26, .12);
  padding: 28px 32px;
  margin-bottom: 24px;
}

  .xmas-card.green {
    border-top-color: var(--xmas-green);
  }

.btn-primary, .btn-xmas {
  color: #fff;
  background-color: var(--xmas-red);
  border-color: var(--xmas-red-dark);
}

  .btn-primary:hover, .btn-primary:focus, .btn-xmas:hover, .btn-xmas:focus,
  .btn-primary:active, .btn-primary:disabled {
    color: #fff;
    background-color: var(--xmas-red-dark);
    border-color: var(--xmas-red-dark);
  }

.btn-success, .btn-xmas-green {
  color: #fff;
  background-color: var(--xmas-green);
  border-color: var(--xmas-green-dark);
}

  .btn-success:hover, .btn-xmas-green:hover, .btn-xmas-green:focus {
    color: #fff;
    background-color: var(--xmas-green-dark);
    border-color: var(--xmas-green-dark);
  }

.btn-gold {
  color: var(--xmas-ink);
  background-color: var(--xmas-gold);
  border-color: #b8952a;
}

  .btn-gold:hover, .btn-gold:focus {
    color: var(--xmas-ink);
    background-color: #c39f2d;
  }

/* Verd fosc de WhatsApp: contrast suficient amb text blanc */
.btn-whatsapp {
  color: #fff;
  background-color: #128c7e;
  border-color: #0e6f64;
}

  .btn-whatsapp:hover, .btn-whatsapp:focus {
    color: #fff;
    background-color: #0e6f64;
  }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus, .form-select:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--xmas-gold);
}

.form-check-input:checked {
  background-color: var(--xmas-green);
  border-color: var(--xmas-green);
}

.table-xmas {
  border-radius: 10px;
  overflow: hidden;
}

  .table-xmas thead th {
    background: var(--xmas-green);
    color: #fff;
    border-color: var(--xmas-green-dark);
  }

.page-title {
  text-align: center;
  font-size: 2.6rem;
  margin: 8px 0 24px;
}

  .page-title small {
    display: block;
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    color: var(--xmas-muted);
    font-weight: 400;
  }

/* ----- Inici ----- */
.hero {
  text-align: center;
  padding: 40px 16px 24px;
}

  .hero .hero-icons {
    font-size: 4rem;
    line-height: 1;
  }

  .hero h1 {
    font-size: 3.6rem;
    margin: 16px 0 8px;
  }

  .hero p {
    color: var(--xmas-muted);
    font-size: 1.15rem;
  }

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 24px auto;
}

  .home-actions a {
    display: block;
    text-decoration: none;
    text-align: center;
    padding: 28px 16px;
    border-radius: 16px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    transition: transform .15s;
  }

    .home-actions a:hover {
      transform: translateY(-4px);
      color: #fff;
    }

    .home-actions a .icon {
      font-size: 2.6rem;
      display: block;
    }

    .home-actions a .label {
      font-family: var(--font-festive);
      font-size: 1.8rem;
      font-weight: 700;
    }

.bg-red {
  background: var(--xmas-red);
}

.bg-green {
  background: var(--xmas-green);
}

.bg-gold {
  background: #b8952a;
}

/* ----- Pàgina generada ----- */
.event-types .btn-check:checked + .btn {
  background: var(--xmas-green);
  color: #fff;
  border-color: var(--xmas-green-dark);
}

.event-types .btn {
  border-color: var(--xmas-green);
  color: var(--xmas-green);
}

.assigned-password {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
}

/* ----- Sobre regal ----- */
.gift-wrapper {
  text-align: center;
  padding: 16px 0 8px;
}

.gift {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-block;
}

  .gift img {
    width: 220px;
    max-width: 70vw;
    animation: gift-shake 2.2s ease-in-out infinite;
    transform-origin: 50% 90%;
  }

  .gift:hover img, .gift:focus img {
    animation-duration: .8s;
  }

  .gift.opened img {
    animation: gift-open .6s ease-out forwards;
  }

@keyframes gift-shake {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(-6deg); }
  80% { transform: rotate(6deg); }
  85% { transform: rotate(-4deg); }
  90% { transform: rotate(4deg); }
}

@keyframes gift-open {
  to {
    transform: scale(1.3);
    opacity: 0;
  }
}

.gift-reveal {
  display: none;
  animation: reveal .7s ease-out;
}

  .gift-reveal.show {
    display: block;
  }

  .gift-reveal .assigned-name {
    font-family: var(--font-festive);
    font-size: 3.4rem;
    font-weight: 700;
    color: var(--xmas-green);
  }

@keyframes reveal {
  from {
    transform: scale(.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.confetti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 14px;
  z-index: 10;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(105vh) rotate(720deg);
  }
}

/* ----- Taules que en mòbil es converteixen en targetes ----- */
@media (max-width: 575.98px) {
  .table-stack thead {
    display: none;
  }

  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td {
    display: block;
    width: 100%;
  }

    .table-stack tr {
      border: 1px solid #e6dccb;
      border-radius: 10px;
      margin-bottom: 12px;
      overflow: hidden;
      background: #fff;
    }

    .table-stack td {
      border: none;
      padding: 6px 12px;
      text-align: left !important;
      overflow-wrap: anywhere;
    }

      .table-stack td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: .75rem;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--xmas-muted);
      }

      .table-stack td:first-of-type {
        background: rgba(31, 111, 63, .08);
      }

      .table-stack td:empty {
        display: none;
      }

  .table-stack.table-bordered > :not(caption) > * > * {
    border-width: 0;
  }
}

/* ----- Ajustos per a mòbil ----- */
@media (max-width: 575.98px) {
  .xmas-card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .page-title {
    font-size: 2rem;
  }

  .hero {
    padding: 20px 8px 12px;
  }

    .hero h1 {
      font-size: 2.6rem;
    }

    .hero .hero-icons {
      font-size: 3rem;
    }

  .home-actions {
    grid-template-columns: 1fr;
    gap: 12px;
  }

    .home-actions a {
      padding: 18px 12px;
    }

  .gift-reveal .assigned-name {
    font-size: 2.4rem;
  }

  .xmas-navbar .navbar-brand {
    font-size: 1.35rem;
  }

  .event-types .btn {
    flex: 1 1 calc(50% - 8px);
  }
}

.gift-reveal .assigned-name, h1, h2 {
  overflow-wrap: anywhere;
}

.assigned-password {
  width: 100%;
  max-width: 220px;
}

@media (prefers-reduced-motion: reduce) {
  .snow, .confetti {
    display: none;
  }

  .gift img, .gift.opened img, .gift-reveal {
    animation: none;
  }
}
