/* ==========================================================
   DG Commerce UI - Auth Popup (Inkafarma-like)
   Scope: #dgcu-auth-overlay
========================================================== */

/* Fuente similar a Inkafarma */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

#dgcu-auth-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
#dgcu-auth-overlay.dgcu-open {
  display: flex;
}

#dgcu-auth-overlay * {
  box-sizing: border-box;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

/* Modal */
#dgcu-auth-overlay .dgcu-auth-modal {
  width: min(560px, 92vw);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.25);
  position: relative;
  border: 1px solid rgba(17, 24, 39, 0.06);
}

/* Cerrar (X) SIN CUADRADO */
#dgcu-auth-overlay .dgcu-auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: auto;
  height: auto;
  padding: 6px 8px;
  border-radius: 0;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #111827;
  opacity: 0.75;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}
#dgcu-auth-overlay .dgcu-auth-close:hover {
  background: transparent;
  color: #111827;
  opacity: 1;
  transform: scale(1.03);
}

/* Header */
#dgcu-auth-overlay .dgcu-auth-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
}

#dgcu-auth-overlay .dgcu-auth-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06);
  color: rgba(17, 24, 39, 0.55);
}
#dgcu-auth-overlay .dgcu-auth-avatar svg {
  width: 18px;
  height: 18px;
  display: block;
}

#dgcu-auth-overlay .dgcu-auth-title {
  font-weight: 800;
  font-size: 18px;
  color: #111827;
  letter-spacing: 0.2px;
}

/* Divider */
#dgcu-auth-overlay .dgcu-auth-divider {
  height: 1px;
  background: #eef0f3;
}

/* Body */
#dgcu-auth-overlay .dgcu-auth-body {
  padding: 18px 22px 22px;
}

#dgcu-auth-overlay .dgcu-auth-desc {
  margin: 6px 0 16px;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

/* Stack */
#dgcu-auth-overlay .dgcu-auth-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Botones (píldora) */
#dgcu-auth-overlay .dgcu-auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  /* Alto uniforme tipo Inkafarma */
  min-height: 52px;
  padding: 14px 16px;

  border-radius: 999px;
  border: 2px solid var(--dgcu-primary, #1f2a5a);
  background: #fff;
  color: #111827;

  text-decoration: none;
  font-weight: 700;
  font-size: 15px;

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
  cursor: pointer;
}
#dgcu-auth-overlay .dgcu-auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.1);
}

/* Icono */
#dgcu-auth-overlay .dgcu-auth-ico {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#dgcu-auth-overlay .dgcu-auth-ico svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Email button verde Inkafarma */
#dgcu-auth-overlay .dgcu-auth-btn--email {
  border-color: var(--dgcu-success, #16a34a) !important;
  color: var(--dgcu-success, #16a34a) !important;
  background: #fff !important;
  font-weight: 800 !important;
}
#dgcu-auth-overlay .dgcu-auth-btn--email:hover {
  box-shadow: 0 12px 26px rgba(22, 163, 74, 0.12);
}

/* Links */
#dgcu-auth-overlay .dgcu-auth-links {
  margin-top: 16px;
  text-align: center;
}
#dgcu-auth-overlay .dgcu-auth-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 700;
  font-size: 13.5px;
}
#dgcu-auth-overlay .dgcu-auth-link:hover {
  text-decoration: underline;
}

#dgcu-auth-overlay .dgcu-auth-small {
  margin-top: 10px;
  color: #6b7280;
  font-size: 13.5px;
  font-weight: 500;
}

#dgcu-auth-overlay .dgcu-auth-view[hidden] {
  display: none;
}

/* Subtitles */
#dgcu-auth-overlay .dgcu-auth-subtitle {
  margin: 4px 0 14px;
  text-align: center;
  color: #6b7280;
  font-size: 13.5px;
  font-weight: 600;
}

/* Form */
#dgcu-auth-overlay .dgcu-auth-form {
  margin-top: 10px;
}

#dgcu-auth-overlay .dgcu-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
#dgcu-auth-overlay .dgcu-auth-field span {
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}
#dgcu-auth-overlay .dgcu-auth-field input {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 14px;
  font-size: 15px;
  outline: none;
  background: #fff;
}
#dgcu-auth-overlay .dgcu-auth-field input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

#dgcu-auth-overlay .dgcu-auth-pass {
  position: relative;
}

/* Eye */
#dgcu-auth-overlay .dgcu-auth-eye {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  color: #6b7280;
}
#dgcu-auth-overlay .dgcu-auth-eye svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

/* Submit */
#dgcu-auth-overlay .dgcu-auth-submit {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 16px;
  min-height: 52px;
  font-weight: 800;
  font-size: 15px;
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}
#dgcu-auth-overlay .dgcu-auth-submit.dgcu-on {
  background: var(--dgcu-primary, #1f2a5a);
  color: #fff;
  cursor: pointer;
}
#dgcu-auth-overlay .dgcu-auth-submit.dgcu-on:hover {
  filter: brightness(1.05);
}

/* Msg */
#dgcu-auth-overlay .dgcu-auth-msg {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
#dgcu-auth-overlay .dgcu-auth-msg.dgcu-ok {
  color: #16a34a;
}
#dgcu-auth-overlay .dgcu-auth-msg.dgcu-err {
  color: #dc2626;
}

/* Back */
#dgcu-auth-overlay .dgcu-auth-back {
  margin-top: 12px;
  text-align: center;
}
#dgcu-auth-overlay .dgcu-auth-back a {
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
}
#dgcu-auth-overlay .dgcu-auth-back a:hover {
  text-decoration: underline;
}

/* Trigger */
#dgcu-auth-overlay .dgcu-auth-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #111827;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
#dgcu-auth-overlay .dgcu-auth-open:hover {
  filter: brightness(1.05);
}

