/* =============================================
   MYBOODAA MESA DE REGALOS v3.0 — CARD STACK
   Scattered cards + frame + bottom sheet
   ============================================= */

/* ====== CSS VARIABLES ====== */
.mb-registry-container {
  --mb-bg: #b8cfd8;
  --mb-frame-bg: #a3bcc7;
  --mb-frame-border: rgba(255, 255, 255, 0.15);
  --mb-card-bg: #ffffff;
  --mb-text-primary: #1a1a1a;
  --mb-text-secondary: #6b6b6b;
  --mb-text-muted: #a0a0a0;
  --mb-accent: #c8956c;
  --mb-accent-dark: #a87550;
  --mb-success: #4caf50;
  --mb-danger: #ef4444;
  --mb-shadow-card: 0 8px 30px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.1);
  --mb-radius-card: 16px;
  --mb-radius-btn: 16px;
  --mb-font-display: 'Playfair Display', Georgia, serif;
  --mb-font-body: 'DM Sans', -apple-system, sans-serif;
  --mb-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ====== FULLSCREEN & COVER CARD ====== */
.mb-body-locked {
  overflow: hidden !important;
  touch-action: none !important;
}

.mb-registry-container {
  width: 100%;
  position: relative;
  font-family: var(--mb-font-body);
}


.mb-cover-card {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  aspect-ratio: 16/9 !important;
  height: auto !important;
  flex: none !important;
  border-radius: 25px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  padding: 30px;
  box-sizing: border-box;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Oscurecimiento sutil (overlay) para asegurar legibilidad del texto sobre cualquier imagen */
.mb-cover-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--mb-cover-overlay, linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 60%));
  z-index: 1;
  pointer-events: none;
}

/* Contenedor invisible (máscara) superior absoluto para capturar el 100% de los clics en todo el contenedor, ignorando hijos */
.mb-cover-click-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  /* Muy por encima del texto */
  cursor: pointer;
  background: transparent;
  width: 100%;
  height: 100%;
}

/* Desktop hover (solo ratón) para evitar el bug de iOS ('sticky hover' traga el primer tap) */
@media (hover: hover) {
  .mb-cover-card:hover {
    transform: scale(0.98);
  }
}

/* Efecto de presión sutil sin deformar la caja (evita caída de evento tap) */
.mb-cover-card:active {
  opacity: 0.85;
}

.mb-cover-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.mb-cover-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}

.mb-cover-subtitle {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  opacity: 0.9;
}

.mb-fullscreen-app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  height: 100dvh;
  z-index: 2147483647; /* Máximo z-index posible — cubre admin bar, headers sticky, etc. */
  background-color: var(--mb-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;           /* Sin scroll — el fullscreen es completamente fijo */
  overscroll-behavior: none;  /* Evita cualquier propagación de scroll al body */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mb-fullscreen-app.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mb-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: transparent;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a1a;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}

.mb-close-btn:hover {
  opacity: 0.6;
}

.mb-fullscreen-app .mb-gift-wrapper {
  margin: 0 auto;
  flex: 1;          /* Ocupa todo el espacio disponible del flex-column del fullscreen */
  height: 100%;
  overflow: hidden; /* No permite scroll interno */
}

/* ====== WRAPPER ====== */
.mb-gift-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 0 20px;
  position: relative;
  font-family: var(--mb-font-body);
  color: var(--mb-text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}

/* Reset inherited styles from themes */
.mb-gift-wrapper *,
.mb-gift-wrapper *::before,
.mb-gift-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.mb-gift-wrapper img {
  max-width: none !important;
  height: auto;
}

/* ====== HEADER ====== */
.mb-gift-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 20px 8px;
  position: relative;
  z-index: 10;
}

.mb-gift-header__counter {
  font-size: 13px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.45);
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 100px;
  font-family: var(--mb-font-body);
}

/* ====== PROGRESS BAR ====== */
.mb-progress-bar {
  margin: 8px 20px 16px;
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 100px;
  overflow: hidden;
}

.mb-progress-fill {
  height: 100%;
  background: var(--mb-accent);
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ====== CARD STACK AREA ====== */
.mb-stack-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1;           /* Crece para llenar el espacio entre header y panel inferior */
  min-height: 0;     /* Necesario para que flex: 1 funcione correctamente en iOS */
}

