/* =================================================================
   기본 설정 (폰트, 색상 변수 등)
================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #007bff; /* 메인 블루 */
    --secondary-color: #6c757d; /* 보조 그레이 */
    --accent-color: #28a745; /* 강조 그린 (예: 영업 정상) */
    --text-color: #343a40; /* 기본 텍스트 색상 */
    --light-text-color: #6c757d; /* 연한 텍스트 색상 */
    --bg-light: #f8f9fa; /* 밝은 배경 */
    --border-color: #e9ecef; /* 테두리 색상 */
    --shadow-light: 0 4px 8px rgba(0, 0, 0, 0.05); /* 옅은 그림자 */
}

/* =================================================================
   기본 및 공통 스타일 (Base & Common Styles)
================================================================= */
body {
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-color);
    scroll-behavior: smooth;
}
a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
    color: #0056b3;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =================================================================
   헤더 & 네비게이션
================================================================= */
header {
    background-color: white;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
}
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo a {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px;
}
nav a {
    font-weight: 500;
    color: var(--text-color);
    padding: 5px 0;
    position: relative;
    transition: color 0.3s ease;
}
nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}
nav a:hover {
    color: var(--primary-color);
}
nav a:hover::after,
nav a.active::after {
    width: 100%;
}
main {
    padding: 40px 0;
}

/* =================================================================
   페이지별 스타일
================================================================= */

/* --- Index 페이지 --- */
.hero-section {
    position: relative;
    height: 50vh;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    background-image: url('https://images.unsplash.com/photo-1541364983171-a8ba01e95cfc?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
}
.hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.hero-search-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 30px;
    padding: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.hero-search-form input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 10px 20px;
    font-size: 1rem;
    outline: none;
    color: #333;
}
.hero-search-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}
.hero-search-form button:hover {
    background-color: #0056b3;
}
.stats-bar {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 15px 0;
    font-size: 1.1rem;
    font-weight: 500;
}
.page-section {
    padding-top: 50px;
    padding-bottom: 30px;
}
.quick-regions, .recent-hospitals {
    margin-bottom: 50px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}
.quick-regions h2, .recent-hospitals h2 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-color);
}
.region-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}
.region-links a {
    background-color: var(--bg-light);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s;
}
.region-links a:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.recent-list {
    list-style: none;
    padding: 0;
}
.recent-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}
.recent-list li:last-child a {
    border-bottom: none;
}
.recent-list li a:hover {
    background-color: var(--bg-light);
}
.recent-info {
    display: flex;
    flex-direction: column;
}
.recent-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
}
.recent-address {
    font-size: 0.9rem;
    color: var(--light-text-color);
}
.recent-date {
    font-size: 0.9rem;
    color: var(--light-text-color);
    white-space: nowrap;
    margin-left: 20px;
}

/* --- Search 페이지 (고도화) --- */
.search-page-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
.search-filters {
    flex: 0 0 280px; /* 너비 280px 고정 */
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    position: sticky; /* 스크롤 따라다니는 필터 */
    top: 100px;
}
.search-filters h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.filter-group {
    margin-bottom: 20px;
}
.filter-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}
.filter-group input, .filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}
.filter-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    margin-top: 10px;
}
.search-results-section {
    flex-grow: 1; /* 남은 공간 모두 차지 */
}
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.results-header h3 {
    margin: 0;
}
.view-toggle button {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}
.view-toggle button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.view-toggle button:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.view-toggle button:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-left: none;
}
.result-view {
    display: none; /* 기본적으로 뷰는 숨김 */
}
.result-view.active {
    display: block; /* active 클래스가 있는 뷰만 보임 */
}
#results-map {
    height: 600px;
    width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    justify-content: center;
}
.form-checkbox label {
    font-weight: 500;
    cursor: pointer;
}
.hospital-item mark {
    background-color: #fff3cd; /* 연한 노란색 */
    color: #856404; /* 진한 노란색 계열 텍스트 */
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

/* --- Hospital 페이지 (지역별 검색) --- */
.search-form-container {
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    margin-bottom: 40px;
    text-align: center;
}
.search-form-container h2 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 15px;
    font-weight: 700;
}
.search-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap; /* 반응형을 위해 추가 */
}
.search-form select,
.search-form input[type="text"] {
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    flex-grow: 1;
    max-width: 250px;
}
.search-form button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.search-form button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* --- 병원 목록 (공통) --- */
.hospital-list-container {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}
.hospital-list-container h3 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.hospital-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.hospital-item-link {
    display: block;
    margin-bottom: 15px;
    text-decoration: none;
}
.hospital-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-light);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.hospital-item:hover {
    background-color: #e9f5ff;
    border-color: var(--primary-color);
    transform: translateY(-3px);
}
.item-info {
    flex-grow: 1;
    margin-right: 20px;
}
.hospital-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}
.hospital-address,
.hospital-phone {
    font-size: 0.95rem;
    color: var(--light-text-color);
    margin-bottom: 3px;
}
.item-status {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}
.status-open {
    background-color: #e6ffed;
    color: var(--accent-color);
    border: 1px solid #c3e6cb;
}
.status-closed {
    background-color: #fcebeb;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}
.status-etc {
    background-color: #fff3cd;
    color: #ffc107;
    border: 1px solid #ffeeba;
}
.no-results {
    text-align: center;
    padding: 30px;
    font-size: 1.1rem;
    color: var(--light-text-color);
    background-color: var(--bg-light);
    border-radius: 10px;
    margin-top: 20px;
}

/* --- 페이지네이션 --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.pagination a {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    min-width: 40px;
    text-align: center;
}
.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: default;
}

/* --- Regions 페이지 --- */
.regions-container {
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    text-align: center;
}
.regions-container h2 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 15px;
    font-weight: 700;
}
.regions-container p {
    color: var(--light-text-color);
    margin-bottom: 30px;
    font-size: 1.1rem;
}
.region-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 30px;
}
.region-card {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s ease;
    min-height: 80px;
}
.region-card:hover {
    background-color: #e9f5ff;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    color: var(--primary-color);
}
.sigungu-container h3 {
    color: var(--text-color);
    font-size: 1.8rem;
    margin-bottom: 25px;
}
.sigungu-container .btn {
    margin-top: 30px;
    display: inline-block;
}

