/*
THESIS: una conversación breve y confiable; rechaza el formulario genérico y el pop-up promocional.
OWN-WORLD: blanco nítido, tinta negra, amarillo Cavipetrol y controles grandes de borde preciso.
STORY: el visitante entiende que son tres preguntas anónimas, responde y vuelve al sitio sin fricción.
FIRST VIEWPORT: botón discreto inferior; al abrir, panel de 560 px con las tres preguntas visibles y acción amarilla.
FORM: extensión refinada del lenguaje Cavipetrol existente, en modo Operate; sin nuevo mundo visual ni decoración ajena.
*/

:root {
  --cps-ink: #171717;
  --cps-yellow: #ffc400;
  --cps-yellow-focus: #e5ae00;
  --cps-white: #fff;
  --cps-soft: #f4f5f6;
  --cps-border: #d9dde1;
  --cps-muted: #525960;
  --cps-error: #b42318;
  --cps-success: #146c43;
}

/* Reset defensivo: temas de terceros suelen aplicar mayúsculas, letter-spacing o
   subrayado a botones/labels por convención de diseño propia. Se contesta esa
   propiedad aquí una sola vez para todo el widget, en vez de repetirla regla por
   regla — así el tema del sitio donde se instale no puede "colarse" en ninguna
   propiedad que nunca decidimos nosotros mismos. */
