/* ==========================================================
   메인(Index) 반응형 보정
   - PC     : 1200px 이상 (기존 디자인 유지)
   - 태블릿 : 769px ~ 1199px
   - 모바일 : 768px 이하
   ※ Index.cshtml 에서 가장 마지막에 로드되어야 함
========================================================== */

/* ---------- 공통 ---------- */

/* 캐러셀(owl overflow:visible) 때문에 생기는 가로 스크롤 방지 */
body.index-page {
    overflow-x: hidden;
}

.labguide-section,
.labpart-section {
    overflow: hidden;
}

/* ※ 푸터 반응형은 공용 layout.css / main-footer.css 에서 처리 */

/* 4번 슬라이드 강조 문구의 인라인 40px 고정값 해제 */
.slide-text .main-text span {
    font-size: inherit !important;
}

/* ==========================================================
   태블릿 + 모바일 (1199px 이하)
========================================================== */
@media (max-width: 1199px) {

    /* 슬라이드 이미지 비율 유지 (찌그러짐 방지) */
    .swiper-slide img {
        object-fit: cover;
        object-position: center;
    }

    /* 검사 안내 / 검사부 */
    .labguide-container,
    .labpart-container {
        max-width: 100%;
        padding: 0 60px;
    }

    .labguide-slider .owl-prev,
    .labpart-slider .owl-prev {
        margin-left: -50px;
    }

    .labguide-slider .owl-next,
    .labpart-slider .owl-next {
        margin-right: -50px;
    }

    .labguide-slider .labguide-card,
    .labpart-slider .labpart-card {
        max-width: none;
        width: 100%;
    }

    .labguide-img,
    .labpart-img {
        height: 260px;
    }
}

/* ==========================================================
   태블릿 (769px ~ 1199px)
========================================================== */
@media (min-width: 769px) and (max-width: 1199px) {

    /* --- 헤더: 로고와 메뉴 겹침 방지 (메뉴를 오른쪽 정렬) --- */
    body.index-page #header nav {
        left: auto;
        right: 20px;
        transform: none;
    }

    body.index-page .top-kcl-logo img {
        width: 130px;
    }

    body.index-page .gnb > li > a {
        padding: 30px 8px;
        font-size: 14px;
    }

    /* --- 히어로 --- */
    .hero {
        height: min(100vh, 900px);
    }

    .slide-text {
        left: 6%;
        right: 6%;
        top: 35%;
    }

    .sub-text {
        font-size: 22px !important;
    }

    .main-text {
        font-size: 30px !important;
        letter-spacing: 0;
    }

    .main-sub {
        font-size: 20px !important;
        letter-spacing: 0;
        line-height: 1.5;
    }

    /* --- 검사결과/검사항목 오버레이 --- */
    .overlay-ui {
        height: auto;
        width: 100%;
        bottom: 24px;
    }

    .overlay-box {
        width: 100%;
        max-width: 760px;
        padding: 0 16px;
    }

    .overlay-inner {
        width: 100%;
    }

    .overlay-card {
        padding: 20px;
    }

    .overlay-title {
        margin-left: 0;
        white-space: nowrap;
        font-size: 20px;
    }

    .btn-go-oldsite.back {
        height: 30px;
        padding: 0 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 로그인 후 '검사결과확인 / 샘플수거요청' 버튼 (html 기본 글자 12.5px 이라 rem 값이 너무 작아졌음) */
    .after-actions .action-btn {
        font-size: 15px;
        font-weight: 600;
        height: 42px;
        white-space: nowrap;
    }

    /* 로그인 후 '담당자 / 관리자' 안내 문구 */
    .after-info,
    .after-info p {
        font-size: 15px;
        line-height: 1.5;
    }

    .form-block {
        grid-template-columns: 1fr 80px;
        column-gap: 10px;
    }

    .form-btn {
        width: 100%;
    }

    .input-field {
        font-size: 15px;
    }

    .form-extra {
        margin-left: 0;
    }

    /* --- 퀵메뉴(사이드바) 축소 --- */
    .side-bar {
        top: auto;
        bottom: 20px; /* 위로 가기 원형 버튼은 모바일에서만 표시되므로 아래 자리 비우지 않음 */
        right: 12px;
        width: 64px;
        height: auto;
    }

    .side-item {
        flex: none;
        padding: 8px 0;
    }

        .side-item svg {
            width: 22px;
            height: 22px;
        }

        .side-item span {
            font-size: 11px;
            margin-top: 3px;
        }

    /* --- 책자 / 공지 --- */
    .info-section {
        padding: 40px 90px 40px 24px; /* 오른쪽: 퀵메뉴 공간 */
    }

    .info-container {
        gap: 24px;
    }

    .left-area {
        flex: 0 0 200px;
        align-items: center;
    }

    .left-title {
        font-size: 18px;
        white-space: nowrap;
    }

    .book-info {
        flex-direction: column;
        gap: 14px;
    }

    .image-wrapper {
        width: 140px;
        height: 192px;
    }

    .right-area {
        min-width: 0;
    }

    .tab-btn {
        font-size: 18px;
    }

    /* --- 검사 안내 / 검사부 --- */
    .labguide-section,
    .labpart-section {
        padding-top: 56px;
    }

    .labguide-section-title,
    .labpart-section-title {
        font-size: 24px;
        margin-bottom: 24px;
    }
}

