﻿/* =========================================================
   MELHORES DO ANO
   Design tokens, layout e componentes
   ========================================================= */

/* 0) Preferências do usuário --------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  * { animation: none !important; transition: none !important; }
}

/* 1) TOKENS (cores, sombras, etc.) ---------------------------------------- */
:root{
  color-scheme: light;

  /* Fundo */
  --bg: #f6faff;
  --bg-grad-1: #f1f6ff;
  --bg-grad-2: #e8f0ff;

  /* Azul (escala) */
  --primary-50:  #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  /* Texto e neutros */
  --text:  #0b1220;
  --muted: #5b657a;

  /* Card */
  --card-bg: #ffffff;
  --card-border: rgba(59,130,246,.25);
  --shadow: 0 10px 30px rgba(37,99,235,.12);
}

/* Garante que [hidden] sempre esconda o elemento */
[hidden] { display: none !important; }

/* (opcional) classe usada como fallback pelo script */
.is-hidden { display: none !important; }

/* 2) BASE ------------------------------------------------------------------ */
*{ box-sizing:border-box; }
html, body{
  margin:0;
  color: var(--text);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,sans-serif;
  background:
    radial-gradient(1200px 600px at -10% -10%, var(--bg-grad-2) 0%, transparent 55%),
    radial-gradient(900px 500px at 110% -10%, var(--primary-50) 0%, transparent 60%),
    radial-gradient(1000px 600px at 50% 120%, #e6f0ff 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1{ margin:0 0 8px; font-weight:800; letter-spacing:-.02em; }
.container{ max-width:980px; margin:0 auto; padding:16px; }
.small{ font-size:.875rem; }
.muted{ color: var(--muted); }
.sr-only{ position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

.site-footer{
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin:32px auto 20px;
  padding-top:14px;
  border-top:1px solid rgba(15,23,42,.08);
  color: var(--muted);
  font-size:.92rem;
}
.site-footer a{
  color: var(--primary-600);
  text-decoration:none;
}
.site-footer a:hover{
  text-decoration:underline;
}
.site-footer-links{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}
.site-footer-copy{
  white-space:nowrap;
}
@media (max-width:640px){
  .site-footer{ flex-direction:column; align-items:flex-start; }
}

/* 3) GRID DE CATEGORIAS ---------------------------------------------------- */
.category-list{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap:24px;
}

/* 4) CARDS ----------------------------------------------------------------- */
.card, .category-card{
  background: linear-gradient(180deg, #fff, #f9fbff);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px 20px 18px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover, .category-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(37,99,235,.18);
  border-color: var(--primary-300);
}
.card h2, .category-card h2{ font-size:1.25rem; margin:.25rem 0 .5rem; color:#0f172a; }
.card p,  .category-card p { color: var(--muted); }

/* 5) FORM ELEMENTS --------------------------------------------------------- */
.input-row{ display:flex; gap:12px; margin-top:12px; }
.card input, .category-card input{
  flex:1; padding:12px 14px;
  border:1.5px solid #e5e7eb; border-radius:12px; background:#fff;
  outline:none; font-size:.95rem; transition: border-color .2s, box-shadow .2s;
}
.card input:focus, .category-card input:focus{
  border-color: var(--primary-400);
  box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}
.btn, .save-btn, .card button, .category-card button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:10px 14px; border-radius:12px; border:0; cursor:pointer;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color:#fff; font-weight:600;
  box-shadow: 0 8px 20px rgba(37,99,235,.25);
  transition: transform .15s ease, filter .2s ease, box-shadow .2s ease;
}
.company-btn, .btn-download, .btn-secondary-sm, .action-buttons button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.btn:hover, .save-btn:hover, .card button:hover, .category-card button:hover{
  filter: brightness(1.05); box-shadow: 0 12px 28px rgba(37,99,235,.35);
}
.btn:active, .save-btn:active, .card button:active, .category-card button:active{
  transform: translateY(1px);
}
.btn:disabled, .save-btn:disabled{ opacity:.55; cursor:not-allowed; }
button.is-busy{ cursor:progress; }
button.is-busy::before{
  content:"";
  width:14px;
  height:14px;
  border:2px solid currentColor;
  border-right-color:transparent;
  border-radius:50%;
  animation: loading-spin .75s linear infinite;
}
button.is-busy:disabled{ opacity:.82; }

/* 6) SWIPER / CARROSSEL ---------------------------------------------------- */
/* Contêiner */
.swiper{ width:100%; height:auto; }

/* Paginação (bolinhas) oculta */
#carousel .swiper-pagination{ display:none !important; }

/* Barra de navegação com setas ABAIXO (fora do overlay) */
#carousel .swiper-controls{
  display:flex !important;
  justify-content:flex-end;
  gap:12px;
  margin-top:12px;
}

/* Setas como botões “normais” */
#carousel .swiper-button-next,
#carousel .swiper-button-prev{
  position: static !important; inset:auto !important; transform:none !important;
  width:44px; height:44px;
  background: rgba(59,130,246,.08);
  border-radius:12px;
  color: var(--primary-600);
  display:inline-flex; align-items:center; justify-content:center;
  box-shadow: 0 6px 16px rgba(37,99,235,.18);
}
#carousel .swiper-button-next:hover,
#carousel .swiper-button-prev:hover{ background: rgba(59,130,246,.16); }
#carousel .swiper-button-next::after,
#carousel .swiper-button-prev::after{ font-size:18px; font-weight:700; }
#carousel .swiper-button-next, #carousel .swiper-button-prev{ margin:0; }

/* 7) FAB (menu flutuante) -------------------------------------------------- */
/* Posição: use data-pos="bottom-right|bottom-left|top-right|top-left|auto" */
.fab{ position:fixed; z-index:1000; }
.fab[data-pos="bottom-right"]{ right:20px; bottom: calc(20px + env(safe-area-inset-bottom,0px)); }
.fab[data-pos="bottom-left"] { left: 20px; bottom: calc(20px + env(safe-area-inset-bottom,0px)); }
.fab[data-pos="top-right"]   { right:20px; top:20px; }
.fab[data-pos="top-left"]    { left: 20px; top:20px; }
/* Responsivo automático: embaixo no mobile, topo no desktop */
.fab[data-pos="auto"]{ right:20px; bottom: calc(20px + env(safe-area-inset-bottom,0px)); }
@media (min-width:1024px){
  .fab[data-pos="auto"]{ top:20px; bottom:auto; }
}
.fab-btn{
  width:58px; height:58px; border-radius:50%; border:0; cursor:pointer;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color:#fff; font-size:22px; line-height:1; box-shadow: 0 14px 30px rgba(37,99,235,.35);
}
.fab-btn:hover{ filter: brightness(1.05); }
.fab-menu{
  position:absolute; right:0; min-width:200px; display:none;
  background:#fff; border:1px solid rgba(59,130,246,.22); border-radius:14px;
  box-shadow: 0 18px 45px rgba(37,99,235,.18); padding:8px;
}
.fab[data-pos="bottom-right"] .fab-menu,
.fab[data-pos="bottom-left"]  .fab-menu,
.fab[data-pos="auto"]         .fab-menu{ bottom:70px; top:auto; }
.fab[data-pos="top-right"]    .fab-menu,
.fab[data-pos="top-left"]     .fab-menu{ top:70px; bottom:auto; }
.fab-menu a{
  display:block; padding:12px 14px; border-radius:10px; text-decoration:none;
  color: var(--text); font-weight:600;
}
.fab-menu a:hover{ background: var(--primary-50); }
.fab-backdrop{ position:fixed; inset:0; background:transparent; display:block; }
.fab-backdrop[hidden]{ display:none; }

/* Se o FAB ficar embaixo à direita, dá um respiro nas setas do carrossel */
.fab[data-pos="bottom-right"] ~ .swiper-controls { margin-right:84px; }

/* Se o FAB estiver nos cantos ESQUERDOS, abre para a DIREITA */
.fab[data-pos="bottom-left"] .fab-menu,
.fab[data-pos="top-left"] .fab-menu {
  left: 0;
  right: auto;   /* sobrescreve o right:0 padrão */
}

/* Seletor “Ir para categoria” */
.category-jump{
  margin-top: 12px;
  display: flex;
  justify-content: flex-end; /* fica alinhado às setas */
}
.category-jump select{
  min-width: 260px;
  padding: 10px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: .95rem;
  box-shadow: 0 6px 16px rgba(37,99,235,.10);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.category-jump select:focus{
  border-color: var(--primary-400);
  box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}

@media (max-width: 640px){
  .category-jump{ justify-content: stretch; }
  .category-jump select{ width: 100%; min-width: 0; }
}

/* --- Caixa de ajuda/guia --- */
.tipbox{
  display:flex; align-items:flex-start; gap:12px;
  background:#eef4ff; border:1px solid rgba(59,130,246,.25);
  border-radius:12px; padding:12px 14px; margin-top:12px;
  box-shadow: 0 4px 16px rgba(37,99,235,.12);
}
.tipbox p{ margin:0; color:#0b1220; }
.btn-light{
  border:0; cursor:pointer; border-radius:10px; padding:8px 10px;
  background: #e5edff; color:#1d4ed8; font-weight:600;
}
.btn-light:hover{ filter: brightness(1.05); }

/* destaque rápido quando vier por link com cat/name */
.input-highlight{
  box-shadow: 0 0 0 4px rgba(59,130,246,.22) !important;
  border-color: var(--primary-400) !important;
  animation: fadeGlow 2.2s ease 1;
}
@keyframes fadeGlow{
  0%{ box-shadow: 0 0 0 6px rgba(59,130,246,.35); }
  100%{ box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}

/* Loading overlay para confirmação de voto */
.loading-overlay{
  position:fixed;
  inset:0;
  z-index:2000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(246,250,255,.68);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  pointer-events:auto;
}
.loading-overlay[hidden]{
  display:none;
}
.loading-overlay__box{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:14px;
  width:min(100%, 320px);
  padding:26px 24px;
  border-radius:18px;
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,251,255,.95));
  border:1px solid rgba(59,130,246,.18);
  box-shadow:0 24px 60px rgba(37,99,235,.22);
  animation:loading-pop .18s ease-out;
}
.loading-spinner{
  width:64px;
  height:64px;
  border:6px solid rgba(59,130,246,.18);
  border-top-color: var(--primary-500);
  border-radius:50%;
  animation: loading-spin 1s linear infinite;
}
.loading-overlay__message{
  text-align:center;
  font-size:1rem;
  font-weight:700;
  color: var(--text);
}
@keyframes loading-pop{
  from{
    opacity:0;
    transform:translateY(10px) scale(.98);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}
@keyframes loading-spin{
  to{ transform: rotate(360deg); }
}
/* Modal de consentimento */
.consent-modal .swal2-popup {
  max-width: 600px;
}

.consent-modal .swal2-html-container {
  text-align: left;
}

.consent-summary {
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: 0 4px;
}

.consent-summary p {
  margin: 0 0 12px;
}

.consent-version {
  font-size: .88rem;
  font-weight: 700;
}

.consent-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: .92rem;
  line-height: 1.45;
  color: var(--text);
}

.consent-option--required {
  border-color: rgba(91, 7, 16, .35);
}

.consent-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

/* 9) IDENTIDADE DA HOME ---------------------------------------------------- */
body.home-page{
  --home-bg: #fbf4ea;
  --home-surface: #fff9f2;
  --home-wine: #5b0710;
  --home-wine-dark: #3b050a;
  --home-gold: #c99a3d;
  --home-gold-light: #e7c878;
  --home-gold-text: #8a5c18;
  --home-text: #32080c;
  --home-muted: #665552;
  --home-border: rgba(126,75,36,.18);

  --bg: var(--home-bg);
  --bg-grad-1: #fffaf4;
  --bg-grad-2: #f4e4cf;
  --primary-50: #fff5f0;
  --primary-100: #f8e4dc;
  --primary-200: #edc9ba;
  --primary-300: #dca38d;
  --primary-400: #b85b60;
  --primary-500: #7b101b;
  --primary-600: var(--home-wine);
  --primary-700: var(--home-wine-dark);
  --text: var(--home-text);
  --muted: var(--home-muted);
  --card-bg: var(--home-surface);
  --card-border: var(--home-border);
  --shadow: 0 16px 38px rgba(83,37,21,.10);

  min-height:100vh;
  color:var(--home-text);
  background:
    radial-gradient(700px 420px at 102% 102%, rgba(91,7,16,.08), transparent 62%),
    var(--home-bg);
}

.home-page .home-shell{
  width:min(100%, 1420px);
  min-height:100vh;
  margin:0 auto;
  padding:clamp(20px, 3vw, 46px);
}

.home-page .home-hero{
  display:grid;
  grid-template-columns:minmax(180px, 260px) minmax(0, 1fr);
  gap:clamp(24px, 4vw, 58px);
  align-items:center;
}

.home-page .home-brand{
  min-width:0;
  display:flex;
  justify-content:center;
}
.home-page .home-brand-picture{
  display:block;
  width:min(100%, 260px);
}
.home-page .home-brand img{
  display:block;
  width:100%;
  height:auto;
}

.home-page .home-content{
  min-width:0;
}
.home-page .home-header{
  min-width:0;
}
.home-page .home-header h1{
  max-width:900px;
  margin:0;
  color:var(--home-wine-dark);
  font-size:clamp(2rem, 4vw, 3.5rem);
  line-height:1.06;
  letter-spacing:-.035em;
}
.home-page .home-kicker{
  margin:0 0 10px;
  color:var(--home-gold-text);
  font-size:.78rem;
  font-weight:800;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.home-page .home-intro{
  max-width:760px;
  margin:16px 0 0;
  color:var(--home-muted);
  font-size:clamp(1rem, 1.5vw, 1.12rem);
  line-height:1.65;
}
.home-page .auth-bar{
  margin-top:18px;
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
}
.home-page .auth-bar .muted{
  color:var(--home-text);
  font-weight:650;
}
.home-page .home-auth-gate,
.home-page .home-voting{
  margin-top:26px;
}
.home-page .home-auth-card{
  max-width:580px;
  margin-left:auto;
  margin-right:auto;
  text-align:center;
}

.home-page .card,
.home-page .category-card{
  background:linear-gradient(180deg, rgba(255,251,246,.98), rgba(255,247,239,.96));
  border-color:var(--home-border);
  box-shadow:var(--shadow);
}
.home-page .card:hover,
.home-page .category-card:hover{
  border-color:rgba(201,154,61,.55);
  box-shadow:0 20px 46px rgba(83,37,21,.16);
}
.home-page .card h2,
.home-page .card h3,
.home-page .category-card h2,
.home-page .category-card h3{
  margin:.25rem 0 .5rem;
  color:var(--home-wine-dark);
}
.home-page .card h3,
.home-page .category-card h3{
  font-size:1.25rem;
}
.home-page #categories-wrapper{
  align-items:stretch;
}
.home-page #categories-wrapper .swiper-slide{
  display:flex;
  height:auto;
}
.home-page #categories-wrapper .card{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
}
.home-page #categories-wrapper .card .input-row{
  margin-top:auto;
  padding-top:12px;
}
.home-page .card input,
.home-page .category-card input{
  min-width:0;
  color:var(--home-text);
  background:#fffdfa;
  border-color:rgba(126,75,36,.22);
}
.home-page .card input:focus,
.home-page .category-card input:focus,
.home-page .category-jump select:focus{
  border-color:var(--home-gold);
  box-shadow:0 0 0 4px rgba(201,154,61,.18);
}
.home-page .btn,
.home-page .save-btn,
.home-page .card button,
.home-page .category-card button,
.home-page .fab-btn{
  color:#fffaf3;
  background:linear-gradient(135deg, var(--home-wine), var(--home-wine-dark));
  box-shadow:0 10px 22px rgba(91,7,16,.22);
}
.home-page .btn:hover,
.home-page .save-btn:hover,
.home-page .card button:hover,
.home-page .category-card button:hover{
  box-shadow:0 13px 28px rgba(91,7,16,.30);
}

