/* ═══════════════════════════════════════════════════════════════
   KAKOARA — REGION & LANGUAGE POPUP
   Premium dropdown with country flags, currency display,
   and language toggle (EN / FR).
   
   Brand colors: #fafaf9 bg · #c8943b gold · #1c1917 text
   ═══════════════════════════════════════════════════════════════ */

:root {
  --krp-overlay: rgba(0,0,0,0.25);
  --krp-panel-bg: #ffffff;
  --krp-text: #1c1917;
  --krp-text-soft: #57534e;
  --krp-text-muted: #a8a29e;
  --krp-border: #e7e5e4;
  --krp-accent: #4E95BC;
  --krp-accent-soft: rgba(78,149,188,0.08);
  --krp-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.06);
  --krp-radius: 16px;
}

/* ═══════════════════════════════════════════
   POPUP TRIGGER BUTTON (replaces <select>)
   ═══════════════════════════════════════════ */
.krp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.75);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  line-height: 1.4;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.krp-trigger:hover {
  background: rgba(255,255,255,0.13);
  color: #c8943b;
  border-color: rgba(200,148,59,0.3);
}

.krp-trigger:active {
  transform: scale(0.97);
}

.krp-trigger__flag {
  font-size: 16px;
  line-height: 1;
}

.krp-trigger__currency {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.krp-trigger__chevron {
  display: inline-flex;
  align-items: center;
  transition: transform 0.25s ease;
  margin-left: 2px;
  opacity: 0.6;
}

.krp-trigger.is-open .krp-trigger__chevron {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════════════
   OVERLAY BACKDROP
   ═══════════════════════════════════════════ */
.krp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: var(--krp-overlay);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.krp-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════
   DROPDOWN PANEL
   ═══════════════════════════════════════════ */
.krp-panel {
  position: fixed;
  z-index: 99999;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--krp-panel-bg);
  border-radius: var(--krp-radius);
  box-shadow: var(--krp-shadow);
  border: 1px solid var(--krp-border);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.25s ease;
  transform-origin: top right;
}

.krp-panel.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ─── Panel Header ─── */
.krp-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--krp-border);
}

.krp-panel__title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--krp-text-muted);
  margin: 0;
}

.krp-panel__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #f5f5f4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--krp-text-soft);
  font-size: 14px;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.krp-panel__close:hover {
  background: var(--krp-border);
  color: var(--krp-text);
}

/* ═══════════════════════════════════════════
   REGION SECTION
   ═══════════════════════════════════════════ */
.krp-region {
  padding: 8px;
}

.krp-region__title {
  display: block;
  padding: 4px 12px 6px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--krp-text-muted);
}

.krp-region__option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.krp-region__option:hover {
  background: var(--krp-accent-soft);
}

.krp-region__option:active {
  transform: scale(0.98);
}

.krp-region__option.is-active {
  background: var(--krp-accent-soft);
  color: var(--krp-accent);
}

.krp-region__option-flag {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.krp-region__option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.krp-region__option-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--krp-text);
  line-height: 1.3;
}

.krp-region__option.is-active .krp-region__option-name {
  color: var(--krp-accent);
}

.krp-region__option-currency {
  font-size: 11px;
  font-weight: 500;
  color: var(--krp-text-muted);
  line-height: 1.3;
}

.krp-region__option-check {
  display: flex;
  align-items: center;
  color: var(--krp-accent);
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.krp-region__option.is-active .krp-region__option-check {
  opacity: 1;
}

.krp-region__option-check svg {
  width: 18px;
  height: 18px;
}

/* ═══════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════ */
.krp-divider {
  height: 1px;
  background: var(--krp-border);
  margin: 4px 12px;
}

/* ═══════════════════════════════════════════
   LANGUAGE SECTION
   ═══════════════════════════════════════════ */
.krp-lang {
  padding: 8px;
}

.krp-lang__title {
  display: block;
  padding: 4px 12px 6px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--krp-text-muted);
}

.krp-lang__toggle {
  display: flex;
  background: #f5f5f4;
  border-radius: 999px;
  padding: 3px;
  margin: 0 12px 8px;
  gap: 2px;
}

.krp-lang__btn {
  flex: 1;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--krp-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.krp-lang__btn:hover {
  color: var(--krp-text-soft);
}

.krp-lang__btn.is-active {
  background: #ffffff;
  color: var(--krp-text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.krp-lang__label {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.krp-lang__flag {
  font-size: 14px;
  line-height: 1;
}

/* ═══════════════════════════════════════════
   FOOTER NOTE
   ═══════════════════════════════════════════ */
.krp-footer {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--krp-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.krp-footer__icon {
  font-size: 12px;
  color: var(--krp-accent);
  flex-shrink: 0;
}

.krp-footer__text {
  font-size: 10.5px;
  color: var(--krp-text-muted);
  line-height: 1.4;
  margin: 0;
}

.krp-footer__text strong {
  color: var(--krp-text-soft);
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   MOBILE ADAPTATION
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
  .krp-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    border-radius: var(--krp-radius) var(--krp-radius) 0 0;
    transform: translateY(20px) scale(1);
    max-height: 85vh;
    overflow-y: auto;
  }

  .krp-panel.is-visible {
    transform: translateY(0) scale(1);
  }

  .krp-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
}

/* ═══════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .krp-panel,
  .krp-backdrop,
  .krp-trigger__chevron {
    transition: none !important;
  }
}

/* ═══════════════════════════════════════════
   POSITIONING HELPER — for inline placement
   ═══════════════════════════════════════════ */
.krp-wrapper {
  position: relative;
  display: inline-flex;
}
