/* © 2026 DSR, DSR Wire. All rights reserved. Made by FIBER QM TEAM. */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    color: #1e293b;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.icon {
    width: 1em;
    height: 1em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

header {
    background: linear-gradient(135deg, #0b1220 0%, #172554 60%, #1e3a8a 100%);
    padding: 40px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
    background-color: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #3b82f6;
    flex-shrink: 0;
}

header h1 {
    display: flex;
    flex-direction: column;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.hero-title-line1 {
    color: #f8fafc;
}

.hero-title-line2 {
    color: #60a5fa;
}

header p {
    font-size: 14px;
    color: #94a3b8;
}

.main-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 10px;
    border-bottom: 2px solid #eef0f6;
}

.tab-btn {
    flex: 0 0 auto;
    background: none;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px 8px 0 0;
    margin-bottom: -2px;
    /* 겹치게 하여 선택된 탭의 보더가 아래 보더를 덮게 함 */
}

.tab-btn:hover {
    color: #1e293b;
    background-color: #f8fafc;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background-color: transparent;
}

.tab-icon {
    font-size: 20px;
}

.info-section {
    background-color: #fff;
    border: 1px solid #eef0f6;
    padding: 24px;
    margin-bottom: 20px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.section-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2563eb;
    margin-bottom: 12px;
}

.eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #2563eb;
    flex-shrink: 0;
}

.info-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    cursor: pointer;
    user-select: none;
}

.info-title.collapsed {
    margin-bottom: 0;
}

.info-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-title .icon {
    font-size: 20px;
    color: #2563eb;
}

.chevron-icon {
    transition: transform 0.2s ease;
    color: #94a3b8 !important;
}

.info-title.collapsed .chevron-icon {
    transform: rotate(-180deg);
}

.info-grid.collapsed {
    display: none;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 40px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.info-item .icon {
    font-size: 20px;
    color: #2563eb;
    margin-top: 2px;
}

.info-item-title {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 4px;
}

.info-item-desc {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.search-section {
    background-color: white;
    border: 1px solid #eef0f6;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    margin-bottom: 30px;
}

.search-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1e293b;
}

.search-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-section-title .icon {
    font-size: 20px;
    color: #2563eb;
}

.search-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

.search-controls.collapsed {
    display: none;
}

.form-group {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
}

.form-group.date-field {
    flex: 0 1 170px;
    min-width: 150px;
}

.form-group.form-actions {
    flex: 0 0 auto;
    min-width: 0;
}

.label-spacer,
.hint-spacer {
    visibility: hidden;
}

.button-row {
    display: flex;
    gap: 10px;
}

.form-group label {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #64748b;
}

.input-icon-wrap {
    position: relative;
}

.law-dropdown {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    scrollbar-width: auto;
    scrollbar-color: #64748b #e2e8f0;
}

.law-dropdown[hidden] {
    display: none;
}

.law-dropdown::-webkit-scrollbar {
    width: 16px;
}

.law-dropdown::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 0 10px 10px 0;
}

.law-dropdown::-webkit-scrollbar-thumb {
    min-height: 48px;
    background: #64748b;
    border: 3px solid #e2e8f0;
    border-radius: 999px;
}

.law-dropdown-option {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    color: #1e293b;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.law-dropdown-option:hover,
.law-dropdown-option:focus {
    outline: none;
    background: #eff6ff;
    color: #1d4ed8;
}

@media (min-width: 769px) {
    #searchToggleBtn {
        cursor: default;
    }

    #searchToggleBtn .chevron-icon {
        display: none;
    }
}

.input-icon-wrap .icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #94a3b8;
    cursor: pointer;
}

.input-icon-btn,
.input-clear-btn {
    position: absolute;
    z-index: 2;
    top: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.input-clear-btn.is-visible {
    display: inline-flex;
}

.input-icon-btn:hover,
.input-clear-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.input-icon-btn:focus-visible,
.input-clear-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.dropdown-toggle-btn {
    right: 38px;
    display: inline-flex;
}

.law-clear-btn {
    right: 5px;
}

#lawKeywordClear {
    right: 5px;
}

