/* 전국 공공시설 개방정보 - 커스텀 스타일 */

:root {
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --bg-light: #f8f9fa;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
}

/* 스킵 네비게이션 (접근성) */
.visually-hidden-focusable:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.visually-hidden-focusable:focus {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    text-decoration: none;
}

/* 히어로 섹션 */
.hero-section {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 50%, #6610f2 100%);
    color: white;
    padding: 60px 0 50px;
}

.hero-section h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

.hero-section .lead {
    font-size: 1.1rem;
    opacity: 0.9;
}

.hero-search {
    max-width: 600px;
    margin: 0 auto;
}

.hero-search .form-control {
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 1.05rem;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.hero-search .btn {
    border-radius: 50px;
    padding: 10px 28px;
}

/* 통계 카드 */
.stat-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    display: block;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    color: inherit;
}

.stat-card .card-body {
    padding: 20px;
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.9rem;
    color: #666;
}

/* 시설 목록 카드 */
.facility-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
    background: white;
}

.facility-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.facility-card h5 {
    font-weight: 600;
    margin-bottom: 8px;
}

.facility-card h5 a {
    color: #333;
    text-decoration: none;
}

.facility-card h5 a:hover {
    color: var(--primary);
}

.facility-meta {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.7;
}

.facility-meta i {
    width: 18px;
    text-align: center;
    color: var(--primary);
}

/* 지역 링크 */
.region-link {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px;
    border-radius: 8px;
    background: var(--bg-light);
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}

.region-link:hover,
.region-link:focus {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.region-link .count {
    font-size: 0.75rem;
    opacity: 0.7;
}

.region-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    pointer-events: none;
}

/* 사이드바용 축소 region-link */
.region-link--sm {
    font-size: 0.82rem;
    padding: 5px 10px;
    margin: 2px;
}

/* 상세 페이지 헤더 */
.page-header--detail {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 28px 0 24px;
    border-bottom: 1px solid #dee2e6;
}

.page-header--detail h1 {
    font-size: 1.55rem;
    line-height: 1.4;
}

.page-header--detail .place-sub {
    font-size: 0.95rem;
}

/* 상세 섹션 카드 */
.detail-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
    transition: box-shadow 0.2s;
}

.detail-section:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.09);
}

.detail-section .h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    color: #222;
}

.detail-section .h4 i {
    font-size: 1.15rem;
    color: var(--primary);
}

/* 상세 테이블 */
.detail-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.detail-table th {
    width: 130px;
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.88rem;
    color: #444;
    vertical-align: middle;
    border-color: #eef1f5;
    padding: 12px 14px;
}

.detail-table td {
    vertical-align: middle;
    word-break: break-all;
    font-size: 0.92rem;
    color: #333;
    border-color: #eef1f5;
    padding: 12px 14px;
}

.detail-table tr:last-child th,
.detail-table tr:last-child td {
    border-bottom: none;
}

.detail-table tr:hover td {
    background: #fbfcfe;
}

.detail-table td a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.detail-table td a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.detail-table td a.text-muted {
    color: #888 !important;
    font-weight: 400;
}

.detail-table td a.text-muted:hover {
    color: var(--primary) !important;
}