/* ==========================================================
   모바일 (768px 이하)
========================================================== */
@media (max-width: 768px) {

    /* --- 히어로 --- */
    .swiper {
        height: clamp(220px, 60vw, 420px);
    }

    /* 기존에는 모바일에서 슬라이드 문구를 숨겼으나 작게 표시 */
    .slide-text {
        display: block !important;
        left: 5%;
        right: 5%;
        top: 50%;
    }

    .sub-text {
        font-size: 12px !important;
        color: #fff !important;
        letter-spacing: 0.1em;
        margin-bottom: 6px;
    }

    .main-text {
        font-size: 20px !important;
        letter-spacing: 0;
        line-height: 1.35;
    }

    .main-sub {
        font-size: 14px !important;
        letter-spacing: 0;
        line-height: 1.5;
        margin-top: 6px;
    }

    /* --- 검사결과/검사항목 카드 --- */
    .overlay-ui .overlay-card {
        padding: 20px 16px !important;
    }

    .overlay-ui .overlay-title {
        font-size: 18px !important;
        height: auto !important;
        margin: 0 0 14px 0 !important;
    }

    .overlay-ui #login-box .form-block,
    .overlay-ui .overlay-card.white .form-block {
        margin-top: 0 !important;
    }

    /* 확인/검색 버튼: 입력창 두 줄 높이에 맞춰 세로 정렬 */
    .overlay-ui #btn-login,
    .overlay-ui #btn-item-search {
        flex-direction: column !important;
        align-self: stretch !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        width: 76px !important;
        min-width: 76px !important;
    }

    .overlay-ui .input-field {
        font-size: 15px;
        height: 44px;
    }

    .overlay-ui .form-extra {
        margin: 12px 0 0 0;
    }

    /* '아이디 저장' 줄과 세로 가운데를 맞춤 (-28px 이면 5px 정도 위로 떠서 '확인' 박스에 붙었음) */
    #login-box .btn-oldsite {
        margin-top: -22px;
    }

    .btn-go-oldsite.back {
        height: 28px;
        padding: 0 12px;
        font-size: 13px !important;
    }

    /* 로그인 후 '검사결과확인 / 샘플수거요청' 버튼 */
    .after-actions .action-btn {
        font-size: 16px;
        font-weight: 600;
        height: 46px;
        white-space: nowrap;
    }

    /* 로그인 후 '담당자 / 관리자' 안내 문구 */
    .after-info,
    .after-info p {
        font-size: 15px;
        line-height: 1.5;
    }

    .after-footer {
        flex-wrap: wrap;
        font-size: 14px;
    }

    /* --- 책자 / 공지: 세로 배치 --- */
    .info-section {
        padding: 28px 16px !important;
    }

    .info-container {
        flex-direction: column;
        gap: 20px;
    }

        .info-container .left-area,
        .info-container .right-area {
            width: 100% !important;
            margin-top: 0 !important;
        }

    .info-section .left-area {
        flex: none;
        align-items: stretch;
        background: #fff;
        border-radius: 16px;
        padding: 16px;
    }

    .info-section .left-title {
        font-size: 17px;
        margin: 0 0 12px 0;
        text-align: center;
    }

    .info-section .book-info {
        flex-direction: row !important;
        justify-content: center;
        gap: 20px !important;
    }

        .info-section .book-info .image-wrapper {
            width: 100px;
            height: auto !important;
        }

            .info-section .book-info .image-wrapper img {
                width: 100px !important;
                height: auto;
            }

    .info-section .right-area {
        flex: none;
        padding: 12px 16px;
    }

    .tab-menu {
        height: 48px;
    }

    .tab-btn {
        font-size: 17px;
        padding: 8px 4px;
    }

    .notice-box {
        height: auto !important;
    }

    .notice-link {
        padding: 12px 2px;
    }

    .notice-subject,
    .notice-date {
        font-size: 13px;
    }

    /* --- 검사 안내 / 검사부 --- */
    .labguide-section,
    .labpart-section {
        padding-top: 36px;
    }

    .labguide-container,
    .labpart-container {
        padding: 0 16px;
    }

    .labguide-section-title,
    .labpart-section-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    /* 화면 밖으로 나가는 화살표 숨김 (스와이프로 이동) */
    .labguide-slider .owl-nav,
    .labpart-slider .owl-nav {
        display: none;
    }

    .labguide-img,
    .labpart-img {
        height: 220px;
    }

    .labguide-content,
    .labpart-content {
        padding: 16px;
    }

        .labguide-content h3,
        .labpart-content h3 {
            font-size: 17px;
        }

    /* --- 팝업 --- */
    .popup {
        max-height: 90vh;
        overflow-y: auto;
    }

    .popup-content {
        padding: 16px;
    }
}

