/* ============================================
   PREFERENCE CENTER STYLES
   Flat design for newsletter management
   ============================================ */

/* ============================================
   DOI CONFIRMATION MODAL
   ============================================ */
.doi-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--color-page-background);
  overflow-y: auto;
  padding: var(--space-6) var(--space-3);
  align-items: center;
  justify-content: center;
}

.doi-modal.is-visible {
  display: flex;
}

.doi-modal__card {
  background: var(--color-max-light);
  border: 1px solid var(--color-neutral-light);
  border-radius: 12px;
  padding: var(--space-6);
  max-width: 560px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.doi-modal__icon-wrap {
  background: #e8f5e9;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-1);
}

.doi-modal__icon {
  width: 52px;
  height: 52px;
}

.doi-modal__title {
  font: 700 clamp(22px, 4vw, 32px)/1.2 var(--font-family);
  color: var(--color-max-dark);
  margin: 0;
}

.doi-modal__text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #555;
  max-width: 380px;
  margin: 0;
}

.doi-modal__email,
.doi-modal__email input {
  display: inline !important;
  background: transparent !important;
  border: none !important;
  font: 700 1.1rem/1.6 var(--font-family) !important;
  color: #333 !important;
  padding: 0 !important;
  width: auto !important;
}

.doi-modal__back {
  margin-top: var(--space-3);
  background: var(--color-max-dark);
  color: var(--color-max-light);
  border: none;
  border-radius: 6px;
  padding: 14px 24px;
  font: 400 1rem/1 var(--font-family);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.2s ease;
}

.doi-modal__back:hover {
  opacity: 0.85;
}

/* ============================================
   FLASH MESSAGES - Vertical list display
   ============================================ */
u-flash-message {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pref-root .flash-message {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.pref-error-message {
  display: block;
  color: var(--color-highlight);
  font-size: 0.9rem;
  padding: 12px var(--page-section-padding-base);
  max-width: 640px;
  margin: 0 auto;
}

/* ============================================
   HERO SECTION
   Overrides newsletter-subscription.css: removes gradient,
   adjusts padding and typography for preference center.
   ============================================ */
.newsletter-hero {
  background: transparent;
  padding: var(--space-4) var(--page-section-padding-base) var(--space-2);
  text-align: center;
}

.newsletter-hero__inner {
  max-width: 640px;
  margin: 0 auto;
}

.newsletter-hero__title {
  font: 700 clamp(24px, 5vw, 36px)/1.2 var(--font-family);
  color: var(--color-max-dark);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2) 0;
}

.newsletter-hero__subtitle {
  font: 300 clamp(15px, 2.5vw, 18px)/1.6 var(--font-family);
  color: var(--color-neutral-dim);
  margin: 0;
}

/* ============================================
   EMAIL BAR (non-sticky for preference center)
   Overrides newsletter-subscription.css: static position,
   transparent background, no border/shadow.
   ============================================ */
.newsletter-email-bar {
  position: static;
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  padding: var(--space-2) var(--page-section-padding-base) var(--space-3);
}

.newsletter-email-bar__inner {
  max-width: 640px;
  margin: 0 auto;
}

/* Logged-in row — centered */
.newsletter-email-bar__row--logged-in {
  justify-content: center;
  display: flex;
}

/* Email as plain centered text — no box */
.newsletter-email-bar__email,
.newsletter-email-bar__email input {
  background: transparent !important;
  border: none !important;
  font: 400 14px/20px var(--font-family);
  color: var(--color-neutral-dim) !important;
  padding: 0 !important;
  text-align: center;
  width: auto;
  max-width: 100%;
}

.newsletter-email-bar__email input:disabled {
  opacity: 1;
  -webkit-text-fill-color: var(--color-neutral-dim);
  cursor: default;
}

.newsletter-email-bar__logout {
  background: none;
  border: none;
  font: 500 13px/18px var(--font-family);
  color: var(--color-neutral-dim);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.newsletter-email-bar__logout:hover {
  color: var(--color-highlight);
  background: rgba(216, 17, 95, 0.08);
}

/* ============================================
   MAIN ROOT
   ============================================ */
.pref-root {
  display: block;
}

/* Preference sections container — single white card, no border */
.pref-sections {
  max-width: 760px;
  width: calc(100% - 2 * var(--page-section-padding-base));
  margin: 0 auto var(--space-6);
  padding: 0;
  display: block;
  background: var(--color-max-light);
  border-radius: 10px;
  overflow: hidden;
}

/* ============================================
   SECTIONS — white cards on altrosa background
   ============================================ */
.pref-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: var(--space-4);
  margin-top: 0;
  position: relative;
}

/* Inset separator line above each section */
.pref-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: #e3ddd6;
}

.pref-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.pref-section__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-max-dark);
  margin: 0;
}

.pref-section__subtitle {
  font-size: 0.9rem;
  color: var(--color-neutral-dim);
  margin: 0 0 20px 0;
}

