/* 기존 스타일 유지 + 새로운 라디오 버튼 구조 추가 */

/* 기본 지역화 폼 스타일 (기존 유지) */
.localization-form {
  display: flex;
  flex-direction: column;
  flex: auto 1 0;
  // padding: 1rem;
  margin: 0 auto;
  width: 100%;
}

.localization-form:only-child {
  display: inline-flex;
  flex-wrap: wrap;
  flex: initial;
  // padding: 1rem 0;
}

.localization-form:only-child .button,
.localization-form:only-child .localization-form__select {
  // margin: 1rem 1rem 0.5rem;
  flex-grow: 1;
}

@media screen and (min-width: 750px) {
  .localization-form {
    // padding: 1rem 2rem 1rem 0;
  }

  .localization-form:first-of-type {
    padding-left: 0;
  }

  .localization-form:only-child {
    justify-content: start;
    margin: 0 1rem 0 0;
  }

  .localization-form:only-child .button,
  .localization-form:only-child .localization-form__select {
    margin: 1rem 0;
  }
}

/* 새로운 라디오 버튼 옵션 스타일 */
.localization-option {
  display: block;
  width: 100%;
  cursor: pointer;
  margin: 0;
  position: relative;

  &:hover .localization-label {
    background-color: rgba(var(--color-foreground), 0.05);
    color: rgb(var(--color-foreground));
  }
}

.localization-label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  text-decoration: none;
  line-height: calc(1 + 0.8 / var(--font-body-scale));
  color: rgba(var(--color-foreground), 0.75);
  word-break: break-word;
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;

  &:focus-within {
    outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
    outline-offset: -0.2rem;
    box-shadow: 0 0 0.2rem 0 rgba(var(--color-foreground), 0.3);
    color: rgb(var(--color-foreground));
  }
}

/* 라디오 버튼 숨김 */
.localization-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;

  &:checked + .localization-label {
    .localization-checkmark {
      opacity: 1;
      visibility: visible;
    }

    .localization-form__currency {
      opacity: 1;
    }
  }
}

/* 체크마크 래퍼 */
.checkmark-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  margin-right: 0.2rem;
}

/* 체크마크 아이콘 */
.localization-checkmark {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;

  svg {
    width: 100%;
    height: 100%;
  }
}

/* 통화 표시 스타일 (기존 로직 유지) */
.localization-form__currency {
  opacity: 0;
  transition: opacity 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  white-space: nowrap;
  padding-right: 1.7rem;
}

/* 모바일 스타일 */
@media screen and (max-width: 749px) {
  .localization-form__currency {
    opacity: 1;
  }
}

/* 호버 시 통화 표시 */
.localization-label:hover .localization-form__currency,
.localization-label:focus-within .localization-form__currency {
  opacity: 1;
}

/* 데스크톱 지역화 래퍼 스타일 */
.desktop-localization-wrapper {
  display: flex;
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999999;
  background: var(--color-black30);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  justify-content: center;
  align-items: center;
  display: none;
  &.--active {
    display: flex !important;
  }
}