/* ==========================================================
   ✅ MOBILE CARD MODE (LO QUE PEDISTE)
   - Tarjeta centrada
   - Márgenes laterales reales (no pegado)
   - Más redondeado
   - Sin fullscreen
========================================================== */
@media (max-width: 820px) {
  /* Overlay centrado con padding real */
  #dgcu-auth-overlay {
    padding: 14px !important; /* ✅ separa de bordes */
    align-items: center !important;
    justify-content: center !important;
  }

  /* Modal tarjeta (sobrescribe cualquier fullscreen anterior) */
  #dgcu-auth-overlay .dgcu-auth-modal {
    width: calc(100vw - 28px) !important; /* ✅ margen real */
    max-width: 520px !important;
    height: auto !important;
    max-height: 85vh !important; /* ✅ no se sale */
    border-radius: 28px !important; /* ✅ más redondeado */
    overflow: hidden !important;
  }

  /* Body con scroll interno si hace falta */
  #dgcu-auth-overlay .dgcu-auth-body {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* El cerrar que no quede “pegado” */
  #dgcu-auth-overlay .dgcu-auth-close {
    top: 10px !important;
    right: 10px !important;
    padding: 6px 8px !important;
  }

  /* Botones pill full */
  #dgcu-auth-overlay .dgcu-auth-btn {
    width: 100% !important;
    border-radius: 999px !important;
  }

  /* ✅ Anti-hide Apple (CSS) — si lo ocultaban con atributos/clases */
  #dgcu-auth-overlay .dgcu-auth-btn[data-dgcu-social="apple"],
  #dgcu-auth-overlay [data-dgcu-social="apple"][hidden],
  #dgcu-auth-overlay .dgcu-auth-btn[data-dgcu-social="apple"].hidden,
  #dgcu-auth-overlay .dgcu-auth-btn[data-dgcu-social="apple"].is-hidden {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Responsive fino (mantengo tu bloque) */
@media (max-width: 480px) {
  #dgcu-auth-overlay .dgcu-auth-head {
    padding: 14px 16px;
  }
  #dgcu-auth-overlay .dgcu-auth-body {
    padding: 16px 16px 18px;
  }
  #dgcu-auth-overlay .dgcu-auth-title {
    font-size: 16px;
  }
  #dgcu-auth-overlay .dgcu-auth-btn {
    font-size: 14px;
    min-height: 50px;
    padding: 13px 14px;
  }
  #dgcu-auth-overlay .dgcu-auth-submit {
    font-size: 14px;
    min-height: 50px;
  }
}

/* ==========================================================
   DGCU – fixes mobile + anti-conflicto
========================================================== */

/* lock scroll (misma clase que sidecart) */
.dgcu-lock {
  overflow: hidden !important;
}

/* En móviles/alturas bajas: que el modal no se rompa */
#dgcu-auth-overlay .dgcu-auth-modal {
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
#dgcu-auth-overlay .dgcu-auth-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================
   DGCU Auth Toast (post-login/register) – CENTRADO & PERSISTENTE
========================================================== */
#dgcu-auth-toast.dgcu-auth-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000001;
  width: min(520px, 92vw);
  pointer-events: none;
  opacity: 0;
  transition: 0.18s ease;
}
#dgcu-auth-toast.dgcu-auth-toast.dgcu-on {
  opacity: 1;
  pointer-events: auto;
}

#dgcu-auth-toast .dgcu-auth-toast__box {
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  padding: 14px;
}
#dgcu-auth-toast .dgcu-auth-toast__title {
  font-weight: 900;
  font-size: 14px;
  color: #111827;
  margin-bottom: 4px;
}
#dgcu-auth-toast .dgcu-auth-toast__desc {
  font-weight: 600;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 10px;
}
#dgcu-auth-toast .dgcu-auth-toast__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
#dgcu-auth-toast .dgcu-auth-toast__btn {
  flex: 1 1 220px;
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  border: 2px solid #111827;
  transition: 0.15s ease;
  cursor: pointer;
  background: transparent;
}
#dgcu-auth-toast .dgcu-auth-toast__btn--ghost {
  background: #fff;
  color: #111827;
}
#dgcu-auth-toast .dgcu-auth-toast__btn--ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.1);
}
#dgcu-auth-toast .dgcu-auth-toast__btn--primary {
  background: #111827;
  color: #fff;
}
#dgcu-auth-toast .dgcu-auth-toast__btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.18);
}

@media (max-width: 480px) {
  #dgcu-auth-toast .dgcu-auth-toast__actions {
    flex-direction: column;
  }
}

/* pantallas bajitas (celu horizontal): lo mandamos abajo */
@media (max-height: 520px) {
  #dgcu-auth-toast.dgcu-auth-toast {
    top: auto;
    bottom: 14px;
    transform: translateX(-50%);
  }
}

@media (max-width: 560px) {
  #dgcu-auth-toast .dgcu-auth-toast__actions {
    flex-direction: column;
  }
  #dgcu-auth-toast .dgcu-auth-toast__btn {
    min-width: 0;
    width: 100%;
  }
}

/* ===== DGCU CART MICRO ANIMATION ===== */
.dgcu-bump {
  animation: dgcuCartBumpGlow 0.45s ease;
}
@keyframes dgcuCartBumpGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(44, 166, 255, 0);
  }
  40% {
    transform: scale(1.15);
    box-shadow: 0 0 18px rgba(44, 166, 255, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(44, 166, 255, 0);
  }
}

/* validar correo */
.dgcu-auth-view-valid .d-flex {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.dgcu-auth-view-valid input[type="text"] {
  text-align: center;
  width: 40px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ccc;
}