/* 사이드바 빠른 정보 */
.detail-quick-info {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-quick-info li {
    padding: 10px 0;
    border-bottom: 1px solid #f2f2f2;
    font-size: 0.9rem;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.detail-quick-info li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-quick-info li:first-child {
    padding-top: 0;
}

.detail-quick-info li i {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.detail-quick-info li strong {
    flex-shrink: 0;
    color: #555;
    font-weight: 600;
    min-width: 36px;
}

.detail-quick-info li a {
    color: var(--primary);
    text-decoration: none;
}

.detail-quick-info li a:hover {
    text-decoration: underline;
}

/* 사이드바 지도 */
.detail-section .detail-map + p {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #999;
}

/* 사이드바 유형/지역 pill 래퍼 */
.detail-section .region-link--sm {
    margin-bottom: 4px;
}

/* 시설 사진 */
.detail-section .img-fluid {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 공유 버튼 */
.share-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #dee2e6;
    background: white;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.share-btn--facebook {
    border-color: #1877f2;
    color: #1877f2;
}

.share-btn--facebook:hover {
    background: #1877f2;
    color: white;
}

.share-btn--x {
    border-color: #14171a;
    color: #14171a;
}

.share-btn--x:hover {
    background: #14171a;
    color: white;
}

.share-btn--band {
    border-color: #06cf5e;
    color: #06cf5e;
}

.share-btn--band:hover {
    background: #06cf5e;
    color: white;
}

.share-btn--copy {
    border-color: #6c757d;
    color: #6c757d;
}

.share-btn--copy:hover {
    background: #6c757d;
    color: white;
}

.share-btn--copied {
    background: #198754;
    border-color: #198754;
    color: white;
}

@media (max-width: 576px) {
    .share-btn {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
}

/* 지도 */
#map {
    height: 500px;
    border-radius: 12px;
    z-index: 1;
}

.detail-map {
    height: 300px;
    border-radius: 10px;
    z-index: 1;
    border: 1px solid #e9ecef;
}

/* 필터 */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.filter-btn {
    border-radius: 20px;
    padding: 6px 16px;
    margin: 3px;
    font-size: 0.85rem;
}

/* 페이지 헤더 */
.page-header {
    background: var(--bg-light);
    padding: 25px 0;
    margin-bottom: 30px;
}

.page-header h1,
.page-header h2 {
    font-weight: 700;
    margin-bottom: 5px;
}

/* 브레드크럼 */
.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-item a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #555;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #aaa;
}

@media (max-width: 576px) {
    .breadcrumb {
        font-size: 0.78rem;
    }

    .breadcrumb-item {
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* 로딩 */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

/* 배지 */
.badge {
    font-weight: 500;
}

/* 카테고리 카드 */
.category-card {
    border: none;
    border-radius: 12px;
    text-align: center;
    padding: 25px 15px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-card:hover,
.category-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    color: inherit;
}

.category-card .category-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.category-card h6 {
    font-weight: 600;
    margin-bottom: 5px;
}

.category-card .text-muted {
    font-size: 0.85rem;
}

/* 푸터 */
.site-footer {
    background: #1a2332;
    color: #d1d5db;
}

.footer-title {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 12px;
}

.footer-text {
    color: #9ca3af;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-link {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    padding: 2px 0;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #60a5fa;
}

.footer-hr {
    border-color: rgba(255,255,255,0.1);
    margin: 20px 0;
}

.footer-copy {
    color: #6b7280;
    font-size: 0.8rem;
}

/* 404 */
.display-1 {
    font-size: 6rem;
    font-weight: 700;
}

/* 반응형 */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 0 30px;
    }

    .hero-section h1 {
        font-size: 1.6rem;
    }

    #map {
        height: 350px;
    }

    .page-header--detail {
        padding: 20px 0 18px;
    }

    .page-header--detail h1 {
        font-size: 1.25rem;
    }

    .detail-section {
        padding: 18px;
        border-radius: 10px;
        margin-bottom: 16px;
    }

    .detail-section .h4 {
        font-size: 1rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .detail-table th {
        width: 90px;
        font-size: 0.82rem;
        padding: 10px;
    }

    .detail-table td {
        font-size: 0.85rem;
        padding: 10px;
    }

    .detail-quick-info li {
        padding: 8px 0;
        font-size: 0.85rem;
    }

    .detail-map {
        height: 250px;
    }

    .stat-card .stat-number {
        font-size: 1.3rem;
    }

    .facility-card {
        padding: 15px;
    }

    .filter-btn {
        font-size: 0.78rem;
        padding: 5px 12px;
    }

    /* 사이드바를 메인 아래로 내릴 때 여백 */
    .col-lg-4 > .detail-section:first-child {
        margin-top: 4px;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 1.3rem;
    }

    .hero-search .form-control {
        font-size: 0.95rem;
        padding: 10px 18px;
    }

    .region-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* 추천 섹션 (detail.php) */
.recommend-section {
    padding: 40px 0;
    border-top: 1px solid #e9ecef;
}

.recommend-section + .recommend-section {
    border-top: none;
}

.recommend-section--alt {
    background: #f4f7fb;
}

.recommend-section__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommend-section__title small {
    font-size: 0.85rem;
    font-weight: 400;
    color: #888;
}

.recommend-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.recommend-card:hover,
.recommend-card:focus {
    box-shadow: 0 4px 14px rgba(13, 110, 253, 0.12);
    border-color: var(--primary);
    color: inherit;
    transform: translateY(-2px);
}

.recommend-card__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    word-break: keep-all;
}

.recommend-card__name .badge {
    font-size: 0.68rem;
    vertical-align: middle;
    flex-shrink: 0;
}

.recommend-card:hover .recommend-card__name {
    color: var(--primary);
}

.recommend-card__meta {
    font-size: 0.78rem;
    color: #777;
    line-height: 1.6;
    overflow: hidden;
    word-break: break-all;
    flex: 1;
}

.recommend-card__meta i {
    width: 14px;
    text-align: center;
    color: var(--primary);
    font-size: 0.75rem;
}

.recommend-card__meta a {
    font-size: inherit;
}

.recommend-card__distance {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 6px;
}

@media (max-width: 768px) {
    .recommend-section {
        padding: 28px 0;
    }

    .recommend-card {
        padding: 12px 13px;
    }

    .recommend-card__name {
        font-size: 0.84rem;
    }

    .recommend-card__meta {
        font-size: 0.75rem;
        line-height: 1.5;
    }

    .recommend-section__title {
        font-size: 1rem;
    }
}

/* 통계 배너 */
.stats-banner {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.stats-banner .stat-card {
    box-shadow: none;
    background: white;
}

/* 유형 뱃지 (시도 카드 내) */
.type-badge {
    display: inline-block;
    font-size: 0.73rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e8f0fe;
    color: var(--primary);
    margin: 1px 2px;
    white-space: nowrap;
}

/* 크로스링크 섹션 */
.cross-link-section {
    padding: 30px 0;
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
}

.cross-link-section + .cross-link-section {
    border-top: none;
    padding-top: 0;
}

.cross-link-section--alt {
    background: #f4f7fb;
    padding: 30px 0;
    margin-top: 30px;
    border-top: none;
}

.cross-link-section__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

/* 서브네비 그리드 (시군구/유형 breakdown) */
.sub-nav-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.sub-nav-section h5 {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 14px;
    color: #444;
}

/* 카테고리 카드 무료/유료 텍스트 */
.category-card .type-split {
    font-size: 0.78rem;
    color: #888;
    margin-top: 4px;
}

/* 시도 허브 카드 */
.sido-hub-card {
    border: none;
    border-radius: 12px;
    padding: 22px 18px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    background: white;
}

.sido-hub-card:hover,
.sido-hub-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    color: inherit;
}

.sido-hub-card__name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #222;
}

.sido-hub-card:hover .sido-hub-card__name {
    color: var(--primary);
}

.sido-hub-card__count {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.sido-hub-card__types {
    margin-top: 8px;
}

@media (max-width: 768px) {
    .stats-banner {
        padding: 14px;
    }

    .sub-nav-section {
        padding: 15px;
    }

    .sido-hub-card {
        padding: 16px 14px;
    }

    .sido-hub-card__name {
        font-size: 1rem;
    }
}

/* 프린트 */
@media print {
    .navbar, footer, .hero-search, .filter-section, .page-header nav,
    .recommend-section, .cross-link-section, .cross-link-section--alt {
        display: none !important;
    }

    .detail-section {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .detail-section:hover {
        box-shadow: none;
    }

    .detail-table td a {
        color: #333;
        text-decoration: none;
    }

    .detail-map {
        display: none;
    }
}