.desktop-localization-wrapper .box {
  display: flex;
  flex-direction: column;
  gap: calc(var(--margin) * 2);

  .header__localization-header {
    margin-bottom: calc(var(--margin) * 2);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  button:not(.localization-combined-save-btn) {
    width: 100% !important;
    background: var(--color-grey) !important;
    border-radius: var(--radius-large);
    margin-top: var(--margin) !important;
    // padding: 1rem 1.5rem !important;
    height: 4rem !important;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;

    span {
      display: block;
    }

    &:hover {
      text-decoration: none !important;

      span {
        text-decoration: none !important;
      }
    }
  }
}

.desktop-localization-wrapper .localization-selector + .disclosure__list-wrapper {
  animation: animateMenuOpen var(--duration-default) ease;
}

.desktop-localization-wrapper .localization-form:only-child {
  padding: 0;
}

/* 데스크톱 지역화 섹션 간격 */
.desktop-localization-wrapper .localization-section {
  margin-bottom: 1.5rem;
}

.desktop-localization-wrapper .localization-section:last-of-type {
  margin-bottom: 0;
}

/* 데스크톱 지역화 저장 버튼 */
.desktop-localization-wrapper .localization-combined-save-btn {
  width: 100% !important;
  border-radius: var(--radius-large) !important;
  margin-top: calc(var(--margin) * 2) !important;
  padding: 1rem 1.5rem !important;
  height: 4rem !important;
  display: flex !important;
  gap: 1rem;
  justify-content: center !important;
  align-items: center;
  font-weight: 600;
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 기존 disclosure 스타일 유지 */
.disclosure {
  position: relative;
}

.disclosure__button {
  align-items: center;
  cursor: pointer;
  display: flex;
  height: 4rem;
  padding: 0 1.5rem 0 1.5rem;
  background-color: transparent;
}

.disclosure__button {
  transition: transform 0.2s ease;
}

.disclosure__button[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

.disclosure__list-wrapper {
  width: 100%;
  height: auto;
  background: var(--color-grey);
  border-radius: var(--radius-small);
  overflow: hidden;
  margin-top: var(--margin);
  position: absolute;
  top: 100%; /* 위에서 아래로 변경 */
  transform: translateY(0); /* 변환 제거 */
  z-index: 2;
  box-shadow: var(--popup-shadow-horizontal-offset) var(--popup-shadow-vertical-offset) var(--popup-shadow-blur-radius)
    rgba(var(--color-shadow), var(--popup-shadow-opacity));
  max-height: 27.5rem;
}

.disclosure__list {
  position: relative;
  overflow-y: auto;
  padding-bottom: 0;
  padding-top: 0.5rem;
  scroll-padding: 0.5rem 0;
  max-height: 25rem; /* 저장 버튼 공간 고려하여 조정 */
  min-width: 12rem;
  width: 100%;
}

/* 국가 선택기 특별 스타일 */
.country-selector__list {
  padding-bottom: 0;
  padding-top: 0;
}

/* 인기 국가 구분선 */
.popular-countries {
  border-bottom: 1px solid rgba(var(--color-foreground), 0.2);
  padding-bottom: 0.6rem;
  padding-top: 0.6rem;
}

.countries {
  padding-top: 0.6rem;
}

/* 국가 필터 스타일 (기존 유지) */
.country-filter {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1.5rem 0.6rem;
  position: sticky;
  top: -0.02rem;
  background-color: rgb(var(--color-background));
  z-index: 6;
}

.country-filter--no-padding {
  padding: 0;
}

.country-filter__input {
  min-width: 200px;
}

/* 모바일 메뉴 드로어 통합 지역화 폼 스타일 */
.menu-drawer__localization .localization-combined-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.menu-drawer__localization .localization-section {
  position: relative;
}

/* 모바일 메뉴 드로어 통합 저장 버튼 컨테이너 */
.menu-drawer__localization .localization-combined-actions {
  padding: 1.5rem 0 0;
  margin-top: 1rem;
  border-top: 1px solid rgba(var(--color-foreground), 0.2);
}

/* 모바일 메뉴 드로어 통합 저장 버튼 스타일 */
.menu-drawer__localization .localization-combined-save-btn {
  width: 100%;
  height: 4rem;
  padding: 1rem 1.5rem;

  border: none;
  border-radius: var(--inputs-radius-outset);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media screen and (max-width: 749px) {
  .disclosure__list-wrapper.country-selector:not([hidden]) + .country-selector__overlay:empty {
    display: block;
  }

  .country-selector__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--color-foreground), 0.5);
    z-index: 3;
    animation: animateLocalization var(--duration-default) ease;
  }

  .disclosure__list-wrapper.country-selector {
    // position: fixed;
    bottom: -1rem;
    left: 0;
    width: 100%;
    // height: 80%; /* 원래대로 복원 */
    // max-height: 80vh;
    border-radius: var(--radius-small);
    border: none;
    box-shadow: none;
    z-index: 4;
    overflow: scroll;
    // max-height: none;
  }

  .disclosure__list.country-selector__list {
    max-height: 85%;
    min-width: 100%;
    margin-bottom: 0;
    z-index: 5;
  }

  .menu-drawer__localization .localization-combined-actions {
    padding: 1rem 0 0;
  }

  .localization-label {
    padding: 1rem 1.5rem;
  }
}

/* 헤더 지역화 스타일 (기존 유지) */
.header-localization .localization-form:only-child {
  margin: 0;
  padding: 0;
}

.header-localization .disclosure .localization-form__select {
  height: auto;
  min-height: initial;
  background: transparent;
}

.header-localization .disclosure .localization-form__select:hover {
  text-decoration: underline;
}

.header-localization .localization-form__select.link:after,
.header-localization .localization-form__select.link:before {
  box-shadow: none;
}

.header-localization .localization-form__select.link:focus-visible {
  outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
  outline-offset: -0.2rem;
  box-shadow: 0 0 0.2rem 0 rgba(var(--color-foreground), 0.3);
}

/* 헤더가 아닌 일반 지역화에서는 아래로 열기 */
.header-localization:not(.menu-drawer__localization) .disclosure__list-wrapper {
  bottom: initial;
  top: 100%;
  right: 0;
  transform: translateY(0);
}

/* 언어 선택기 */
.language-selector .disclosure__list {
  min-width: 200px;
}

/* 접근성 및 모션 감소 */
@media (prefers-reduced-motion: reduce) {
  .localization-label,
  .localization-checkmark,
  .menu-drawer__localization .localization-combined-save-btn {
    transition: none;
  }
}

/* 메뉴 드로어 스타일 (기존 유지) */
.menu-drawer__localization .localization-form__select {
  background-color: initial;
  margin-top: 0;
  padding: 1rem 3.6rem 1rem 0rem;
}

.menu-drawer__localization .localization-form {
  padding: 0;
}

.menu-drawer__localization .localization-form:only-child .localization-form__select {
  margin: 0;
}

.menu-drawer__localization + .list-social {
  margin-top: 1rem;
}

/* 메뉴 드로어에서도 아래로 열기 */
.menu-drawer__localization .disclosure__list-wrapper {
  top: 100%;
  bottom: initial;
  transform: translateY(0);
}
