/* ==========================================================================
   contacto_widget.css — Burbuja de contacto (landing + panel de gestión)
   --------------------------------------------------------------------------
   Markup en templates/_contacto_widget.html, comportamiento en
   static/js/contacto_widget.js. Se sirve por el static del blueprint padre:
   url_for('app_tienda_de_barrio.static', filename='css/contacto_widget.css')

   Es self-contained a propósito (no depende de los tokens de landing.css ni de
   los de gestion_layout.css) porque los dos hosts tienen paletas distintas: la
   landing es verde y el panel violeta. Para adaptarlo, el que lo incluye
   redefine las variables `--contacto-*` en el propio widget o en :root.
   ========================================================================== */

.contacto-widget {
  --contacto-accent:        #16a34a;
  --contacto-accent-dark:   #15803d;
  --contacto-accent-soft:   #dcfce7;
  --contacto-accent-shadow: rgba(22,163,74,.42);
  --contacto-z:             200;

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--contacto-z);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #111827;
  line-height: 1.6;
}

.contacto-fab {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: var(--contacto-accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px var(--contacto-accent-shadow);
  transition: transform .18s, background .2s, box-shadow .2s;
}

.contacto-fab:hover {
  background: var(--contacto-accent-dark);
  transform: scale(1.06);
  box-shadow: 0 8px 26px var(--contacto-accent-shadow);
}

.contacto-fab svg {
  width: 26px;
  height: 26px;
  grid-area: 1 / 1;          /* apilados: se cruzan chat ↔ X sin mover el layout */
  transition: opacity .18s, transform .18s;
}

.contacto-fab__close,
.contacto-widget--abierto .contacto-fab__chat {
  opacity: 0;
  transform: rotate(-45deg) scale(.7);
}

.contacto-widget--abierto .contacto-fab__close {
  opacity: 1;
  transform: none;
}

.contacto-panel {
  width: 340px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  padding: 20px;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(10px) scale(.97);
  transition: opacity .18s ease, transform .18s ease;
}

.contacto-widget--abierto .contacto-panel {
  opacity: 1;
  transform: none;
}

.contacto-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.contacto-panel__title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
}

.contacto-panel__sub {
  font-size: 0.83rem;
  color: #4b5563;
  line-height: 1.45;
  margin: 2px 0 0;
}

.contacto-panel__close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  border-radius: 8px;
  color: #9ca3af;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s, color .2s;
}

.contacto-panel__close:hover { background: #f9fafb; color: #4b5563; }
.contacto-panel__close svg   { width: 17px; height: 17px; }

/* Identidad ya conocida (panel de gestión): en vez del campo "nombre", se
   muestra de quién sale la consulta. */
.contacto-identidad {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #4b5563;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
}

.contacto-identidad strong { color: #111827; font-weight: 600; }

.contacto-field { margin-bottom: 12px; }

.contacto-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 5px;
}

.contacto-field input,
.contacto-field textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #111827;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: border-color .2s, box-shadow .2s;
}

.contacto-field textarea { resize: vertical; min-height: 74px; }

.contacto-field input:focus,
.contacto-field textarea:focus {
  outline: none;
  border-color: var(--contacto-accent);
  box-shadow: 0 0 0 3px var(--contacto-accent-soft);
}

.contacto-error {
  font-size: 0.82rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 10px;
}

/* Botón propio y no `.btn` de la landing: el panel de gestión usa Bootstrap y no
   carga landing.css, así que el widget trae el suyo para verse igual en los dos. */
.contacto-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--contacto-accent);
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, opacity .2s;
}

.contacto-submit:hover:not(:disabled) { background: var(--contacto-accent-dark); }
.contacto-submit:disabled             { opacity: .75; cursor: default; }

.contacto-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: contactoSpin .7s linear infinite;
}

@keyframes contactoSpin { to { transform: rotate(360deg); } }

.contacto-ok { text-align: center; padding: 10px 0 6px; }

.contacto-ok__icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--contacto-accent-soft);
  color: var(--contacto-accent-dark);
  font-size: 1.4rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.contacto-ok__title { font-weight: 700; margin: 0; }
.contacto-ok__text  { font-size: 0.86rem; color: #4b5563; margin: 4px 0 0; }

@media (max-width: 640px) {
  .contacto-widget  { right: 16px; bottom: 16px; gap: 12px; }
  .contacto-fab     { width: 52px; height: 52px; }
  .contacto-fab svg { width: 23px; height: 23px; }
  .contacto-panel   { width: calc(100vw - 32px); max-width: 360px; padding: 18px; }
}