/* ==========================================================
   PC + 태블릿 + 모바일 공통: '아이디 저장' 과 '이전 홈페이지' 를 한 줄로,
   입력창 아래 여백 = 카드 아래 여백 이 되도록 조금 내려서 가운데 배치
   (두 항목의 줄 높이를 버튼 높이와 같게 맞춰 세로 가운데가 정확히 맞음)
========================================================== */
@media screen {
    .overlay-ui #login-box {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 로그인 후에는 로그인 박스 숨김 (위 display:flex !important 보다 우선) */
    .overlay-ui #login-box.hidden {
        display: none !important;
    }

        .overlay-ui #login-box .login-box-title-row {
            display: contents !important;
        }

        .overlay-ui #login-box .overlay-title { order: 1; }
        .overlay-ui #login-box .form-block { order: 2; }

        .overlay-ui #login-box .form-extra {
            order: 3;
            display: flex !important;
            align-items: center;
            justify-content: flex-start;
            height: 30px;
            margin: 20px 0 0 0 !important;
        }

        .overlay-ui #login-box .btn-oldsite {
            order: 4;
            align-self: flex-end;
            display: flex;
            align-items: center;
            height: 30px;
            margin: -30px 0 0 0 !important;
        }
}

@media (max-width: 768px) {
    .overlay-ui #login-box .form-extra {
        height: 28px;
    }

    .overlay-ui #login-box .btn-oldsite {
        height: 28px;
        margin-top: -28px !important;
    }
}

/* PC: 확인 버튼이 96px 칸의 70% 로 가운데 놓여 있으므로 오른쪽 끝을 확인 버튼에 맞춤 (96 x 15%) */
@media (min-width: 1200px) {
    .overlay-ui #login-box .btn-oldsite {
        margin-right: 14.4px !important;
    }
}

/* 태블릿 + 모바일: '이전 홈페이지' 버튼 조금 더 높고 글자 크게
   (같은 줄의 '아이디 저장' 줄 높이도 함께 맞춰 세로 가운데 유지) */
@media (max-width: 1199px) {
    .overlay-ui #login-box .btn-go-oldsite.back {
        height: 36px;
        padding: 0 14px;
        font-size: 15px !important;
    }

    .overlay-ui #login-box .form-extra {
        height: 36px;
    }

    .overlay-ui #login-box .btn-oldsite {
        height: 36px;
        margin-top: -36px !important;
    }
}

/* PC + 태블릿: '검사결과 조회' 제목 위 여백(20px)을 없애서
   카드 위·아래 여백이 같아지도록(세로 가운데) 하고,
   '검사항목 조회' 와 제목·입력창의 세로 위치를 똑같이 맞춤 */
@media (min-width: 769px) {
    .overlay-ui #login-box .overlay-title {
        margin-top: 0 !important;
        margin-bottom: 20px !important;
    }
}