.cps-survey, .cps-survey * { box-sizing: border-box; text-transform: none; letter-spacing: normal; text-decoration: none; }
.cps-survey { position: relative; z-index: 999998; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--cps-ink); }
.cps-survey[hidden] { display: none !important; }
.cps-survey__launcher {
  position: fixed; right: 24px; bottom: var(--cps-button-bottom, 92px); z-index: 2; display: flex; align-items: center; gap: 10px; margin: 0;
  min-height: 52px; padding: 8px 18px 8px 8px; border: 0; border-radius: 12px; color: #fff; background: var(--cps-ink);
  box-shadow: 0 8px 20px rgba(0,0,0,.22), 0 2px 0 rgba(0,0,0,.24); font: 700 15px/1.2 inherit; cursor: pointer; appearance: none; -webkit-appearance: none;
  opacity: 0; translate: 0 12px; visibility: hidden; transition: opacity .24s ease-out, translate .32s cubic-bezier(.16,1,.3,1), visibility .24s;
}
.cps-survey.is-ready .cps-survey__launcher { opacity: 1; translate: 0 0; visibility: visible; }
.cps-survey__launcher:hover { background: #2a2a2a; translate: 0 -2px; }
.cps-survey__launcher:focus-visible, .cps-survey button:focus-visible, .cps-survey input:focus-visible + span, .cps-survey textarea:focus-visible, .cps-survey select:focus-visible { outline: 3px solid var(--cps-yellow-focus); outline-offset: 3px; }
.cps-survey__launcher-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--cps-yellow); color: var(--cps-ink); font-size: 21px; font-weight: 900; }
.cps-survey__backdrop { position: fixed; inset: 0; z-index: 3; background: rgba(12,14,16,.68); opacity: 0; visibility: hidden; transition: opacity .22s ease-out, visibility .22s; }
.cps-survey__panel { position: fixed; z-index: 4; left: 50%; top: 50%; width: min(500px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 32px)); overflow-y: auto; overscroll-behavior: contain; padding: 0; border: 0; border-radius: 16px; background: var(--cps-white); box-shadow: 0 20px 56px rgba(0,0,0,.32), 0 5px 0 rgba(0,0,0,.16); opacity: 0; visibility: hidden; transform: translate(-50%, calc(-50% + 24px)) scale(.98); transition: opacity .2s ease-out, transform .34s cubic-bezier(.16,1,.3,1), visibility .2s; }
.cps-survey.is-open .cps-survey__backdrop, .cps-survey.is-open .cps-survey__panel { opacity: 1; visibility: visible; }
.cps-survey.is-open .cps-survey__panel { transform: translate(-50%, -50%) scale(1); }
.cps-survey-open { overflow: hidden; }
.cps-survey__header { padding: 18px 58px 13px 24px; background: var(--cps-soft); border-bottom: 1px solid var(--cps-border); }
.cps-survey__brand { margin: 0 0 4px; color: #6b5200; font-size: 12px; font-weight: 800; }
.cps-survey__header h2, .cps-survey__success h2 { margin: 0 0 5px; color: var(--cps-ink); font-size: clamp(20px, 3.4vw, 25px); line-height: 1.15; letter-spacing: -.025em; }
.cps-survey__success p { max-width: 44ch; margin: 0; color: var(--cps-muted); font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.cps-survey__header p:last-child { max-width: none; margin: 0; color: var(--cps-muted); font-size: 13.5px; line-height: 1.45; white-space: nowrap; }
.cps-survey__close { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--cps-border); border-radius: 10px; background: #fff; color: var(--cps-ink); padding: 0; margin: 0; box-shadow: none; cursor: pointer; appearance: none; -webkit-appearance: none; }
.cps-survey__close svg { display: block; width: 18px; height: 18px; }
.cps-survey__close:hover { background: var(--cps-yellow); border-color: var(--cps-yellow); }
.cps-survey__form { padding: 14px 24px 16px; }
.cps-survey__question { min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
.cps-survey__question legend, .cps-survey__label { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 10px; color: var(--cps-ink); font-size: 15px; line-height: 1.3; font-weight: 750; }
.cps-survey__question legend > span, .cps-survey__label > span { display: inline-grid; place-items: center; flex: 0 0 auto; width: 25px; height: 25px; border-radius: 7px; background: var(--cps-yellow); color: var(--cps-ink); font-size: 13px; }
.cps-survey__label small { margin-left: auto; color: var(--cps-muted); font-size: 12px; font-weight: 500; }
.cps-rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.cps-rating label, .cps-choice-list label { position: relative; margin: 0; cursor: pointer; }
.cps-rating input, .cps-choice-list input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cps-rating label > span { display: grid; place-items: center; min-height: 44px; border: 1px solid var(--cps-border); border-radius: 11px; background: #fff; box-shadow: none; font-size: 16px; font-weight: 800; transition: background .16s, border-color .16s, box-shadow .16s; }
.cps-rating label:hover > span, .cps-choice-list label:hover > span { border-color: #989fa6; background: var(--cps-soft); }
.cps-rating input:checked + span, .cps-choice-list input:checked + span { border-color: var(--cps-ink); background: var(--cps-yellow); box-shadow: inset 0 0 0 1px var(--cps-ink); }
.cps-rating__labels { display: flex; justify-content: space-between; margin-top: 5px; color: var(--cps-muted); font-size: 11px; }
.cps-choice-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cps-choice-list label > span { display: grid; place-items: center; min-height: 44px; padding: 6px; border: 1px solid var(--cps-border); border-radius: 11px; background: #fff; box-shadow: none; font-size: 13px; line-height: 1.2; font-weight: 700; text-align: center; transition: background .16s, border-color .16s, box-shadow .16s; }
.cps-survey textarea { display: block; width: 100%; min-height: 72px; margin: 0; padding: 11px 13px; resize: vertical; border: 1px solid #aeb4ba; border-radius: 11px; box-shadow: none; background: #fff; color: var(--cps-ink); font: 400 15px/1.4 inherit; appearance: none; }
.cps-survey textarea::placeholder { color: #6b7279; opacity: 1; }
.cps-survey__select {
  display: block; width: 100%; min-height: 50px; margin: 0; padding: 11px 40px 11px 13px; border: 1px solid #aeb4ba; border-radius: 11px; box-shadow: none;
  /* !important: muchos temas/plugins (WooCommerce, Flatsome, etc.) resetean el
     ícono nativo de <select> con su propia flecha vía background-image y
     appearance en reglas sitewide — se fuerza aquí para que la nuestra siempre
     gane, sin importar el tema donde se instale el plugin. */
  background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23171717" stroke-width="2.5" stroke-linecap="round"><path d="M6 9l6 6 6-6"/></svg>') no-repeat right 12px center / 16px 16px !important;
  color: var(--cps-ink); font: 400 15px/1.4 inherit; cursor: pointer; appearance: none !important; -webkit-appearance: none !important;
}
.cps-survey__select:invalid { color: #6b7279; }
.cps-survey__hint { margin: 6px 55px 0 2px; color: var(--cps-muted); font-size: 12px; line-height: 1.4; }
.cps-survey__counter { margin: -17px 2px 0; color: var(--cps-muted); font-size: 12px; text-align: right; }
.cps-survey__error { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #e5b2ad; border-radius: 12px; background: #fff3f1; color: var(--cps-error); font-size: 14px; line-height: 1.45; font-weight: 650; }
.cps-survey__submit, .cps-survey__success button {
  width: 100%; min-height: 48px; padding: 12px 20px; margin: 0; border: 1px solid var(--cps-ink); border-radius: 12px;
  /* !important: el tema (Flatsome) trae una regla `button[type="submit"]` sitewide que
     tiene más especificidad que una sola clase y le pone fondo negro a este botón. */
  background: var(--cps-yellow) !important; color: var(--cps-ink) !important;
  box-shadow: 0 3px 0 var(--cps-ink); font: 800 16px/1.2 inherit; cursor: pointer; appearance: none; -webkit-appearance: none; transition: background .16s, color .16s, translate .16s;
}
.cps-survey__submit:hover, .cps-survey__success button:hover { background: var(--cps-ink) !important; color: var(--cps-white) !important; translate: 0 -1px; }
.cps-survey__submit:disabled { cursor: wait; opacity: .72; box-shadow: none; translate: 0 2px; }
.cps-survey__privacy { margin: 10px 0 0; color: var(--cps-muted); font-size: 12px; line-height: 1.45; text-align: center; }
.cps-survey__honeypot { position: absolute !important; left: -10000px !important; }
.cps-survey__success { padding: 34px 26px; text-align: center; }
.cps-survey__success > span { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 14px; background: var(--cps-yellow); color: var(--cps-ink); font-size: 28px; font-weight: 900; }
.cps-survey__success button { margin-top: 22px; max-width: 280px; }

@media (max-width: 600px) {
  .cps-survey__launcher { right: 12px; bottom: var(--cps-button-bottom, 92px); max-width: calc(100vw - 24px); min-height: 48px; }
  .cps-survey__panel { width: calc(100% - 24px); max-height: min(88vh, 680px); border-radius: 16px; }
  .cps-survey__header { padding: 16px 48px 13px 14px; }
  .cps-survey__header h2 { font-size: 19px; }
  .cps-survey__header p:last-child { max-width: none; font-size: 11.5px; white-space: nowrap; }
  .cps-survey__close { width: 32px; height: 32px; top: 10px; right: 10px; }
  .cps-survey__close svg { width: 15px; height: 15px; }
  .cps-survey__form { padding: 15px 16px max(18px, env(safe-area-inset-bottom)); }
  .cps-survey__question { margin-bottom: 14px; }
  .cps-survey__question legend, .cps-survey__label { font-size: 14px; margin-bottom: 8px; }
  .cps-rating { gap: 5px; }
  .cps-rating label > span { min-height: 40px; border-radius: 9px; font-size: 15px; }
  .cps-choice-list { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .cps-choice-list label > span { min-height: 40px; padding: 4px; font-size: 11.5px; }
  .cps-survey textarea { min-height: 60px; }
  .cps-survey__hint { margin: 5px 40px 0 2px; font-size: 11px; }
  .cps-survey__submit, .cps-survey__success button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .cps-survey__launcher, .cps-survey__backdrop, .cps-survey__panel { transition: none; }
}
