/* Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { min-width: 320px; }
body { font-family: 'Noto Sans KR', sans-serif; background-color: #fff; color: #333; line-height: 1.5; overflow-x: hidden; }
button, input { font: inherit; }
fieldset { min-width: 0; border: 0; }
a { color: inherit; }

h1, h2, h3, h4, h5, h6, p, span, li {
    word-break: keep-all;
    overflow-wrap: break-word;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 3000;
    padding: 10px 16px;
    color: #111;
    background: #fff;
    border-radius: 4px;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header */
.main-header {
    width: 100%; height: 315px;
    background: linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1)), url('../images/search-list-banner.png') no-repeat center center/cover;
    position: relative; display: flex; justify-content: center; align-items: center; flex-direction: column;
}
.home-icon {
    position: absolute;
    top: 20px; left: 20px; color: rgba(255,255,255,0.7); font-size: 24px;
    width: 44px; height: 44px; border-radius: 5px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.header-title {
    display: flex;
    justify-content: center;
}
.header-content h1 {
    color: white; font-size: 48px; font-weight: 700; margin-bottom: 20px; text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.header-search-box { position: relative; width: min(600px, calc(100vw - 48px)); height: 60px; }
.header-search-box input[type="text"] {
    width: 100%; height: 100%; border-radius: 30px; border: solid #fff; padding: 0 120px 0 30px;
    font-size: 18px; background-color: transparent; color: white; outline: none;
    position: relative;
    z-index: 0;
}

.header-search-box input[type="text"]::placeholder {
    color: #fff;
    opacity: 0.8;
}

.header-search-box input[type="text"]:-webkit-autofill,
.header-search-box input[type="text"]:-webkit-autofill:hover,
.header-search-box input[type="text"]:-webkit-autofill:focus {
    -webkit-text-fill-color: white;
    -webkit-box-shadow: 0 0 0px 1000px transparent inset;
    box-shadow: 0 0 0px 1000px transparent inset;
    transition: background-color 5000s ease-in-out 0s;
}
.header-search-box button {
    position: absolute; right: 5px; top: 5px; display: inline-flex; height: 50px; width: 100px;
    align-items: center; justify-content: center; line-height: 1;
    border-radius: 25px; border: none; background-color: white; color: #333; font-size: 18px; font-weight: bold; cursor: pointer;
    z-index: 1;
}

/* Layout */
.container {
    min-height: calc(100vh - 500px);
    max-width: 1400px;
    margin: 50px auto;
    display: flex;
    gap: 40px;
    padding: 0 20px;
    align-items: flex-start;
}
.sidebar { width: 290px; flex-shrink: 0; border: 1px solid #DFE3E8; border-radius: 20px; overflow: hidden; height: fit-content;}
.sidebar-head { background-color: #3E3B9B; color: white; padding: 15px; font-size: 20px; font-weight: 500; text-align: center; }
.sidebar-body { padding: 25px; background-color: #fff; }
.form-group { margin-bottom: 20px; }
.form-group > label,
.form-group > legend {
    display: block;
    font-weight: 500;
    font-size: 15px; }
.input-form {
    display: flex;
    gap: 5px;
    align-items: center;
}
.line-input { width: 70%; border: none; border-bottom: 1px solid #ccc; padding: 5px 0; outline: none; font-size: 14px; }


.line-input:-webkit-autofill,
.line-input:-webkit-autofill:hover,
.line-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #333;
    -webkit-box-shadow: 0 0 0px 1000px #fff inset;
    box-shadow: 0 0 0px 1000px #fff inset;
    transition: background-color 5000s ease-in-out 0s;
}

.checkbox-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}
.checkbox-group-inline > legend {
    margin-bottom: 8px;
    margin-right: 10px;
}

.checkbox-group-block {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group-block > legend {
    margin-bottom: 8px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 0;
    aspect-ratio: 1;
    accent-color: #3E3B9B;
}

.checkbox-group-inline .checkbox-wrapper {
    align-items: flex-start;
}

.checkbox-group-inline .checkbox-wrapper input[type="checkbox"] {
    margin-top: 1px;
}

.checkbox-group-inline .checkbox-wrapper label {
    display: flex;
    align-items: flex-start;
    line-height: 1.2;
    cursor: pointer;
}

.checkbox-list .checkbox-wrapper {
    min-height: 44px;
    margin-bottom: 8px;
    align-items: flex-start;
    gap: 8px;
}

.checkbox-list .checkbox-wrapper input[type="checkbox"] {
    margin-top: 1px;
}

.checkbox-list .checkbox-wrapper label {
    display: flex;
    min-height: 44px;
    flex: 1;
    align-items: flex-start;
    line-height: 1.4;
    cursor: pointer;
}

.checkbox-list label { font-weight: 400; font-size: 14px; margin-bottom: 0; }
.sidebar-search-btn {
    display: inline-flex;
    width: 80px;
    min-height: 44px;
    padding: 0 12px;
    align-items: center;
    justify-content: center;
    background-color: #3E3B9B;
    color: #fff;
    border: 1px solid #3E3B9B;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.sidebar-search-btn:hover {
    background-color: #302D82;
    border-color: #302D82;
}
.sidebar-search-btnDiv {
    display: flex;
    justify-content: center;
    padding-top: 10px;
}
.results-section { width: 100%; min-width: 0; flex-grow: 1; display: flex; flex-direction: column; }
.results-header { border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 10px; margin-top: 20px; }
.results-header .highlight, .results-header .count { color: #c00; font-weight: bold; }

/* Results table */
.table-scroll-wrapper {
    width: 100%;
    max-height: 600px;
    overflow: auto;
    border-bottom: 1px solid #ccc;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}
.table-scroll-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll-wrapper::-webkit-scrollbar-thumb { background-color: #888; border-radius: 4px; }
.table-scroll-wrapper::-webkit-scrollbar-track { background-color: #f1f1f1; }

.results-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: separate;
    border-spacing: 0;
    text-align: center;
}

/* Sticky header */
.results-table th {
    position: sticky;
    top: 0;

    background-color: #F2F2FA;

    z-index: 100;

    border-top: 2px solid #ccc;
    border-bottom: 1px solid #ccc;
    border-right: 1px solid #ddd;
    padding: 10px 6px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.results-table td {
    padding: 6px;
    border-bottom: 1px solid #d8d8d8;
    border-right: 1px solid #d8d8d8;
    color: #555;
    font-size: 14px;
    line-height: 1.35;
    vertical-align: middle;
}


.results-table th:last-child,
.results-table td:last-child {
    border-right: none;
}


.results-table tbody tr:hover {
    background-color: #eee;
    cursor: pointer;
}

.result-detail-btn {
    display: inline-flex;
    max-width: 100%;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #333;
    background: transparent;
    line-height: inherit;
    text-align: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.table-scroll-hint {
    margin-top: 8px;
    color: #666;
    font-size: 13px;
    text-align: right;
}

.table-scroll-hint[hidden] {
    display: none;
}

/* Tooltip */
.tooltip-container {
    display: inline-block;
    position: relative;
    cursor: pointer;
}

.help-icon { color: #88c; margin-left: 5px; vertical-align: middle; }

.tooltip-box {
    display: none;
    position: absolute;

    top: 120%;

    left: 50%;
    transform: translateX(-50%);

    background-color: white;
    color: #3C3939;
    border: 1px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;


    z-index: 101;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}


.tooltip-box::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent white transparent;
}

.tooltip-container:hover .tooltip-box { display: block; }


.purpose-cell { text-align: left; padding: 6px !important; }
.purpose-cell div { margin-bottom: 2px; display: flex; align-items: center; gap: 4px; }
.purpose-cell div:last-child { margin-bottom: 0; }
.purpose-cell i { font-size: 16px; color: #555; }
.download-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #333; }
.pdf-icon { color: #d32f2f; font-size: 18px; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 15px; padding: 30px 0; }
.pagination a {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}
.page-num { display: inline-flex; justify-content: center; align-items: center; width: 30px; height: 30px; }
.page-num.active { background-color: #ddd; border-radius: 50%; color: #333; font-weight: bold; }
.page-control { gap: 0; color: #777; font-size: 12px; }
.pagination .disabled { opacity: 0.55; pointer-events: none; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-overlay.open {
    display: flex;
}

.sheet-handle {
    display: none;
}

.modal-window {
    background-color: #fff;
    width: 800px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-radius: 2px;
    position: relative;
}


.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.modal-subtitle {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}


.info-box {
    border: 1px solid #ddd;
    padding: 25px 30px;
    background-color: #fff;
}


.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.value {
    font-size: 15px;
    color: #555;
    font-weight: 400;
    word-break: keep-all;
    overflow-wrap: break-word;
    line-height: 1.5;
}




.purpose-list p {
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Utilities */
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }


.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.close-btn,
.btn-close {
    display: inline-flex;
    min-width: 80px;
    min-height: 44px;
    padding: 0 20px;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #D8D8D8;
    border-radius: 6px;
    color: #1d1d1d;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.close-btn:hover,
.btn-close:hover {
    background-color: #f5f5f5;
    border-color: #b8b8b8;
}


.results-table tbody tr {
    cursor: pointer;
}

/* Photo modal */
.modal-content {
    background-color: #fff;
    width: 500px;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    overflow: hidden;
}


.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: bold; }


.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
}
.image-item { margin-bottom: 15px; }
.image-item img { width: 100%; border-radius: 4px; display: block; }


.modal-footer {
    padding: 15px 20px;
    text-align: right;
    background-color: transparent;
}

.modal-window > .modal-footer {
    padding-right: 0;
    padding-left: 0;
}

.service-locked {
    pointer-events: none !important;
    opacity: 0.5 !important;
    filter: grayscale(100%);
    user-select: none;
    cursor: not-allowed;
}

.sidebar-search-btn.service-locked {
    color: #fff !important;
    background-color: #6D6AAF;
    border-color: #6D6AAF;
    opacity: 1 !important;
    filter: none;
}

body.modal-open {
    overflow: hidden;
}

body.pointer-focus-restored :focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.home-icon:focus-visible,
.header-search-box input:focus-visible,
.header-search-box button:focus-visible,
.line-input:focus-visible,
.checkbox-wrapper input:focus-visible,
.sidebar-search-btn:focus-visible,
.table-scroll-wrapper:focus-visible,
.result-detail-btn:focus-visible,
.pagination a:focus-visible,
.close-btn:focus-visible,
.btn-close:focus-visible {
    outline: 3px solid #ffd43b;
    outline-offset: 3px;
}

.modal-title:focus-visible,
.modal-header h3:focus-visible {
    outline: 3px solid #ffd43b;
    outline-offset: 4px;
}

.modal-overlay.initial-focus-hidden .modal-title:focus-visible,
.modal-overlay.initial-focus-hidden .modal-header h3:focus-visible {
    outline: none;
}

@media (max-width: 1360px) {
    .container {
        max-width: none;
        margin: 40px auto;
        flex-direction: column;
        gap: 32px;
        padding: 0 32px;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-body form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 32px;
    }

    .form-group {
        margin-bottom: 0;
    }

    .checkbox-group-block {
        margin-top: 0;
    }

    .line-input {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .checkbox-group-block,
    .sidebar-search-btnDiv {
        grid-column: 1 / -1;
    }

    .checkbox-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 24px;
    }

    .checkbox-list .checkbox-wrapper {
        margin-bottom: 0;
    }

    .checkbox-wrapper {
        min-height: 44px;
        gap: 8px;
    }

    .checkbox-wrapper label {
        display: flex;
        min-height: 44px;
        flex: 1;
        align-items: center;
        line-height: 1.4;
        cursor: pointer;
    }

    .results-header {
        margin-top: 0;
    }
}

@media (max-width: 980px) {
    .modal-overlay {
        align-items: flex-start;
        padding: clamp(16px, 4vh, 32px) 16px;
    }

    .modal-window,
    .modal-content {
        width: 100%;
        max-height: calc(100dvh - clamp(32px, 8vh, 64px));
    }

    .main-header {
        height: 280px;
        padding: 0 24px;
    }

    .header-content {
        width: 100%;
    }

    .header-content h1 {
        font-size: 42px;
    }

    .header-search-box {
        width: min(600px, 100%);
        margin: 0 auto;
    }

    .container {
        margin: 32px auto;
        padding: 0 24px;
    }

    .sidebar-body form,
    .checkbox-list {
        grid-template-columns: 1fr;
    }

    .checkbox-group-block,
    .sidebar-search-btnDiv {
        grid-column: auto;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .results-table td,
    .purpose-cell {
        padding: 4px 6px !important;
    }

    .modal-window {
        padding: 28px;
    }
}

@media (max-width: 540px) {
    .main-header {
        height: 240px;
        padding: 0 20px;
    }

    .home-icon {
        top: 12px;
        left: 12px;
    }

    .header-content h1 {
        margin-bottom: 16px;
        font-size: 36px;
    }

    .header-search-box {
        height: 56px;
    }

    .header-search-box input[type="search"] {
        padding: 0 94px 0 20px;
        font-size: 16px;
    }

    .header-search-box button {
        width: 82px;
        height: 46px;
        font-size: 16px;
    }

    .container {
        margin: 24px auto;
        gap: 24px;
        padding: 0 20px;
    }

    .sidebar {
        border-radius: 14px;
    }

    .sidebar-head {
        font-size: 18px;
    }

    .sidebar-body {
        padding: 20px;
    }

    .input-form {
        align-items: flex-start;
        flex-direction: column;
    }

    .line-input {
        width: 100%;
    }

    .checkbox-group-inline {
        flex-wrap: wrap;
    }

    .checkbox-group-inline > legend {
        width: 100%;
        margin: 0 0 8px;
    }

    .table-scroll-wrapper {
        max-height: 520px;
    }

    .results-table {
        min-width: 900px;
    }

    .pagination {
        gap: 10px;
        padding: 24px 0;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
        overflow: hidden;
    }

    .modal-window,
    .modal-content {
        width: 100%;
        max-width: none;
        height: 84dvh;
        max-height: 84dvh;
        border-radius: 28px 28px 0 0;
        transform: translateY(var(--sheet-drag-y, 0));
        transition: transform 0.22s ease-out;
        will-change: transform;
    }

    .modal-window {
        display: flex;
        padding: 10px;
        flex-direction: column;
        overflow: auto;
    }

    .modal-window.is-dragging,
    .modal-content.is-dragging {
        transition: none;
    }

    .modal-window.is-dismissing,
    .modal-content.is-dismissing {
        transform: translateY(105%);
    }

    .sheet-handle {
        position: relative;
        display: block;
        width: 100%;
        min-height: 36px;
        flex: 0 0 36px;
        padding: 0;
        border: 0;
        border-radius: 28px 28px 0 0;
        background-color: #fff;
        cursor: grab;
        touch-action: none;
    }

    .sheet-handle:active {
        cursor: grabbing;
    }

    .sheet-handle::before {
        position: absolute;
        top: 8px;
        left: 50%;
        width: 24px;
        height: 3px;
        border-radius: 999px;
        background-color: #b8b8b8;
        content: "";
        transform: translateX(-50%);
    }

    .sheet-handle:focus-visible {
        outline: 3px solid #ffd43b;
        outline-offset: -6px;
    }

    .modal-scroll-content {
        min-height: 0;
        padding: 12px 20px 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .modal-window > .modal-footer {
        min-height: 74px;
        margin-top: 0;
        padding: 15px 20px calc(15px + env(safe-area-inset-bottom));
        flex: 0 0 auto;
        border-top: 1px solid #eee;
        background-color: #fff;
    }

    .info-box {
        padding: 18px;
    }

    .mt-40 {
        margin-top: 28px;
    }

    .modal-content > .sheet-handle {
        flex: 0 0 36px;
    }
}

@media (max-width: 360px) {
    .close-btn,
    .btn-close {
        position: relative;
        width: 44px;
        min-width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        font-size: 0;
    }

    .close-btn::before,
    .close-btn::after,
    .btn-close::before,
    .btn-close::after {
        position: absolute;
        width: 20px;
        height: 2px;
        background-color: currentColor;
        content: "";
    }

    .close-btn::before,
    .btn-close::before {
        transform: rotate(45deg);
    }

    .close-btn::after,
    .btn-close::after {
        transform: rotate(-45deg);
    }
}
