/* [L4.5] wego-popup.css — WEGO+ 퍼블 popup.css 기반 · Alopex Dialog/Alert + Tabs 시각.
   FO/BO 바이트 동일 · wego-forms.css 다음 로드.
   ※ .wegoplusgrid / skgas-grid / 페이저 / 그리드 셀 버튼 규칙은 건드리지 않음. */

/* ══════════════════════════════════════════════════
   독립 팝업 레이아웃 — 긴 본문에서도 하단 액션 유지
══════════════════════════════════════════════════ */
.popup-body-wrap {
    height: 100vh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

/* 팝업 문서/본문 스크롤은 셸의 3px 커스텀 스크롤과 같은 두께로 통일한다. */
.popup-body-wrap,
.popup-body-wrap > .popup-wrap,
.Dialog-contents {
    scrollbar-width: thin;
    scrollbar-color: #D1D9E0 transparent;
}

.popup-body-wrap::-webkit-scrollbar,
.popup-body-wrap > .popup-wrap::-webkit-scrollbar,
.Dialog-contents::-webkit-scrollbar {
    width: 3px;
    height: 4px;
}

.popup-body-wrap::-webkit-scrollbar-track,
.popup-body-wrap > .popup-wrap::-webkit-scrollbar-track,
.Dialog-contents::-webkit-scrollbar-track {
    background: transparent;
}

.popup-body-wrap::-webkit-scrollbar-thumb,
.popup-body-wrap > .popup-wrap::-webkit-scrollbar-thumb,
.Dialog-contents::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #D1D9E0;
}

/* 독립 팝업 본문 여백을 전 방향 10px로 통일한다. */
.popup-body-wrap .popup-wrap {
    padding: 10px;
}

/*
 * 표준 팝업(.popup-wrap + .popup-footer)은 footer를 문서 흐름에 유지한다.
 * popup-wrap만 남은 높이를 차지해 스크롤하므로, footer 실제 높이를 별도로
 * 계산하거나 하단 여백을 하드코딩하지 않아도 마지막 콘텐츠가 가려지지 않는다.
 */
.popup-body-wrap:has(> .popup-wrap + .popup-footer) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.popup-body-wrap:has(> .popup-wrap + .popup-footer) > .popup-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.popup-body-wrap:has(> .popup-wrap + .popup-footer) > .popup-footer {
    position: static;
    flex: 0 0 auto;
    margin-bottom: 0;
}

/* 10행 페이징 조회 팝업은 iframe 본문에 별도 세로 스크롤을 만들지 않는다. */
html:has(body > .popup-body-wrap > .popup-wrap--fixed-page),
body:has(> .popup-body-wrap > .popup-wrap--fixed-page) {
    overflow-y: hidden;
}

.popup-body-wrap:has(> .popup-wrap--fixed-page + .popup-footer) > .popup-wrap--fixed-page {
    overflow-y: hidden;
}

/* 숨김 체크박스만 있는 타이틀 행의 공통 28px 마진을 제거한다. */
.popup-wrap--fixed-page .title-info__wrap {
    min-height: 0;
    margin: 0;
    font-size: 0;
    line-height: 0;
}

.popup-wrap--fixed-page .title-info__wrap > .ImageCheckbox {
    font-size: 14px;
    line-height: 32px;
}

.popup-wrap--fixed-page #useYnAllCheckBox[style*="display:none"],
.popup-wrap--fixed-page #useYnAllCheckBox[style*="display: none"] {
    display: none !important;
}

/*
 * 노트북의 짧은 브라우저 뷰포트에서는 Dialog 헤더와 24px 외곽 여백을 뺀
 * iframe 높이가 650px 안팎까지 줄어든다. 10행 + 페이저 높이는 유지하고
 * 팝업 여백만 압축해 테이블/팝업에 경계성 세로 스크롤이 생기지 않게 한다.
 */
@media (max-height: 650px) {
    .popup-body-wrap:has(.ib-sheet-h-rows-10-info) .popup-wrap {
        padding-top: 2px;
        padding-bottom: 2px;
    }

    .popup-body-wrap:has(.ib-sheet-h-rows-10-info) .src-box {
        margin-bottom: 5px;
    }

    .popup-body-wrap:has(> .popup-wrap + .popup-footer):has(.ib-sheet-h-rows-10-info) > .popup-footer {
        height: 48px;
        padding: 7px 10px;
        margin-bottom: 0;
    }
}

/* 하단 버튼은 호버·활성 상태에서도 크기와 글꼴이 변하지 않는다. */
.popup-footer .Button,
.popup-footer .Button:hover,
.popup-footer .btn-primary,
.popup-footer .btn-primary:hover,
.popup-footer .btn-outline,
.popup-footer .btn-outline:hover,
.popup-footer .btn-danger,
.popup-footer .btn-danger:hover {
    box-sizing: border-box;
    transform: none;
    height: var(--btn-height, 32px);
    font-size: var(--btn-font-size, 15px);
    line-height: 1.2;
}

/* 사진 미리보기 컨테이너 — AS-IS wego-layout.css .Divimg 복원.
   (skgas-bundle 에 누락되어 흰 배경 사진이 팝업과 경계 없이 붙어 보임)
   무테 필요 화면(페이퍼리스 등)은 wego-paperless.css 가 border:none 으로 덮는다. */
