/* =====================================================
   PAPILLON HUB · Modal Router (Bottom Sheet)
   Painel de selecção língua + marca.
   Alinhado com o mockup modal.jpg.
   ===================================================== */


/* ── Overlay ── */
.ph-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 40, 51, 0.45);
  z-index: var(--ph-z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ph-duration) var(--ph-ease),
              visibility 0s linear var(--ph-duration);
}

.ph-modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--ph-duration) var(--ph-ease),
              visibility 0s linear;
}


/* ── Modal container ── */
.ph-modal {
  background: var(--ph-white);
  border-radius: var(--ph-radius-xl) var(--ph-radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 24px 28px;
  transform: translateY(100%);
  transition: transform 0.4s var(--ph-ease);
}

.ph-modal-overlay.is-active .ph-modal {
  transform: translateY(0);
}

/* Desktop: centrar verticalmente */
@media (min-width: 768px) {
  .ph-modal-overlay {
    align-items: center;
  }

  .ph-modal {
    border-radius: var(--ph-radius-xl);
    max-height: 85vh;
  }
}


/* ── Handle bar ── */
.ph-modal__handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 8px;
}

.ph-modal__handle span {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--ph-line-strong);
}

@media (min-width: 768px) {
  .ph-modal__handle { display: none; }
}


/* ── Header ── */
.ph-modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 14px;
}

.ph-modal__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--ph-radius-md);
  background: var(--ph-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ph-modal__icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--ph-white);
  fill: none;
  stroke-width: 1.5;
}

.ph-modal__titles {
  flex: 1;
}

.ph-modal__eyebrow {
  font-family: var(--ph-sans);
  font-size: var(--ph-text-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ph-accent-media);
  font-weight: 700;
  margin-bottom: 2px;
}

.ph-modal__title {
  font-family: var(--ph-serif);
  font-size: var(--ph-text-lg);
  font-weight: 500;
  color: var(--ph-ink);
}

.ph-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ph-paper-tint);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ph-ink-soft);
  transition: background var(--ph-duration) var(--ph-ease);
  flex-shrink: 0;
}

.ph-modal__close:hover {
  background: var(--ph-paper-warm);
}


/* ── Divider ── */
.ph-modal__divider {
  height: 1px;
  background: var(--ph-line);
  margin-bottom: 18px;
}


/* ── Section label ── */
.ph-modal__section {
  margin-bottom: 20px;
}

.ph-modal__label {
  font-family: var(--ph-sans);
  font-size: var(--ph-text-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ph-ink-soft);
  font-weight: 700;
  margin-bottom: 10px;
}


/* ═══════════════════════════════════════════
   LANGUAGE OPTIONS (radio-style rows)
   ═══════════════════════════════════════════ */

.ph-modal__langs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ph-lang-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--ph-line);
  cursor: pointer;
  transition: all var(--ph-duration) var(--ph-ease);
  background: var(--ph-white);
  position: relative;
}

.ph-lang-option:first-child {
  border-radius: var(--ph-radius-md) var(--ph-radius-md) 0 0;
}

.ph-lang-option:last-child:not(.is-hidden) {
  border-radius: 0 0 var(--ph-radius-md) var(--ph-radius-md);
}

/* When English is hidden, the second item becomes the visual last */
.ph-lang-option:nth-child(2):last-child,
.ph-lang-option:nth-child(2):has(+ .ph-lang-option.is-hidden) {
  border-radius: 0 0 var(--ph-radius-md) var(--ph-radius-md);
}

/* Only one item visible: full radius */
.ph-lang-option:first-child:last-child:not(.is-hidden) {
  border-radius: var(--ph-radius-md);
}

/* Overlap borders instead of removing them */
.ph-lang-option + .ph-lang-option:not(.is-hidden) {
  margin-top: -1px;
}

.ph-lang-option:hover {
  background: var(--ph-paper-tint);
  z-index: 1;
}

.ph-lang-option.is-selected {
  background: var(--ph-paper-tint);
  border-color: var(--ph-ink);
  z-index: 2;
}

/* Selected: keep positional radius only */
.ph-lang-option:first-child.is-selected {
  border-radius: var(--ph-radius-md) var(--ph-radius-md) 0 0;
}

.ph-lang-option:last-child:not(.is-hidden).is-selected {
  border-radius: 0 0 var(--ph-radius-md) var(--ph-radius-md);
}

/* When English is hidden, second becomes last visually */
.ph-lang-option:nth-child(2).is-selected:has(+ .ph-lang-option.is-hidden) {
  border-radius: 0 0 var(--ph-radius-md) var(--ph-radius-md);
}

/* Middle items: no radius when selected */
.ph-lang-option:not(:first-child):not(:last-child).is-selected {
  border-radius: 0;
}

/* Only item: full radius */
.ph-lang-option:first-child:last-child.is-selected {
  border-radius: var(--ph-radius-md);
}

/* Non-selected items stay white */
.ph-lang-option:not(.is-selected):not(:hover) {
  background: var(--ph-white);
}

/* Flag */
.ph-lang-flag {
  width: 28px;
  height: 20px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ph-lang-flag svg {
  width: 28px;
  height: 20px;
  border-radius: 3px;
}

/* Name */
.ph-lang-name {
  flex: 1;
  font-family: var(--ph-sans);
  font-size: var(--ph-text-md);
  font-weight: 500;
  color: var(--ph-ink);
}

/* Radio circle */
.ph-lang-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ph-line-strong);
  display: grid;
  place-items: center;
  transition: all var(--ph-duration) var(--ph-ease);
  flex-shrink: 0;
}

.ph-lang-radio__dot {
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--ph-ink);
  transition: all var(--ph-duration) var(--ph-ease);
}

.ph-lang-option.is-selected .ph-lang-radio {
  border-color: var(--ph-ink);
}

.ph-lang-option.is-selected .ph-lang-radio__dot {
  width: 12px;
  height: 12px;
}

/* Hidden language (en for challenge/campanhas) */
.ph-lang-option.is-hidden {
  display: none;
}


/* ═══════════════════════════════════════════
   BRAND CARDS (Papillon / BOW)
   ═══════════════════════════════════════════ */

.ph-modal__brands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ph-brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px 16px;
  border: 1px solid var(--ph-line);
  border-radius: var(--ph-radius-lg);
  cursor: pointer;
  transition: all var(--ph-duration) var(--ph-ease);
  background: var(--ph-white);
  text-align: center;
}

.ph-brand-card:hover {
  border-color: var(--ph-line-strong);
  box-shadow: var(--ph-shadow-sm);
}

.ph-brand-card.is-selected {
  border-color: var(--ph-ink);
  background: var(--ph-paper-tint);
  box-shadow: var(--ph-shadow-card);
}

.ph-brand-card__ico {
  width: 56px;
  height: 56px;
  border-radius: var(--ph-radius-md);
  object-fit: contain;
}

.ph-brand-card__name {
  font-family: var(--ph-serif);
  font-size: var(--ph-text-md);
  font-weight: 500;
  color: var(--ph-ink);
}

.ph-brand-card__sub {
  font-family: var(--ph-sans);
  font-size: var(--ph-text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ph-ink-soft);
  font-weight: 600;
}


/* ── Continue button ── */
.ph-modal__continue {
  margin-top: var(--ph-space-lg);
  gap: 10px;
}

.ph-modal__continue:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ph-modal__continue svg {
  stroke: currentColor;
  fill: none;
}