/* THE FRAME */
.mb-stack-frame {
  position: relative;
  width: min(calc(100% - 40px), 40dvh);
  max-width: 360px;
  aspect-ratio: 3 / 3.6;
  margin: 0 auto;
  background: var(--mb-frame-bg);
  border-radius: 24px;
  border: 2px solid var(--mb-frame-border);
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.06), 0 4px 30px rgba(0, 0, 0, 0.08);
  overflow: visible;
}

.mb-stack-viewport {
  position: absolute;
  inset: 0;
  overflow: visible;
}

/* ====== CARD ====== */
.mb-card {
  position: absolute;
  width: 72%;
  height: 82%;
  top: 50%;
  left: 50%;
  border-radius: var(--mb-radius-card);
  overflow: hidden;
  background: var(--mb-card-bg);
  box-shadow: var(--mb-shadow-card);
  will-change: transform, opacity;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mb-card.is-dragging {
  cursor: grabbing;
  transition: none !important;
  z-index: 100 !important;
}

.mb-card.is-swiping-out {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.5s ease-out;
  pointer-events: none;
}

/* Card white border (Polaroid) */
.mb-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--mb-radius-card);
  border: 4px solid rgba(255, 255, 255, 0.85);
  z-index: 4;
  pointer-events: none;
}

/* Card image */
.mb-card__image {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #ddd;
}

.mb-card__image img,
.mb-gift-wrapper .mb-card__image img,
.elementor .mb-card__image img,
.elementor-widget-container .mb-card__image img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 100% !important;
  min-height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  vertical-align: top !important;
  box-shadow: none !important;
}

.mb-card__image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: linear-gradient(135deg, #e8e2dc, #d4cbc2);
}