.Divimg {
    background: #fff;
    border: 1px solid #76726e;
    display: block;
    overflow: hidden;
    position: relative;
    width: 100%;
    min-height: 400px;
    margin-bottom: 20px;
}
.noimg {
    background: #fff url(/resources/styles/css/wegoplus/images/defaultPreview-0997b619a63cb9993a7ea7e99f52ab72.png) no-repeat 50% 50%;
}
.Divimg img {
    width: 100%;
}

/* 사진/파일 미리보기 영역(#imgList) — 원본 크기가 큰 사진은 가로로 잘려서 스크롤로도 볼 수 없다.
   팝업 가로폭에 맞춰 축소하고, 넘치는 세로는 영역 안에서 스크롤한다. */
.popup-wrap #imgList {
    overflow: auto;
}
/* inline 로 두면 baseline 여백만큼 넘쳐 뷰어 스크롤 밖에 스크롤이 하나 더 생긴다. */
.popup-wrap #imgList img {
    display: block;
    max-width: 100%;
    height: auto;
}
.popup-wrap #imgList object {
    display: block;
    width: 100%;
}

/* 파일 미리보기 팝업 — object/img 뷰어가 남는 높이를 채우도록 세로 flex.
   .preview-viewer 가 붙은 팝업에만 적용되며, 하단 여백은 공통 고정 푸터 규칙(80px)을 그대로 쓴다. */
.popup-wrap.preview-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}
.popup-wrap.preview-viewer #imgList {
    flex: 1 1 auto;
    min-height: 0;
}
.popup-wrap.preview-viewer #imgList object { height: 100%; }
.popup-wrap.preview-viewer .Divimg { margin: 0; }
/* 원본과 동일하게 닫기 버튼을 오른쪽에 둔다. */
.popup-wrap.preview-viewer ~ .popup-footer {
    justify-content: flex-end;
    padding-right: 20px;
}

/* ══════════════════════════════════════════════════
   Alopex .Dialog → 퍼블 modal 시각
══════════════════════════════════════════════════ */
.Dialog {
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    -webkit-border-radius: var(--radius-lg) !important;
    -moz-border-radius: var(--radius-lg) !important;
    -ms-border-radius: var(--radius-lg) !important;
    -webkit-box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2) !important;
    -moz-box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2) !important;
    max-width: 1300px;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* iframe 팝업은 Dialog 본문 패딩을 iframe 내부 레이아웃과 중복 적용하지 않는다. */
.Dialog[id^="Wegoplus_Popup_"]:has(iframe) .Dialog-contents,
.Dialog[id^="Wegoplus_Popup_"]:has(iframe) iframe {
    padding: 0 !important;
    overflow: hidden !important;
}

.Dialog .Header {
    padding: 16px 48px 16px 24px !important;
    font-size: 20px;
    font-weight: 600;
    line-height: 24px;
    color: var(--text-primary);
    height: auto !important;
    min-height: 56px;
    text-align: left;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--bg-white);
    box-sizing: border-box;
}

.Alert .Header {
    display: none;
}

.Dialog .Header .DialogBtn,
.Dialog .Header .DialogBtn:hover {
    top: 14px;
    right: 16px;
    width: 28px;
    height: 28px;
    background: transparent !important;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

.Dialog .Header .DialogBtn::before {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    content: 'close';
    color: var(--text-light);
    display: block;
}

.Dialog .Header .DialogBtn:hover::before {
    color: var(--text-primary);
}

.Dialog-contents {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 24px !important;
    background: var(--bg-main);
}

.Dialog .Dialog-btnwrap {
    flex: 0 0 auto;
}

.Dialog-txt {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.Dialog-txt p {
    font-size: 14px;
    font-weight: normal;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* ══════════════════════════════════════════════════
   Alopex .Tabs — 브랜드 토큰 (skgas-ui 기본 탭, tabbar와 별개)
══════════════════════════════════════════════════ */
.Tabs > .Scroller > ul {
    border-bottom: 1px solid var(--tabbar-border);
}

.Tabs > ul > li,
.Tabs > .Scroller > ul > li {
    color: var(--tab-inactive-text);
    background: var(--tabbar-bg);
    border-bottom: 2px solid var(--tabbar-bg);
    border-top: 1px solid var(--tabbar-border);
    border-right: 1px solid var(--tabbar-border);
}

.Tabs > ul > li:hover,
.Tabs > .Scroller > ul > li:hover,
.Tabs > ul > li:active,
.Tabs > .Scroller > ul > li:active,
.Tabs > ul > li.Selected,
.Tabs > .Scroller > ul > li.Selected {
    color: var(--tab-active-text) !important;
    border-color: var(--tab-active-border) !important;
    border-bottom: 2px solid var(--tab-active-border) !important;
    background: var(--tab-active-bg) !important;
}

.Tabs.Fixed.tabs-typeb > ul > li:hover,
.Tabs.Fixed.tabs-typeb > .Scroller > ul > li:hover,
.Tabs.Fixed.tabs-typeb > ul > li:active,
.Tabs.Fixed.tabs-typeb > .Scroller > ul > li:active,
.Tabs.Fixed.tabs-typeb > ul > li.Selected,
.Tabs.Fixed.tabs-typeb > .Scroller > ul > li.Selected {
    border-top-color: var(--brand-primary) !important;
    color: var(--tab-active-text);
}
