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

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

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background-color: #4A90E2;
    color: white;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 0;
}

/* Hamburger Button */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: rgba(255,255,255,0.3);
}

.hamburger-line {
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation Menu */
.nav-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.nav-menu.active {
    display: flex;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    transition: background 0.2s;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.2);
}

.search-box {
    display: flex;
    gap: 10px;
}

#sidoSelect,
#sigunguSelect {
    padding: 10px 12px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    min-width: 120px;
}

#sidoSelect:focus,
#sigunguSelect:focus {
    outline: 2px solid #2ECC71;
}

#searchInput {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    min-width: 150px;
}

#resetFilterBtn {
    padding: 10px 15px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

#resetFilterBtn:hover {
    background-color: #7f8c8d;
}

#myLocationBtn {
    padding: 10px 20px;
    background-color: #2ECC71;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

#myLocationBtn:hover {
    background-color: #27AE60;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: white;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-section {
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.filter-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.filter-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    cursor: pointer;
}

.filter-section input[type="checkbox"] {
    margin-right: 8px;
}

.hospital-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.hospital-list h3 {
    font-size: 16px;
    margin-bottom: 0;
    color: #333;
}

/* Sort Buttons (Desktop) */
.sort-buttons {
    display: flex;
    gap: 5px;
}

.sort-btn {
    padding: 5px 10px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: #f5f5f5;
}

.sort-btn.active {
    background: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

.hospital-item {
    background-color: #f9f9f9;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hospital-item:hover {
    background-color: #e3f2fd;
    transform: translateX(-5px);
}

.hospital-item.active {
    background-color: #4A90E2;
    color: white;
}

.hospital-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.hospital-type {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.hospital-item.active .hospital-type {
    color: #E3F2FD;
}

.hospital-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.hospital-item.active .hospital-address {
    color: white;
}

.hospital-distance {
    font-size: 12px;
    color: #2ECC71;
    font-weight: bold;
}

.hospital-item.active .hospital-distance {
    color: #A5D6A7;
}

.hospital-services {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.service-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 3px;
    background-color: #E3F2FD;
    color: #4A90E2;
}

.hospital-item.active .service-badge {
    background-color: rgba(255,255,255,0.2);
    color: white;
}

.hospital-links {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.kakao-map-link,
.detail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    min-height: 36px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.kakao-map-link {
    background-color: #FEE500;
    color: #000;
}

.detail-link {
    background-color: #2ECC71;
    color: #fff;
}

.kakao-map-link:hover,
.detail-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.kakao-map-link:hover {
    background-color: #FDD835;
}

.detail-link:hover {
    background-color: #27AE60;
}

.hospital-item.active .kakao-map-link {
    background-color: white;
    color: #4A90E2;
}

.hospital-item.active .detail-link {
    background-color: white;
    color: #2ECC71;
}

.hospital-item.active .kakao-map-link:hover,
.hospital-item.active .detail-link:hover {
    background-color: #f5f5f5;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-hospital-name {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.modal-info-row {
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.modal-info-label {
    font-weight: bold;
    color: #333;
    display: inline-block;
    width: 80px;
}

.modal-phone {
    color: #4A90E2;
    text-decoration: none;
}

.modal-phone:hover {
    text-decoration: underline;
}

/* ===========================================
   MOBILE RESPONSIVE STYLES
   =========================================== */

/* Desktop/Mobile visibility helpers */
.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none !important;
    }

    /* Header Mobile */
    .header {
        padding: 12px 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    .header h1 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .search-box {
        flex-wrap: wrap;
        gap: 8px;
    }

    #sidoSelect,
    #sigunguSelect {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 10px 8px;
        font-size: 13px;
    }

    #searchInput {
        flex: 1;
        order: 3;
        min-width: 0;
        padding: 10px 12px;
        font-size: 14px;
    }

    #resetFilterBtn {
        order: 4;
        padding: 10px 12px;
        font-size: 13px;
        flex-shrink: 0;
    }

    #myLocationBtn {
        display: none; /* Hidden on mobile, use FAB instead */
    }

    /* Main Content Mobile */
    .main-content {
        flex-direction: column;
        margin-top: 110px; /* Header height */
    }

    .map-container {
        position: fixed;
        top: 110px;
        left: 0;
        right: 0;
        bottom: 0;
        height: auto;
    }

    #map {
        width: 100%;
        height: 100%;
    }

    /* Sidebar hidden on mobile */
    .sidebar {
        display: none;
    }
}

/* ===========================================
   FLOATING ACTION BUTTON (FAB)
   =========================================== */
.fab-button {
    display: none;
    position: absolute;
    bottom: 140px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #2ECC71;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 50;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, bottom 0.3s ease;
}