/* Reserved overlay */
.mb-card.is-reserved .mb-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.mb-card__reserved-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--mb-text-primary);
  padding: 10px 22px;
  border-radius: 100px;
  font-family: var(--mb-font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

.mb-card.is-reserved .mb-card__reserved-badge {
  display: flex;
  align-items: center;
  gap: 7px;
}

.mb-card__reserved-badge::before {
  content: '✓';
  width: 20px;
  height: 20px;
  background: var(--mb-success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Info pill on card */
.mb-card__info-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 7px 12px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mb-font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--mb-text-primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mb-card__info-pill svg {
  width: 13px;
  height: 13px;
  opacity: 0.5;
}

/* ====== PRODUCT INFO PANEL ====== */
.mb-product-panel {
  padding: 12px 20px 0;
}

.mb-product-panel__tags {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.mb-product-tag {
  font-family: var(--mb-font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 11px;
  border-radius: 100px;
  background: rgba(200, 149, 108, 0.15);
  color: var(--mb-accent-dark);
}

.mb-product-tag--reserved {
  background: rgba(239, 68, 68, 0.12);
  color: var(--mb-danger);
}

.mb-product-panel__name {
  font-family: var(--mb-font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--mb-text-primary);
  margin-bottom: 5px;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mb-product-panel__desc {
  font-family: var(--mb-font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--mb-text-secondary);
  margin-bottom: 10px;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mb-product-panel__price {
  font-family: var(--mb-font-body);
  font-size: 22px;
  font-weight: 700;
  color: var(--mb-text-primary);
  letter-spacing: -0.01em;
  text-align: center;
}

/* ====== ACTION BAR ====== */
.mb-action-bar {
  padding: 12px 20px 16px;
}

.mb-btn-buy {
  width: 100%;
  padding: 17px 24px;
  border: none;
  border-radius: var(--mb-radius-btn);
  font-family: var(--mb-font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  background: var(--mb-text-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.mb-btn-buy:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.mb-btn-buy:active:not(:disabled) {
  transform: translateY(0);
}

.mb-btn-buy:disabled {
  background: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.35);
  cursor: not-allowed;
}

.mb-btn-buy.is-reserved {
  background: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.mb-btn-buy svg {
  flex-shrink: 0;
}

/* ====== DOTS ====== */
.mb-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 14px 0 4px;
}

.mb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-appearance: none;
  appearance: none;
}

.mb-dot.is-active {
  width: 22px;
  border-radius: 100px;
  background: var(--mb-accent);
}

.mb-dot.is-reserved {
  background: rgba(0, 0, 0, 0.08);
}

.mb-dot.is-reserved.is-active {
  background: var(--mb-danger);
  opacity: 0.7;
}


/* =============================================
   BOTTOM SHEET (Modal)
   ============================================= */

.mb-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 99998;
  transition: background 0.35s ease;
}

.mb-sheet-overlay.is-visible {
  display: block;
  background: rgba(0, 0, 0, 0.5);
}

.mb-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #ffffff;
  border-radius: 28px 28px 0 0;
  padding: 12px 24px calc(24px + var(--mb-safe-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 -10px 60px rgba(0, 0, 0, 0.15);
  font-family: var(--mb-font-body);
}

.mb-sheet.is-visible {
  transform: translateY(0);
}

.mb-sheet__handle {
  width: 36px;
  height: 4px;
  background: #ddd;
  border-radius: 100px;
  margin: 0 auto 20px;
}

.mb-sheet__preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #f5f0eb;
  border-radius: 16px;
  margin-bottom: 20px;
}

.mb-sheet__preview-img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.mb-sheet__preview-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--mb-text-primary);
  line-height: 1.3;
}

.mb-sheet__preview-price {
  font-size: 13px;
  color: var(--mb-text-secondary);
  margin-top: 2px;
}

.mb-sheet__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: transparent;
  color: var(--mb-text-primary);
  border: 2px solid rgba(0, 0, 0, 0.07);
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 18px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.mb-sheet__link:hover {
  background: #f5f0eb;
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--mb-text-primary);
}

.mb-sheet__divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 0 0 18px;
  position: relative;
}

.mb-sheet__divider span {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  padding: 0 12px;
  font-size: 11px;
  color: var(--mb-text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.mb-sheet__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--mb-text-secondary);
  margin-bottom: 8px;
  display: block;
}

.mb-sheet__input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(0, 0, 0, 0.07);
  border-radius: 14px;
  font-family: var(--mb-font-body);
  font-size: 15px;
  color: var(--mb-text-primary);
  background: #f9f6f3;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.mb-sheet__input::placeholder {
  color: var(--mb-text-muted);
}

.mb-sheet__input:focus {
  border-color: var(--mb-accent);
}

.mb-sheet__input.has-error {
  border-color: var(--mb-danger);
}

.mb-sheet__buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.mb-sheet__btn-cancel {
  flex: 0.6;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: #f0ebe6;
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.mb-sheet__btn-cancel:hover {
  background: #e4ddd6;
}

.mb-sheet__btn-confirm {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: var(--mb-text-primary);
  color: #ffffff;
  font-family: var(--mb-font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.mb-sheet__btn-confirm:hover:not(:disabled) {
  background: #333;
  transform: translateY(-1px);
}

.mb-sheet__btn-confirm:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ====== TOAST ====== */
.mb-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 14px 24px;
  border-radius: 100px;
  font-family: var(--mb-font-body);
  font-size: 14px;
  font-weight: 600;
  z-index: 999999;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  color: #ffffff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  pointer-events: none;
}

.mb-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.mb-toast.is-success {
  background: var(--mb-success);
}

.mb-toast.is-error {
  background: var(--mb-danger);
}

/* ====== EMPTY STATE ====== */
.mb-no-gifts {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 15px;
  font-family: var(--mb-font-body);
}

/* ====== RESPONSIVE ====== */
@media (min-width: 500px) {
  .mb-gift-wrapper {
    max-width: 460px;
  }

  .mb-stack-frame {
    max-height: 480px;
  }
}

@media (max-width: 375px) {
  .mb-stack-frame {
    aspect-ratio: 3 / 3.3;
  }

  .mb-product-panel__name {
    font-size: 21px;
  }

  .mb-product-panel__price {
    font-size: 19px;
  }

  .mb-card {
    width: 68%;
  }
}

/* ====== ENTRY ANIMATION ====== */
@keyframes mbFadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mb-product-panel {
  animation: mbFadeInUp 0.4s ease-out both;
}

.mb-action-bar {
  animation: mbFadeInUp 0.4s ease-out 0.1s both;
}