.home-page #carousel .swiper-button-next,
.home-page #carousel .swiper-button-prev{
  color:var(--home-wine);
  background:rgba(201,154,61,.13);
  border:1px solid rgba(201,154,61,.22);
  box-shadow:0 7px 18px rgba(83,37,21,.12);
}
.home-page #carousel .swiper-button-next:hover,
.home-page #carousel .swiper-button-prev:hover{
  background:rgba(201,154,61,.22);
}
.home-page .category-jump select{
  color:var(--home-text);
  background:#fffdfa;
  border-color:rgba(126,75,36,.22);
  box-shadow:0 7px 18px rgba(83,37,21,.08);
}
.home-page .tipbox{
  color:var(--home-text);
  background:#fff4df;
  border-color:rgba(201,154,61,.35);
  box-shadow:0 7px 18px rgba(83,37,21,.08);
}
.home-page .tipbox p{ color:var(--home-text); }
.home-page .btn-light{
  color:var(--home-wine);
  background:#f5dfb7;
}
.home-page .fab-menu{
  background:#fffaf4;
  border-color:var(--home-border);
  box-shadow:0 18px 45px rgba(83,37,21,.16);
}
.home-page .fab-menu a{ color:var(--home-text); }
.home-page .fab-menu a:hover{ background:#f8ead8; }
.home-page .loading-overlay{
  background:rgba(251,244,234,.76);
}
.home-page .loading-overlay__box{
  background:linear-gradient(180deg, #fffaf4, #fff5e9);
  border-color:var(--home-border);
  box-shadow:0 24px 60px rgba(83,37,21,.20);
}
.home-page .loading-spinner{
  border-color:rgba(201,154,61,.22);
  border-top-color:var(--home-wine);
}
.home-page .input-highlight{
  border-color:var(--home-gold) !important;
  box-shadow:0 0 0 4px rgba(201,154,61,.22) !important;
}
.home-page .swal2-confirm{
  background:var(--home-wine) !important;
}
.home-page .swal2-cancel{
  color:var(--home-text) !important;
  background:#ead9ca !important;
}

.home-page .home-footer{
  width:100%;
  margin-top:32px;
  padding-left:0;
  padding-right:0;
  border-top-color:rgba(126,75,36,.16);
}
.home-page .site-footer a{
  color:var(--home-wine);
  font-weight:650;
}

@media (max-width:767px){
  .home-page .home-hero{
    grid-template-columns:minmax(0, 1fr);
    gap:12px;
  }
  .home-page .home-brand-picture{
    width:220px;
  }
  .home-page .home-header{
    text-align:center;
  }
  .home-page .home-header h1,
  .home-page .home-intro{
    margin-left:auto;
    margin-right:auto;
  }
  .home-page .auth-bar{
    justify-content:center;
  }
}

@media (max-width:640px){
  .home-page .home-shell{
    padding:16px;
  }
  .home-page .home-brand-picture{
    width:min(58vw, 190px);
  }
  .home-page .home-header h1{
    font-size:clamp(1.8rem, 9vw, 2.55rem);
  }
  .home-page .home-intro{
    margin-top:12px;
    line-height:1.5;
  }
  .home-page .home-auth-gate,
  .home-page .home-voting{
    margin-top:20px;
  }
  .home-page .card,
  .home-page .category-card{
    padding:18px 16px 16px;
  }
  .home-page .tipbox{
    flex-direction:column;
  }
  .home-page .btn-light{
    align-self:flex-end;
  }
  .home-page .site-footer-copy{
    white-space:normal;
  }
}

@media (max-width:420px){
  .home-page .input-row{
    flex-direction:column;
  }
  .home-page .input-row .save-btn{
    width:100%;
  }
}
