/* ═══════════════════════════════════════════════════
 * Country Manager — Public Styles
 * Pill trigger + dropdown nav. No lightbox/modal.
 * ═══════════════════════════════════════════════════ */

/* ─── Container (<details>) ─── */
.suite-cm {
  position: relative;
  display: inline-block;
  line-height: 1;
}

/* Remove default marker */
.suite-cm > summary {
  list-style: none;
}
.suite-cm > summary::-webkit-details-marker,
.suite-cm > summary::marker {
  display: none;
}

/* ─── Pill / Trigger ─── */
.suite-cm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #22313f;
  line-height: 1;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  transition: opacity .15s;
}
.suite-cm-pill:hover {
  opacity: .8;
}

.suite-cm-pill-flag {
  display: flex;
  overflow: hidden;
  flex-shrink: 0;
}
.suite-cm-pill-flag img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.suite-cm-pill-label {
  white-space: nowrap;
}

.suite-cm-pill-arrow {
  flex-shrink: 0;
  transition: transform .2s ease;
}
details.suite-cm[open] .suite-cm-pill-arrow {
  transform: rotate(180deg);
}

/* ─── Dropdown ─── */
.suite-cm-dropdown {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%);
  z-index: -1;
  min-width: 180px;
  max-width: 240px;
  width: max-content;
  max-height: 0;
  overflow: hidden;
  padding: 0 6px;
  background: #fff;
  border: none;
  border-radius: 0 0 12px 12px;
  box-shadow: none;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), padding .35s cubic-bezier(.4,0,.2,1);
}

details.suite-cm[open] > .suite-cm-dropdown {
  max-height: 380px;
  padding: 0 6px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Body wrapper — this is what actually scrolls */
.suite-cm-dropdown-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 8px;
}

/* Scrollbar — inside the dropdown body, thin & subtle */
.suite-cm-dropdown-body::-webkit-scrollbar {
  width: 4px;
}
.suite-cm-dropdown-body::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}
.suite-cm-dropdown-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
.suite-cm-dropdown-body {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

/* ─── Country Option ─── */
.suite-cm-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #1f2937 !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  transition: background .12s;
  white-space: nowrap;
}
.suite-cm-option:hover {
  background: #f3f4f6;
  text-decoration: none !important;
  color: #1f2937 !important;
}
.suite-cm-option:visited {
  color: #1f2937 !important;
}
.suite-cm-option.is-current {
  background: #eff6ff;
  font-weight: 600;
  color: #1f2937 !important;
}
.suite-cm-option img {
  width: 20px;
  height: auto;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ─── Spanish Note ─── */
.suite-cm-note {
  padding: 10px 12px 8px;
  margin-top: 4px;
  border-top: 1px solid #f3f4f6;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.4;
}
.suite-cm-note a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}
.suite-cm-note a:hover {
  text-decoration: underline;
}

/* ─── Overlay backdrop (mobile only) ─── */
.suite-cm-overlay {
  position: fixed;
  inset: 0;
  z-index: 440000;
  background: rgba(0,0,0,0);
  pointer-events: none;
  opacity: 0;
  transition: background .3s ease, opacity .3s ease;
  display: none;
}

/* ─── Offcanvas / mobile-menu variant ─── */
.suite-cm--offcanvas {
  display: block;
  width: 100%;
}
.suite-cm--offcanvas .suite-cm-pill {
  width: 100%;
  padding: 8px 4px;
  background: transparent;
  border-radius: 8px;
}

/* ─── Close button inside dropdown (mobile only) ─── */
.suite-cm-close {
  display: none;
}

@media (max-width: 600px) {
  .suite-cm-close {
    display: flex;
    position: absolute;
    top: 14px;
    right: 20px;
    align-items: center;
    justify-content: center;
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: #111827 !important;
    line-height: 1;
    transition: opacity .15s;
    z-index: 2;
    min-width: 0 !important;
    min-height: 0 !important;
  }
  .suite-cm-close:hover {
    opacity: .6;
  }
}

@media (max-width: 600px) {
  .suite-cm-overlay {
    display: block;
  }
  .suite-cm-overlay.is-active {
    pointer-events: auto;
    opacity: 1;
    background: rgba(0,0,0,.45);
  }
  details.suite-cm .suite-cm-dropdown,
  details.suite-cm[open] > .suite-cm-dropdown,
  .suite-cm .suite-cm-dropdown,
  nav.suite-cm-dropdown {
    position: fixed !important;
    inset: auto !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    clip-path: none !important;
    box-shadow: 0 -4px 30px rgba(0,0,0,.15) !important;
    z-index: 500000 !important;
    background: #fff !important;
    transform: none !important;
    will-change: transform;
    isolation: isolate;
  }
  details.suite-cm[open] > .suite-cm-dropdown {
    max-height: 60vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .suite-cm-dropdown.suite-cm-mobile-open {
    max-height: 60vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    inset: auto !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -4px 30px rgba(0,0,0,.15) !important;
    z-index: 500000 !important;
    background: #fff !important;
    transform: none !important;
    will-change: transform;
    isolation: isolate;
  }
  /* Scrollable body — mobile overrides */
  .suite-cm-dropdown-body {
    padding: 8px 6px 16px;
    -webkit-overflow-scrolling: touch;
  }
}

/* ─── Slide-up animation for mobile bottom sheet ─── */
@keyframes suite-cm-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@media (max-width: 600px) {
  .suite-cm-dropdown.suite-cm-mobile-open {
    animation: suite-cm-slide-up .32s cubic-bezier(.4,0,.2,1) both;
  }
}
