/* ==============================
   Impacta100 – PRO MODE (UI)
   Coloca este archivo en /assets/css/pro.css
   ============================== */

/* ---- Paleta y tokens pro (sobrios, enterprise) ---- */
:root{
  --bg:#0b0d10;
  --bg-alt:#0e1116;
  --surface:#11151b;
  --card:#0f141a;
  --border:#1a2029;
  --text:#e9eef6;
  --muted:#a7b2c2;
  --brand:#21a607;       /* verde de marca */
  --accent:#2e7ddf;      /* azul pro UI */
  --accent-2:#6e8efb;    /* sutil para gradientes */
  --ok:#37d67a;
  --danger:#ff5e57;
  --shadow:0 20px 60px rgba(0,0,0,.35);
  --radius:18px; --radius-sm:12px; --radius-lg:24px; --radius-xl:30px;
  --maxw:1180px;
  --font: ui-sans-serif, system-ui, -apple-system, "Inter", "Segoe UI", Roboto, Arial;
}

/* ---- Layout global refinado ---- */
html,body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font);
  max-width:100%;
  overflow-x:hidden;
}
html.modal-open, body.modal-open{
  overflow:hidden !important;
  touch-action: none;
}

.container{max-width:var(--maxw);padding:28px 24px}
.header{backdrop-filter:saturate(130%) blur(8px);background:rgba(10,13,16,.78);border-bottom:1px solid var(--border)}
.nav{gap:24px}
.brand{gap:14px}
.brand .name{font-weight:800; letter-spacing:.2px}

/* Logo siempre controlado (anti "gigante") */
.header .brand img{
  height:34px !important; width:auto !important; max-width:300px !important;
  object-fit:contain !important; display:block !important;
}
@media(min-width:1024px){ .header .brand img{ height:38px !important; max-width:340px !important } }
@media(max-width:480px){ .header .brand img{ height:28px !important; max-width:220px !important } }

/* ---- Header móvil centrado + subtítulo ---- */
@media (max-width: 720px){
  .nav{ justify-content:center; }
  .brand{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px; }
  .brand-subtitle{
    display:block;
    font-size:12.5px;
    line-height:1.25;
    color:var(--muted);
    letter-spacing:.3px;
  }
}
@media (min-width: 721px){
  .brand-subtitle{ display:none; }
}

/* ---- Hero editorial (glass + gradientes sutiles) ---- */
.hero{
  position:relative;
  padding:42px 34px;
  border-radius:var(--radius-xl);
  background:
    radial-gradient(1200px 520px at -10% -30%, rgba(46,125,223,.16), transparent 60%),
    radial-gradient(900px 420px at 110% -20%, rgba(33,166,7,.12), transparent 60%),
    linear-gradient(180deg, rgba(17,21,27,.9), rgba(17,21,27,.82));
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}
.hero .badge{
  display:inline-block;
  padding:8px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  letter-spacing:.35px;
  color:#cfe0ff;
  background:rgba(46,125,223,.14);
  border:1px solid rgba(46,125,223,.35);
}
.hero-title{
  font-size:46px;
  line-height:1.08;
  letter-spacing:.2px;
  margin:10px 0 6px 0;
}
.hero-title .row{ display:block; }
@media(max-width:820px){ .hero-title{ font-size:34px } }
.hero p{ color:var(--muted); font-size:16px }

/* Frases clave en verde de marca */
.t-brand{ color:var(--brand); font-weight:800; }

/* ---- Tarjeta de registro estilo "panel" ---- */
.card{
  background:
    linear-gradient(180deg, rgba(19,24,30,.96), rgba(16,20,26,.9));
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow);
}
.card h3{margin:0 0 10px 0; font-size:21px; letter-spacing:.2px}