.fab-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.fab-button:active {
    transform: scale(0.95);
}

.fab-button svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 768px) {
    .fab-button {
        display: flex;
    }
}

/* ===========================================
   BOTTOM SHEET (MOBILE)
   =========================================== */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 200;
    transition: height 0.3s ease;
    height: 120px; /* Default collapsed height */
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.bottom-sheet.half {
    height: 50vh;
}

.bottom-sheet.expanded {
    height: 85vh;
}

/* Sheet Handle */
.sheet-handle {
    padding: 12px 16px 8px;
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

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

.handle-bar {
    width: 40px;
    height: 4px;
    background-color: #D1D5DB;
    border-radius: 2px;
}

/* Sheet Toggle Buttons */
.sheet-toggle-buttons {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.sheet-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #E5E7EB;
    background-color: #F9FAFB;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sheet-toggle-btn:hover {
    background-color: #E5E7EB;
}

.sheet-toggle-btn:active {
    transform: scale(0.95);
}

.sheet-toggle-btn.active {
    background-color: #4A90E2;
    border-color: #4A90E2;
    color: white;
}

/* Sheet Header */
.sheet-header {
    padding: 0 16px 12px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.sheet-header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.hospital-count-mobile {
    font-size: 14px;
    color: #6B7280;
    font-weight: 500;
}

/* Sort Buttons (Mobile) */
.sort-buttons-mobile {
    display: flex;
    gap: 5px;
}

.sort-btn-mobile {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn-mobile.active {
    background: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

/* Filter Chips */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid #D1D5DB;
    background-color: #F9FAFB;
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}

.filter-chip.active {
    background-color: #EEF2FF;
    border-color: #4A90E2;
    color: #4A90E2;
}

.filter-chip:active {
    transform: scale(0.95);
}

/* Sheet Content */
.sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
}

/* Hospital List Mobile */
#hospitalListContainerMobile .hospital-item {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
}

#hospitalListContainerMobile .hospital-item:active {
    background-color: #EEF2FF;
}

#hospitalListContainerMobile .hospital-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

#hospitalListContainerMobile .hospital-type {
    font-size: 12px;
    color: #9CA3AF;
    margin-bottom: 6px;
}

#hospitalListContainerMobile .hospital-address {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 8px;
    line-height: 1.4;
}

#hospitalListContainerMobile .hospital-distance {
    font-size: 13px;
    color: #10B981;
    font-weight: 600;
}

#hospitalListContainerMobile .hospital-services {
    margin-top: 10px;
    gap: 6px;
}

#hospitalListContainerMobile .service-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
}

#hospitalListContainerMobile .kakao-map-link {
    margin-top: 12px;
    padding: 10px 16px;
    font-size: 13px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ad Section Mobile */
.ad-section-mobile {
    padding: 16px 0;
    margin-top: 12px;
    border-top: 1px solid #E5E7EB;
    text-align: center;
}

.ad-section-mobile .ad-disclosure {
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 8px;
}

/* Modal Mobile Adjustments */
@media (max-width: 768px) {
    .modal-content {
        margin: 20% auto;
        padding: 20px;
        width: 95%;
        max-width: none;
        border-radius: 16px;
    }

    .modal-hospital-name {
        font-size: 18px;
        padding-right: 35px;
    }

    .modal-info-row {
        font-size: 13px;
    }

    .modal-info-label {
        width: 70px;
    }

    .close {
        right: 15px;
        top: 15px;
        font-size: 24px;
    }
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* Ad Section */
.ad-section {
    padding: 15px;
    border-top: 1px solid #ddd;
    background-color: #fafafa;
    text-align: center;
}

.ad-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.ad-placeholder {
    width: 320px;
    height: 50px;
    background-color: #e0e0e0;
    border: 1px dashed #999;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666;
    font-size: 12px;
}

.ad-disclosure {
    font-size: 10px;
    color: #999;
    line-height: 1.4;
    margin: 0;
}

/* Responsive Ad - Desktop */
@media (max-width: 768px) {
    .ad-section {
        display: none; /* Hidden on mobile, use ad-section-mobile in bottom sheet */
    }
}

/* Site Footer */
.site-footer {
    background: #333;
    color: #fff;
    padding: 20px;
    text-align: center;
}

.site-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.site-footer .footer-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.site-footer .footer-links a:hover {
    color: #fff;
}

.site-footer .footer-copyright {
    font-size: 12px;
    color: #999;
}

/* Mobile Footer adjustments */
@media (max-width: 768px) {
    .site-footer {
        padding: 15px;
        padding-bottom: 130px; /* Space for bottom sheet */
    }

    .site-footer .footer-links {
        gap: 12px;
    }

    .site-footer .footer-links a {
        font-size: 12px;
    }
}
