/* =====================================================================
   공용 커스텀 셀렉트 — 마크업은 static/common/js/wj-select.js 가 생성한다.
   PC(768px~)는 트리거 아래 드롭다운 카드, 767px 이하는 하단 바텀시트.

   카드·딤·선택 톤은 wj-modal.css 를 따른다 —
     카드 흰 배경 + 그림자 0 8px 24px rgba(0,0,0,.10), 딤 rgba(15,23,42,.45),
     선택 항목 연파랑 #e8f0fa + 진파랑 #0d498c (tone_action)
   트리거 기본값은 문의하기 폼 인풋과 같은 외형이고, 크기는 페이지 CSS 가 인풋에 맞춰 덮는다.
   ===================================================================== */

.wj-select {
    position: relative;
    width: 100%;
}

/* 원본 select 는 값의 단일 소스로 DOM 에 남기고 화면에서만 숨긴다 */
.wj-select__native {
    display: none;
}

/* ---------------------------------------------------------------------
   트리거
   --------------------------------------------------------------------- */
.wj-select__trigger {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 48px;
    padding: 0 40px 0 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    font-size: 16px;
    font-weight: 500;
    /* 네이티브 폼 요소처럼 #wrap 의 letter-spacing:-1px 을 물려받지 않게 */
    letter-spacing: normal;
    cursor: pointer;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.wj-select__trigger:focus,
.wj-select--open .wj-select__trigger {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37,99,235,.1);
}
/* 포커스·열림보다 뒤에 둬서 값을 고를 때까지 빨간 테두리를 유지한다 */
.wj-select--invalid .wj-select__trigger {
    border-color: #d64545;
    box-shadow: 0 0 0 4px rgba(214,69,69,.1);
}
.wj-select--disabled .wj-select__trigger {
    background: #f8fafc;
    color: #94a3b8;
    cursor: default;
}

.wj-select__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.wj-select__label--placeholder {
    color: #94a3b8;
}

/* 화살표 — 문의하기 select 에 쓰던 쉐브론 SVG 그대로, 열리면 뒤집는다 */
.wj-select__arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 14px;
    height: 9px;
    margin-top: -4.5px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    transition: transform .15s ease;
}
.wj-select--open .wj-select__arrow {
    transform: rotate(180deg);
}

/* ---------------------------------------------------------------------
   PC 드롭다운 카드 — z-index 100 은 고정 헤더(2000)·응모권 버튼(900)보다 아래
   --------------------------------------------------------------------- */
.wj-select__panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 100;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    animation: wjSelectIn .15s ease;
}
.wj-select--open .wj-select__panel {
    display: block;
}
.wj-select__panel--up {
    top: auto;
    bottom: calc(100% + 6px);
}

.wj-select__list {
    max-height: 264px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.wj-select__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
    cursor: pointer;
}
.wj-select__option + .wj-select__option {
    margin-top: 2px;
}
.wj-select__option--active {
    background: #f8fafc;
}
@media (hover: hover) {
    .wj-select__option:hover {
        background: #f8fafc;
    }
}
/* hover·키보드 하이라이트보다 뒤·높은 특이도로 둬서 선택 톤을 유지한다 */
.wj-select__option.wj-select__option--on {
    background: #e8f0fa;
    color: #0d498c;
}
.wj-select__option--on.wj-select__option--active {
    background: #dbe8f6;
}
@media (hover: hover) {
    .wj-select__option.wj-select__option--on:hover {
        background: #dbe8f6;
    }
}
.wj-select__option.wj-select__option--disabled {
    background: transparent;
    color: #b8c2cc;
    cursor: default;
}

.wj-select__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.wj-select__check {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1;
}

/* 모바일은 패널 대신 바텀시트를 쓴다 */
@media screen and (max-width: 767px) {
    .wj-select--open .wj-select__panel {
        display: none;
    }
}

/* ---------------------------------------------------------------------
   모바일 바텀시트 — z-index 99990 은 응모권 패널(8000)보다 위, 안내 모달(100000)보다 아래
   --------------------------------------------------------------------- */
.wj-select-sheet {
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(15,23,42,.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
.wj-select-sheet--open {
    opacity: 1;
    visibility: visible;
}

.wj-select-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -8px 24px rgba(0,0,0,.10);
    transform: translateY(100%);
    transition: transform .22s ease-out;
}
.wj-select-sheet--open .wj-select-sheet__panel {
    transform: translateY(0);
}

.wj-select-sheet__handle {
    display: block;
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 2px;
    background: #e2e8f0;
}

.wj-select-sheet__title {
    flex-shrink: 0;
    padding: 0 4px 12px;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.3px;
}

.wj-select-sheet__list {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.wj-select-sheet__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 52px;
    padding: 0 14px;
    border-radius: 12px;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.wj-select-sheet__option + .wj-select-sheet__option {
    margin-top: 2px;
}
.wj-select-sheet__option:active {
    background: #f8fafc;
}
.wj-select-sheet__option.wj-select-sheet__option--on {
    background: #e8f0fa;
    color: #0d498c;
}
.wj-select-sheet__option.wj-select-sheet__option--disabled {
    background: transparent;
    color: #b8c2cc;
    cursor: default;
}

.wj-select-sheet__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.wj-select-sheet__check {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

/* 시트가 열린 동안 배경 페이지 스크롤 잠금 (main 은 window 가 스크롤된다) */
html.wj-select-lock,
html.wj-select-lock body {
    overflow: hidden;
}

@keyframes wjSelectIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