/* ---- Form enterprise ---- */
.input, select, textarea{
  background:#0f141a;
  border:1px solid #202838;
  color:var(--text);
  border-radius:14px;
  padding:12px 14px;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .05s ease;
}
.input::placeholder{color:#7d8aa0}
.input:focus, select:focus, textarea:focus{
  border-color:#2e7ddf;
  box-shadow:0 0 0 3px rgba(46,125,223,.28);
  outline:none;
}
.input:hover{ border-color:#2a3446 }
label small.helper{ color:#8ea0b6 }

/* ---- Botones premium ---- */
.btn{ display:inline-flex; align-items:center; justify-content:center; text-align:center;
  border:1px solid #263247;
  background:#111824;
  color:var(--text);
  border-radius:12px;
  padding:12px 16px;
  font-weight:700;
  transition:transform .06s ease, filter .16s ease, box-shadow .16s ease;
}
.btn:active{ transform:translateY(1px) }
.btn.primary{
  background:linear-gradient(180deg, #2bc20a, #188a06);
  border-color:#188a06;
  color:white;
  box-shadow:0 12px 24px rgba(33,166,7,.25);
}
.btn.primary:hover{ filter:brightness(1.05) }
.btn.ghost{
  background:transparent;
  border-color:#273549;
}
.btn.ghost:hover{ background:rgba(46,125,223,.08); border-color:#2e7ddf }

/* ---- Grids pro ---- */
.grid{display:grid; gap:20px}
@media(min-width:980px){ .grid{grid-template-columns:1.15fr .85fr} }

/* ---- Prevenir desbordes generales ---- */
body, .container, .card, .option-card, .option-meta,
.option-name, .option-desc, .notice, label, input, textarea {
  overflow-wrap:anywhere;
  word-break: break-word;
}

/* ---- Fondo damero para PNGs con transparencia ---- */
.checker{
  background-color:#0e141b;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.12) 75%);
  background-size:16px 16px;
  background-position:0 0, 0 8px, 8px -8px, -8px 0;
  border-radius:12px;
}

/* ---- Tarjetas de opciones ---- */
.options{display:grid; gap:16px}

.option-card{
  background:linear-gradient(180deg, rgba(17,22,28,.96), rgba(16,20,26,.9));
  border:1px solid var(--border);
  border-radius:16px;
  display:grid;
  gap:14px;
  align-items:start;
  padding:14px;
  transition: box-shadow .2s ease, transform .2s ease;
}

.option-card img{
  width:140px;
  height:140px;
  max-width:100%;
  object-fit:contain;
  display:block;
  border:1px solid var(--border);
  padding:8px;
  border-radius:14px;
}

.option-meta{ display:grid; gap:6px }
.option-name{ font-weight:800; font-size:18px }
.option-desc{ color:var(--muted); font-size:13.5px }

/* ---- Votación con estrellas ---- */
.rate-group{ display:grid; gap:10px; margin-top:8px }
.rate-row{ display:grid; grid-template-columns: 1fr auto; gap:10px; align-items:center }
.rate-row label{ color:#aec0d6; font-size:13.5px; white-space:nowrap }
.stars{ display:flex; gap:6px }
.star{
  font-size:22px; line-height:1;
  background:#0f141a; color:#556477;
  border:1px solid #202838; border-radius:10px;
  width:40px; height:36px; display:grid; place-items:center;
  transition:transform .06s ease, filter .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}
.star:active{ transform:translateY(1px) }
.star.is-on{
  background:rgba(46,125,223,.08);
  color:#ffd34a;
  border-color:#2e7ddf;
  box-shadow:0 0 0 2px rgba(46,125,223,.15) inset;
}

/* ---- Sliders elegantes ---- */
.slider{
  appearance:none; height:4px; border-radius:999px;
  background:linear-gradient(90deg, #2e7ddf, #21a607);
}
.slider::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:18px; height:18px; border-radius:50%;
  background:#fff; border:2px solid #2e7ddf;
  box-shadow:0 2px 10px rgba(46,125,223,.4);
}
.slider::-moz-range-thumb{
  width:18px; height:18px; border-radius:50%;
  background:#fff; border:2px solid #2e7ddf;
  box-shadow:0 2px 10px rgba(46,125,223,.4);
}
.range-row label{ color:#9fb2c8; font-size:13px }

/* ---- Asistente móvil (barra de progreso) ---- */
.vote-controls{
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + 8px);
  z-index: 20;
  margin-top: 10px;
  display: none;
}
.vote-controls .vc-inner{
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: rgba(16,20,26,.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
}
.vc-progress{ height: 8px; background:#1a2230; border-radius: 999px; overflow: hidden }
.vc-bar{ height: 100%; width: 0; background: linear-gradient(90deg,#2e7ddf,#21a607) }
.vc-steps{ font-size: 12px; color:#9fb2c8 }
.vc-actions{ display:flex; gap:8px; margin-top:10px; justify-content:flex-end }

/* ---- Botones de envío ---- */
.submit-top-wrap{
  display: none;
  margin-bottom: 12px;
  justify-content: flex-end;
  gap: 8px;
}

.submit-desktop{
  display: none;
}

.sticky-submit{
  position:sticky;
  bottom:12px;
  display:flex;
  justify-content:flex-end;
  margin-top:12px;
}

/* ---- Footer sobrio ---- */
.footer{ color:#8fa0b4; border-top:1px dashed #1e2733 }

/* ---- Micro animaciones opcionales ---- */
@media (prefers-reduced-motion: no-preference){
  .card, .hero, .option-card{ animation: proFade .3s ease both }
  @keyframes proFade { from{ opacity:.0; transform: translateY(6px) } to{ opacity:1; transform:none } }
}

/* ---- Modales (guía y confirmación) ---- */
.guide-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  contain: layout paint size;
}
.guide-modal[aria-hidden="false"]{
  display: flex;
  align-items: center;
  justify-content: center;
}

.gm-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
}

.gm-dialog{
  position: relative;
  background: #0f141b;
  color: #dbe7ff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0,0,0,.55);
  display: grid;
  gap: 12px;
  width: min(92vw, 560px);
  max-height: 88vh;
  padding: 18px;
  box-sizing: border-box;
  overflow: auto;
  overflow-x: hidden;
}

.gm-dialog, .gm-dialog *{
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gm-close{
  position: absolute;
  top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: #e7f1ff;
  line-height: 1;
}

.gm-header{ display: grid; gap: 4px; }
.gm-sub{ color:#9fb2c8; font-size:13px; }
.gm-steps{ padding-left: 18px; display:grid; gap:8px; }
.gm-actions{ display:flex; justify-content:flex-end; gap:8px; }

/* ================================
   RESPONSIVE BREAKPOINTS
   ================================ */

/* ---- Móvil (hasta 900px) ---- */
@media (max-width: 900px){
  /* Asistente móvil activo */
  .vote-controls{ display:block }
  
  /* Una opción por vez */
  .options{ display:block }
  .option-card{ margin-bottom:14px }
  
  /* Layout móvil para opciones */
  .option-card{
    display:grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "name"
      "desc" 
      "img"
      "rate";
    gap:12px;
  }
  
  .option-meta{ display: contents; }
  .option-name{ grid-area: name; font-size:18px; font-weight:800; line-height:1.2 }
  .option-desc{ grid-area: desc; color: var(--muted); font-size: 13.5px; line-height:1.45; }
  
  .option-card img{
    grid-area: img;
    width:100%;
    height:auto;
    max-height: 42vh;
    object-fit: contain;
  }
  
  .rate-group{
    grid-area: rate;
    display:grid;
    gap:12px;
  }
  
  /* Estrellas móviles */
  .rate-row{
    display:grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "stars";
    gap:8px;
    align-items:start;
  }
  .rate-row > label{ grid-area: label; }
  .rate-row .stars{
    grid-area: stars;
    display:flex;
    flex-wrap:nowrap;
    justify-content:space-between;
    gap:8px;
    width:100%;
  }
  .rate-row .star{
    flex:0 0 calc((100% - 4*8px)/5);
    height:44px;
    font-size:22px;
    border-radius:12px;
  }
  
  /* Padding inferior para botón sticky */
  .card{
    padding-bottom: 84px;
  }
  
  /* Ajustes de estrellas muy pequeñas */
  @media (max-width: 380px){
    .rate-row .star{
      flex-basis: calc((100% - 4*6px)/5);
      height:40px;
      font-size:20px;
    }
    .rate-row .stars{ gap:6px; }
  }
}

/* ---- Tablet/Desktop intermedio (901px - 1023px) ---- */
@media (min-width: 901px) and (max-width: 1023px){
  .options{
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
  }
  
  .option-card{
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    align-items: center;
  }
  
  .option-card img{
    width: 160px;
    height: 160px;
    object-fit: contain;
  }
  
  #submit-vote{ display:inline-flex }
}

/* ---- Desktop (1024px+) ---- */
@media (min-width: 1024px){
  /* Grilla 2 columnas */
  .options{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  
  /* Tarjetas con imagen arriba */
  .option-card{
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px;
    align-items: start;
  }
  
  /* Imagen grande arriba */
  .option-card > img{
    display: block;
    width: 100% !important;
    height: 360px !important;
    object-fit: cover;
    object-position: center;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #0f141b;
  }
  
  .option-card *{ min-width: 0; }
  .option-card .option-name{
    font-size: 1.22rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 2px;
  }
  
  /* Botones superiores visibles */
  .submit-top-wrap{
    display: flex !important;
  }
  
  /* Botón final centrado */
  .submit-desktop{
    display:flex !important;
    justify-content:center !important;
    align-items:center;
    width:100%;
    margin-top: 28px !important;
  }
  .submit-desktop .btn{ display:inline-flex; align-items:center; justify-content:center; text-align:center;
    min-width:240px;
    padding:12px 22px;
    font-size:16px;
  }
  
  #submit-vote{ display:inline-flex }
}

/* ---- Móvil pequeño (modales) ---- */
@media (max-width: 600px){
  .gm-dialog{
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 12px !important;
    max-height: calc(100dvh - 24px) !important;
    padding: 14px !important;
    border-radius: 14px;
  }
  .gm-actions{ justify-content: center; }
}

/* ---- Hover effects (solo desktop) ---- */
@media (hover:hover) and (pointer:fine){
  .option-card:hover{
    box-shadow: 0 10px 28px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.03);
    transform: translateY(-1px);
  }
}

/* === MODAL UX PATCH (fit viewport + sticky actions + safe areas) === */
#guide-modal.guide-modal,
#confirm-modal.guide-modal{
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: block !important;           /* asegurar render */
  pointer-events: none;                 /* bloquea clicks fuera del diálogo */
}
#guide-modal[aria-hidden="true"],
#confirm-modal[aria-hidden="true"]{ display: none !important; }

#guide-modal .gm-backdrop,
#confirm-modal .gm-backdrop{
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,.55) !important;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  pointer-events: auto; /* permite cerrar si clicas afuera (si tu JS lo maneja) */
}

#guide-modal .gm-dialog,
#confirm-modal .gm-dialog{
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 100000 !important;
  /* Layout interno flexible para sticky actions */
  display: flex;
  flex-direction: column;
  width: min(92vw, 560px) !important;
  max-height: calc(100dvh - 24px) !important;  /* 100dvh para móviles modernos */
  border-radius: 16px;
  overflow: hidden; /* oculta overflow del contenedor; el scroll va en .gm-body */
  pointer-events: auto;  /* clics sí dentro del diálogo */
}

/* Cuerpo scrolleable, con rebote touch en iOS */
#guide-modal .gm-body,
#confirm-modal .gm-body{
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 16px 16px;
}

/* Botonera siempre visible (sticky) y separada del notch */
#guide-modal .gm-actions,
#confirm-modal .gm-actions{
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom)) 16px;
  background: linear-gradient(180deg, rgba(15,20,27,0.0), rgba(15,20,27,0.85));
  border-top: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2;
}

/* Cierre siempre encima */
#guide-modal .gm-close,
#confirm-modal .gm-close{
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
}

/* Bloquea scroll del documento detrás del modal */
html.modal-open, body.modal-open{
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}