.input-clear-btn {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.input-icon-btn .icon {
    position: static;
    width: 18px;
    height: 18px;
    transform: none;
    pointer-events: none;
}

.law-select-wrap input {
    padding-right: 74px;
}

#lawKeyword {
    padding-right: 40px;
}

.date-picker-hidden {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    border: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dde1ea;
    border-radius: 10px;
    font-size: 14px;
    color: #1e293b;
    background-color: #fff;
}

.input-icon-wrap input {
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn .icon {
    font-size: 15px;
}

.btn-primary {
    background-color: #0f172a;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1e293b;
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-secondary {
    background-color: #eff6ff;
    color: #2563eb;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #dbeafe;
}

.btn-secondary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-secondary:disabled {
    background-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.8;
}

.law-manage-fab {
    position: fixed;
    right: 24px;
    top: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background-color: #0f172a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
    transition: background-color 0.2s, transform 0.2s;
    z-index: 100;
}

.law-manage-fab:hover {
    background-color: #1e293b;
    transform: scale(1.05);
}

.law-manage-fab .icon {
    width: 22px;
    height: 22px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-dialog {
    background-color: white;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #eef0f6;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

#lawManageCurrentTabName {
    color: #c0392b;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
}

.modal-close:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.modal-close .icon {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 25px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.law-manage-desc {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.law-manage-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.law-manage-controls .form-group {
    flex: 1;
    min-width: 220px;
}

.law-manage-add-row {
    display: flex;
    gap: 8px;
}

.law-manage-add-row input {
    flex: 1;
}

.law-manage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-content: start;
    gap: 6px 16px;
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 16px;
    background-color: #f8fafc;
    border: 1px solid #eef0f6;
    border-radius: 12px;
}

.law-manage-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 4px;
    font-size: 14px;
    color: #334155;
}

.law-manage-item input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

.law-manage-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    flex-shrink: 0;
}

.law-manage-save-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #eef0f6;
    flex-shrink: 0;
}

.law-manage-pin-group {
    flex: 0 0 auto;
}

.law-manage-pin-group label {
    white-space: nowrap;
}

.law-manage-pin-group input {
    width: 220px;
}

/* 실수로 저장 버튼과 헷갈려 누르지 않도록, 저장 버튼과 떨어진 남는 공간(오른쪽 끝)에 배치 */
.law-manage-reset-btn {
    margin-left: auto;
    font-size: 13px;
}

.law-manage-help-icon {
    position: relative;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    margin-bottom: 10px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background-color: #f1f5f9;
    color: #64748b;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.law-manage-help-icon:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.law-manage-help-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 20;
}

.law-manage-help-icon:hover::after,
.law-manage-help-icon.show-tooltip::after {
    opacity: 1;
    visibility: visible;
}

.law-manage-status {
    font-size: 13px;
    font-weight: 600;
}

.law-manage-status.status-success {
    color: #2563eb;
}

.law-manage-status.status-error {
    color: #c0392b;
}

.results-section {
    background-color: white;
    border: 1px solid #eef0f6;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow-x: auto;
}

.results-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background-color: #f8fafc;
    border: 1px solid #eef0f6;
    border-radius: 10px;
}

.results-info-text {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
    color: #334155;
}

.results-info-text .separator {
    color: #cbd5e1;
    margin: 0 4px;
}

.info-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.filter-pill {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #1e3a8a;
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 3px 12px;
    border-radius: 999px;
}

.results-limit-note {
    width: 100%;
    font-size: 12px;
    color: #92400e;
}

.btn-export {
    padding: 8px 16px;
    font-size: 13px;
    flex-shrink: 0;
}

