/**
 * PBC First Order Discount — WELCOME15 Modal Popup
 *
 * Centered modal with branded styling, fade-in animation,
 * and responsive layout for the first-order 15% discount.
 *
 * BEM naming: pbc-welcome__*
 * All values reference tokens.css custom properties.
 *
 * @package PBC_Core
 * @since 1.2.0
 */

/* ==========================================================================
   Modal Overlay + Container
   ========================================================================== */

.pbc-welcome {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: var(--pbc-space-2, 16px);
}

.pbc-welcome--open {
  display: flex;
}

/* Backdrop */
.pbc-welcome__backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(14, 23, 32, 0.50);
  cursor: pointer;
  animation: pbc-welcome-backdrop-in 0.3s ease forwards;
}

@keyframes pbc-welcome-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Modal Content Box
   ========================================================================== */

.pbc-welcome__content {
  position: relative;
  background-color: var(--pbc-white, #FFFFFF);
  border-radius: var(--pbc-radius, 8px);
  max-width: 440px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(14, 23, 32, 0.18);
  z-index: 1;
  overflow: hidden;
  animation: pbc-welcome-slide-in 0.35s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

@keyframes pbc-welcome-slide-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   Header Bar (deep navy)
   ========================================================================== */

.pbc-welcome__header {
  background-color: var(--pbc-deep-navy, #0B1F33);
  padding: 20px 24px;
  position: relative;
}

.pbc-welcome__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--pbc-white, #FFFFFF);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.pbc-welcome__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pbc-welcome__close:focus-visible {
  outline: 2px solid var(--pbc-white, #FFFFFF);
  outline-offset: 2px;
}

.pbc-welcome__heading {
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: var(--pbc-white, #FFFFFF);
  margin: 0;
  letter-spacing: -0.01em;
}

.pbc-welcome__subheading {
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.7);
  margin: 4px 0 0;
}

/* ==========================================================================
   Body
   ========================================================================== */

.pbc-welcome__body {
  padding: 28px 24px 24px;
  text-align: center;
}

/* Discount highlight */
.pbc-welcome__discount {
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  color: var(--pbc-accessible-teal, #078A94);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.pbc-welcome__discount-label {
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: var(--pbc-graphite, #2B3642);
  margin: 0 0 20px;
}

/* Code display */
.pbc-welcome__code-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pbc-welcome__code-label {
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  color: var(--pbc-graphite, #2B3642);
}

.pbc-welcome__code {
  display: inline-block;
  font-family: var(--pbc-font-mono, 'IBM Plex Mono', monospace);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  color: var(--pbc-deep-navy, #0B1F33);
  background-color: var(--pbc-off-white, #F5F7FA);
  border: 1px dashed var(--pbc-gray-2, #C9D1DB);
  border-radius: var(--pbc-radius-sm, 4px);
  padding: 8px 16px;
  letter-spacing: 0.08em;
}

/* Auto-applied note */
.pbc-welcome__auto-note {
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  color: var(--pbc-gray-2, #C9D1DB);
  margin: 8px 0 0;
}

.pbc-welcome__auto-note strong {
  color: var(--pbc-success, #1FAD83);
  font-weight: 600;
}

/* ==========================================================================
   Footer / CTA
   ========================================================================== */

.pbc-welcome__footer {
  padding: 0 24px 24px;
  text-align: center;
}

.pbc-welcome__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  background-color: var(--pbc-accessible-teal, #078A94);
  color: var(--pbc-white, #FFFFFF);
  font-family: var(--pbc-font-ui, 'Inter', sans-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  border: none;
  border-radius: var(--pbc-radius, 8px);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.pbc-welcome__cta:hover {
  background-color: var(--pbc-medical-teal, #0AA6B4);
}

.pbc-welcome__cta:focus-visible {
  outline: 2px solid var(--pbc-accessible-teal, #078A94);
  outline-offset: 2px;
}

/* ==========================================================================
   Body Scroll Lock
   ========================================================================== */

body.pbc-welcome-open {
  overflow: hidden;
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */

@media (max-width: 768px) {
  .pbc-welcome {
    padding: var(--pbc-space-2, 16px);
    align-items: flex-end;
  }

  .pbc-welcome__content {
    max-width: 100%;
    border-radius: var(--pbc-radius, 8px) var(--pbc-radius, 8px) 0 0;
    animation-name: pbc-welcome-slide-up;
  }

  @keyframes pbc-welcome-slide-up {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .pbc-welcome__header {
    padding: 16px 20px;
  }

  .pbc-welcome__heading {
    font-size: 18px;
    line-height: 24px;
    padding-right: 32px;
  }

  .pbc-welcome__body {
    padding: 24px 20px 20px;
  }

  .pbc-welcome__discount {
    font-size: 40px;
  }

  .pbc-welcome__footer {
    padding: 0 20px 20px;
  }
}