/* --- Detail 페이지 --- */
.detail-container {
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}
.detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}
.detail-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
    line-height: 1.3;
}
.detail-status {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-block;
    margin-left: 5px;
}
.status-text-open {
    background-color: #e6ffed;
    color: var(--accent-color);
}
.status-text-closed {
    background-color: #fcebeb;
    color: #dc3545;
}
.status-text-etc {
    background-color: #fff3cd;
    color: #ffc107;
}
#map {
    height: 400px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.map-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}
.action-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.action-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    text-decoration: none;
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.info-item {
    background-color: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.info-item .label {
    font-size: 0.9rem;
    color: var(--light-text-color);
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.info-item span:not(.label) {
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 400;
}
.value-with-action {
    display: flex;
    align-items: center;
    gap: 10px;
}
.copy-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}
.copy-btn:hover {
    background-color: #5a6268;
}

/* --- Detail 페이지 인근 병원 목록 --- */
.nearby-list-container {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}
.nearby-list-container h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 600;
}
.nearby-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.nearby-list li a {
    display: flex;
    flex-direction: column;
    padding: 15px;
    border-radius: 8px;
    transition: background-color 0.2s, border-color 0.2s;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text-color);
}
.nearby-list li a:hover {
    background-color: #e9f5ff;
    border-color: var(--primary-color);
}
.nearby-hospital-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}
.nearby-hospital-info {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--light-text-color);
    flex-wrap: wrap;
    gap: 10px;
}
.nearby-hospital-info .distance {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}
.nearby-hospital-info .address {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 정보 페이지 (FAQ, Guide 등) --- */
.info-page-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}
.info-page-title {
    text-align: center;
    padding-bottom: 30px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}
.info-page-title h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: var(--text-color);
}
.info-page-title p {
    font-size: 1.1rem;
    color: var(--light-text-color);
}
.info-page-content h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.5rem;
}
.info-page-content p {
    line-height: 1.8;
    color: #555;
}

/* --- FAQ 페이지 아코디언 --- */
.faq-list {
    border-top: 2px solid var(--primary-color);
}
.faq-item {
    border-bottom: 1px solid var(--border-color);
}
.faq-item summary {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 20px 10px;
    cursor: pointer;
    list-style: none;
    position: relative;
    color: var(--text-color);
}
.faq-item summary::-webkit-details-marker {
    display: none;
}
.faq-item summary::after {
    content: '＋';
    position: absolute;
    right: 10px;
    font-size: 1.5rem;
    transition: transform 0.2s;
    color: var(--primary-color);
}
.faq-item[open] summary::after {
    transform: rotate(45deg);
}
.faq-content {
    padding: 0 10px 20px 10px;
    background-color: var(--bg-light);
    border-radius: 0 0 8px 8px;
}
.faq-content p {
    line-height: 1.8;
    color: #555;
}


/* --- 푸터 (v2) --- */
.site-footer-v2 {
    background-color: #ffffff;
    color: var(--light-text-color);
    padding: 50px 0;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.site-footer-v2 .footer-logo a {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}
.site-footer-v2 .footer-description {
    max-width: 450px;
    margin: 15px auto 25px auto;
    font-size: 1rem;
    line-height: 1.7;
}
.footer-links-inline {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 30px;
}
.footer-links-inline a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--light-text-color);
    text-decoration: none;
    padding: 0 20px;
    position: relative;
}
.footer-links-inline a:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background-color: var(--border-color);
}
.footer-links-inline a:hover {
    color: var(--primary-color);
}
.site-footer-v2 .footer-copyright {
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.8;
}

/* =================================================================
   미디어 쿼리 (반응형)
================================================================= */
@media (max-width: 992px) {
    .search-page-container {
        flex-direction: column;
    }
    .search-filters {
        position: static;
        width: 100%;
        flex: auto;
    }
}
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    nav ul {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .search-form-container, .hospital-list-container, .regions-container, .detail-container, .info-page-container {
        padding: 25px;
        margin-bottom: 25px;
    }
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .search-form select,
    .search-form input[type="text"],
    .search-form button {
        max-width: none;
    }
    .hospital-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .item-info {
        margin-right: 0;
        margin-bottom: 10px;
    }
    .region-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .detail-title {
        font-size: 2rem;
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
    .map-actions {
        flex-direction: column;
        gap: 10px;
    }
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    .hero-content h1 {
        font-size: 2.2rem;
    }
}
@media (max-width: 480px) {
    .logo a {
        font-size: 1.5rem;
    }
    nav a {
        font-size: 0.9rem;
    }
    .hospital-list-container h3, .regions-container h2 {
        font-size: 1.5rem;
    }
    .hospital-name {
        font-size: 1.1rem;
    }
    .pagination a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    .region-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    .detail-title {
        font-size: 1.8rem;
    }
}