.pref-section__unsubscribe {
  background: none;
  border: none;
  color: var(--color-highlight);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
}

.pref-section__unsubscribe:hover {
  text-decoration: underline;
}

.pref-section__subscribe {
  background: none;
  border: 1px solid var(--color-petrol-basic);
  color: var(--color-petrol-basic);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.pref-section__subscribe:hover {
  background: var(--color-petrol-basic);
  color: var(--color-max-light);
}

.pref-section__description {
  color: var(--color-neutral-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.pref-section__description--legal {
  background: transparent;
  padding: 0;
  padding-left: 12px;
  border-radius: 0;
  font-size: 0.8rem;
  color: var(--color-neutral-medium);
  margin-bottom: 20px;
  border-left: 3px solid var(--color-petrol-light);
}

.pref-section__description--legal a {
  color: var(--color-petrol-basic);
  text-decoration: underline;
}

.pref-section__description--legal a:hover {
  color: var(--color-highlight);
}

/* Marketing Section — always first when visible: suppress top separator */
.pref-section--marketing {
  background: transparent;
}

.pref-section--marketing::before {
  display: none;
}

/* BRIGITTE outer section: transparent container, no extra padding */
.pref-section--newsletter {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* Newsletter section shows an inset separator when it follows Marketing section */
.pref-section--newsletter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: #e3ddd6;
}

/* Completely hide the legacy section header and legal text */
.pref-section--newsletter > .pref-section__header,
.pref-section--newsletter > .pref-section__description--legal {
  display: none;
}

/* Subscribe CTA — shown only when NOT subscribed */
.pref-subscribe-cta {
  padding: var(--space-4);
  position: relative;
}

.pref-subscribe-cta::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: #e3ddd6;
}

.pref-subscribe-cta__text {
  font-size: 0.9rem;
  color: var(--color-neutral-dim);
  margin: 0 0 var(--space-2) 0;
}

.pref-subscribe-cta__btn {
  background: var(--color-petrol-basic);
  color: var(--color-max-light);
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font: 600 0.9rem/1 var(--font-family);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.pref-subscribe-cta__btn:hover {
  opacity: 0.85;
}

.pref-subscribe-cta__btn--hidden {
  display: none;
}

/* Unsubscribe row — shown at the bottom when subscribed */
.pref-unsubscribe-row {
  padding: var(--space-4);
  margin-top: 0;
  position: relative;
}

.pref-unsubscribe-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: #e3ddd6;
}

.pref-unsubscribe-row__btn {
  background: none;
  border: none;
  color: var(--color-neutral-dim);
  font: 400 0.85rem/1 var(--font-family);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.pref-unsubscribe-row__btn:hover {
  color: var(--color-highlight);
}

.pref-unsubscribe-row__btn--hidden {
  display: none;
}

/* ============================================
   CATEGORIES — white cards within newsletter section
   ============================================ */
.pref-category {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: var(--space-4);
  margin-bottom: 0;
  position: relative;
}

/* Inset separator line above each category */
.pref-category::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: #e3ddd6;
}

/* First category: no separator at the very top of the card */
.pref-category[data-category="default"]::before {
  display: none;
}

.pref-category__header {
  padding: 0 0 var(--space-1) 0;
  margin-bottom: var(--space-2);
}

.pref-category__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-max-dark);
  margin: 0 0 4px 0;
}

.pref-category__subtitle {
  font-size: 0.85rem;
  color: var(--color-neutral-dim);
  margin: 0;
}

.pref-category__content {
  padding-bottom: 0;
}

/* ============================================
   PREFERENCE ITEMS
   ============================================ */
.pref-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  cursor: pointer;
  position: relative;
}

.pref-item__toggle {
  grid-column: 1;
  padding-top: 3px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.pref-item__info {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pref-item__name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-max-dark);
  margin-bottom: 2px;
}

.pref-item__description {
  font-size: 0.85rem;
  color: var(--color-neutral-dim);
  line-height: 1.4;
  margin: 0 0 6px 0;
}

/* Frequency badge */
.pref-item__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-petrol-basic);
  background: var(--color-petrol-light);
  padding: 2px 8px;
  border-radius: 10px;
  align-self: flex-start;
}

/* ============================================
   CHECKBOX STYLING
   ============================================ */
.newsletter-checkbox {
  accent-color: var(--color-petrol-basic);
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.newsletter-checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Pin the internal checkbox part to top-left of the stretched WC */
u-newsletter-preference-checkbox::part(checkbox) {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--color-petrol-basic);
  cursor: pointer;
  margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .newsletter-hero {
    padding: var(--space-2) var(--page-section-padding-base) var(--space-1);
  }

  .newsletter-email-bar {
    padding-top: var(--space-1);
    padding-bottom: var(--space-2);
  }

  .newsletter-hero__title {
    font-size: 1.6rem;
  }

  .pref-section__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .pref-item {
    gap: 12px;
  }
}