.badge-count {
    display: inline-block;
    background-color: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.site-footer {
    margin-top: 32px;
    padding: 18px 0;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

.table-wrap {
    border: 1px solid #eef0f6;
    border-radius: 12px;
    overflow: hidden;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.results-table caption {
    caption-side: top;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    padding: 4px 4px 18px;
}

.results-table thead {
    background-color: transparent;
}

.results-table th {
    padding: 12px 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    scope: col;
}

.results-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #eef0f6;
    font-size: 13px;
    vertical-align: top;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.results-table tbody tr:hover {
    background-color: #f8fafc;
}

.amendment-law {
    font-weight: 500;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
    white-space: nowrap;
}

.amendment-date {
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    text-align: center;
}

.amendment-item {
    font-weight: 600;
    color: #334155;
}

.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 999px;
    margin-bottom: 6px;
}

.tag-before {
    background-color: #fee2e2;
    color: #dc2626;
}

.tag-after {
    background-color: #dcfce7;
    color: #16a34a;
}

.amendment-box {
    font-size: 13px;
    line-height: 1.5;
    padding: 10px;
    border-radius: 8px;
}

.box-before {
    background-color: #fef2f2;
    color: #7f1d1d;
    border: 1px solid #fee2e2;
}

.box-after {
    background-color: #f0fdf4;
    color: #14532d;
    border: 1px solid #dcfce7;
}

.amendment-reason {
    font-size: 12px;
    color: #64748b;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.source-link:hover {
    background-color: #e2e8f0;
}

.message {
    padding: 20px;
    text-align: center;
    font-size: 16px;
    color: #7f8c8d;
}

.error-message {
    padding: 15px;
    background-color: #ffe6e6;
    border-left: 4px solid #c0392b;
    border-radius: 4px;
    color: #c0392b;
    font-size: 14px;
    role: alert;
}

.validation-error {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 24px 15px;
        border-radius: 12px;
    }

    header h1 {
        font-size: 20px;
    }

    header p {
        font-size: 13px;
    }

    .info-section,
    .search-section,
    .results-section {
        padding: 16px;
        border-radius: 12px;
    }

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

    /* 법령 목록 관리는 PC 전용 기능이라 모바일에서는 진입 아이콘 자체를 숨김 */
    .law-manage-fab {
        display: none;
    }

    /* 모바일에서는 탭 5개가 세로로 줄바꿈되며 공간을 많이 차지하므로,
       한 줄로 유지하고 좌우 스와이프로 넘겨보도록 함 */
    .main-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .tab-btn {
        padding: 12px 14px;
        font-size: 14px;
        gap: 6px;
    }

    .tab-icon {
        font-size: 16px;
    }

    .search-controls {
        flex-direction: column;
        gap: 10px;
    }

    .form-group,
    .form-group.date-field {
        min-width: 100%;
        flex-basis: auto;
    }

    .form-group input,
    .form-group select {
        padding: 14px 12px;
        font-size: 15px;
    }

    .label-spacer,
    .hint-spacer,
    #start-hint,
    #end-hint {
        display: none;
    }

    .button-row {
        flex-direction: row;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .button-row .btn {
        width: auto;
        flex: 1;
    }

    .results-info {
        flex-direction: column;
        align-items: flex-start;
    }

    /* 모바일에서 엑셀 내보내기 버튼 숨김 */
    .btn-export {
        display: none !important;
    }

    /* 표 대신 항목 하나당 카드 한 장으로 세로 배치 (좌우 스크롤 없이 읽을 수 있도록) */
    .results-table thead {
        display: none;
    }

    .results-table,
    .results-table tbody {
        display: block;
        width: 100%;
    }

    .results-table caption {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .results-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 8px;
        border: 1px solid #eef0f6;
        border-radius: 12px;
        padding: 14px;
        margin-bottom: 12px;
        background-color: #fff;
    }

    .results-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .results-table td {
        display: block;
        border-bottom: none;
        padding: 0;
        white-space: normal;
        min-width: 0;
        font-size: 13px;
    }

    .amendment-date {
        text-align: left;
        font-size: 14px;
    }

    .amendment-law {
        white-space: normal;
    }

    .box-before,
    .box-after {
        font-size: 12px;
        padding: 8px;
    }

    .amendment-source .source-link {
        display: inline-flex;
    }
}