/* ==========================================================================
   Post Locker – Offer Subscriptions Modal (CSS)
   --------------------------------------------------------------------------
   Purpose:
   - Provides consistent styling for the subscriptions modal.
   - Matches plugin design (Roboto font, branded buttons).
   - Customizes Choices.js (multi-select with checkboxes + search).

   Notes:
   - Works for both [offer_subscriptions] and [offer_subscriptions_public].
   - Colors and spacing are aligned with overall Post Locker design system.

   Author: Freddy Persson / Validero
   ========================================================================== */

/* === Fonts & Variables =================================================== */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;600&display=swap');

:root {
  --pl-font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --pl-text: #0B051D;
  --pl-muted: #4B4560;
  --pl-border: #EAE7F2;
  --pl-border-light: #DCD7EE; /* lighter border */
  --pl-bg: #ffffff;
  --pl-btn: #0B051D;
  --pl-btn-hover: #2C2242;
}

/* === Base Typography ===================================================== */
.offer-modal,
.offer-modal *,
.offer-sub-btn {
  font-family: var(--pl-font);
  font-size: 16px;
  font-weight: 400;
  color: var(--pl-text);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.offer-sub-btn,
.offer-subscriptions-save,
.offer-subscriptions-open {
  display: inline-block;
  border: none;
  border-radius: 25px;
  padding: 10px 18px;
  background: var(--pl-btn);
  color: #fff !important;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, transform .05s ease;
  line-height: 1.2;
}
.offer-sub-btn:hover,
.offer-subscriptions-save:hover,
.offer-subscriptions-open:hover {
  background: var(--pl-btn-hover);
}
.offer-sub-btn:active,
.offer-subscriptions-save:active,
.offer-subscriptions-open:active {
  transform: translateY(1px);
}
.offer-sub-btn:focus-visible {
  outline: 2px solid #6B5CC4;
  outline-offset: 2px;
}

/* ==========================================================================
   Modal Overlay & Box
   ========================================================================== */
.offer-modal {
  display: none;                       /* hidden by default */
  position: fixed;
  z-index: 999999;
  inset: 0;                            /* top/right/bottom/left: 0 */
  background: rgba(0,0,0,0.55);        /* dimmed backdrop */
  align-items: center;
  justify-content: center;
}

/* When JS adds .is-open */
.offer-modal.is-open {
  display: flex;
}

.offer-modal-content {
  background: var(--pl-bg);
  width: 92%;
  max-width: 640px;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--pl-border);
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
  position: relative;
  animation: fadeInScale 180ms ease;
}

/* Animation */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* Modal Title */
.offer-modal-content h3 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 600;
  color: var(--pl-text);
}

/* Close Button (X) */
.offer-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  font-weight: 600;
  color: var(--pl-muted);
  cursor: pointer;
  transition: color .15s ease, transform .06s ease;
}
.offer-modal-close:hover {
  color: var(--pl-text);
  transform: scale(1.05);
}
.offer-modal-close:focus-visible {
  outline: 2px solid #6B5CC4;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ==========================================================================
   Form Layout (inside modal)
   ========================================================================== */
.offer-subscriptions-form label {
  display: block;
  margin: 12px 0 6px;
  color: var(--pl-text);
  font-weight: 600;
}

.offer-subscriptions-form input[type="email"],
.offer-subscriptions-form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--pl-border-light);
  background: #fff;
  color: var(--pl-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.offer-subscriptions-form input[type="email"]:focus,
.offer-subscriptions-form input[type="text"]:focus {
  border-color: #B8B1E6;
  box-shadow: 0 0 0 3px rgba(184,177,230,0.25);
}

/* Submit button inside modal */
.offer-subscriptions-form .offer-sub-btn {
  margin-top: 16px;
}

/* Helper text */
.offer-subscriptions-help {
  font-size: 13px;
  color: var(--pl-muted);
  margin-top: 6px;
}

/* ==========================================================================
   Choices.js Overrides
   ========================================================================== */
.choices,
.choices * {
  font-family: var(--pl-font);
  font-size: 16px;
  font-weight: 400;
}

/* Select wrapper */
.choices__inner {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--pl-border) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 1px 1px rgba(11,5,29,0.03);
}

/* Selected items (pills) */
.choices__list--multiple .choices__item {
  background-color: var(--pl-btn) !important;
  border: 1px solid var(--pl-btn) !important;
  color: #fff !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  margin: 4px 6px 0 0 !important;
  line-height: 1.1;
}

/* Remove button inside pill */
.choices__list--multiple .choices__item[data-deletable] .choices__button {
  border-left-color: rgba(255,255,255,.55) !important;
  opacity: .9;
}
.choices__list--multiple .choices__item[data-deletable] .choices__button:hover {
  opacity: 1;
}

/* Dropdown panel */
.choices__list--dropdown,
.choices__list[aria-expanded] {
  border: 1px solid var(--pl-border) !important;
  box-shadow: 0 8px 24px rgba(11,5,29,0.10);
  border-radius: 12px !important;
  margin-top: 6px;
}

/* Options inside dropdown */
.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  padding: 10px 12px;
  color: var(--pl-text);
  cursor: pointer;
}

/* Highlighted option */
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background-color: #F5F3FF !important;
  color: var(--pl-btn-hover) !important;
}

/* Search input in dropdown */
.choices__input {
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--pl-border) !important;
}

/* Focus states */
.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: #CFC8E6 !important;
  box-shadow: 0 0 0 3px rgba(44,34,66,0.08) !important;
}

/* Ensure full width */
.offer-modal .offer-subscriptions-choices {
  width: 100%;
}

/* ==========================================================================
   Notices
   ========================================================================== */
.offer-subscriptions-notice {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}
.offer-subscriptions-notice.success {
  background: #E6FFED;
  color: #065F46;
  border: 1px solid #34D399;
}
.offer-subscriptions-notice.error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #F87171;
}

/* ==========================================================================
   Accessibility focus states
   ========================================================================== */
.offer-subscriptions-form input[type="email"]:focus-visible,
.offer-subscriptions-form input[type="text"]:focus-visible,
.offer-subscriptions-form select:focus-visible {
  outline: 2px solid #6B5CC4;
  outline-offset: 2px;
}

/* Space between trigger button and notice */
.offer-sub-btn + .offer-subscriptions-notice {
  margin-top: 12px;   /* adjust to taste */
}


/* ==========================================================================
   Offer Lockbox (shortcode [offer_lockbox])
   ========================================================================== */
.offer-lockbox {
  border: 2px dashed var(--pl-border-light);
  background: #FFFFFF;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  margin: 20px 0;
  font-family: var(--pl-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--pl-text);
}

.offer-lockbox p {
  margin: 0 0 12px 0;
}

.offer-lockbox button.unlock-group-btn,
.offer-lockbox .unlock-pricing-link {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 25px;
  background: var(--pl-btn);
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, transform .05s ease;
}

.offer-lockbox button.unlock-group-btn:hover,
.offer-lockbox .unlock-pricing-link:hover {
  background: var(--pl-btn-hover);
}

.offer-lockbox button.unlock-group-btn:active,
.offer-lockbox .unlock-pricing-link:active {
  transform: translateY(1px);
}


