/* Global Styles */
:root {
    --primary-color: #0ea5e9;
    /* Medical Blue */
    --primary-dark: #0284c7;
    --accnet-color: #38bdf8;
    --bg-color: #f8fafc;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --white: #ffffff;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --header-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    /* Remove height 100vh constraint to allow flow in embed */
    min-height: 100vh;
    overflow-y: auto;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    /* Limit width as requested */
    width: 95%;
    max-width: 1100px;
    height: 85vh;
    /* Fixed height for the widget feel */
    background: transparent;
    /* No gap needed above since header is gone */
	margin: 0 auto;
}

/* Header */
.main-header {
    background: var(--white);
    padding: 1rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 10;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 12px;
    background: var(--white);
}

.main-header h1 {
    font-size: 1.5rem;
    color: var(--primary-dark);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-header .subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 2.3rem;
    /* Align with text start */
}

/* Search Section */
.nearbtn{
	width: 150px;
	margin: 20px 0 10px 20px;
	padding: 10px;
	text-align: center;
	background: #ff8b00;
	border-radius: 15px;
	border: 1px #C8C8C8 solid;
}
.nearbtn a{
	color: #FFFFFF;
}
.nearbtn a:hover{
	color:#000000;
	text-decoration: underline;
}
.search-section {
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.search-container {
    display: flex;
    gap: 1rem;
    max-width: 1200px;
}

.input-group,
.select-group {
    position: relative;
    flex: 1;
}

.select-group {
    flex: 0 0 200px;
    /* Fixed width for city select */
}

.search-icon,
.location-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Content Wrapper (Split Layout) */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 15px;
    align-items: center;
    /* Center horizontally */
}

/* Title Section (Transparent) */
.app-title-section {
    text-align: center;
    padding: 0 1rem;
    color: var(--text-main);
    flex-shrink: 0;
}

.app-title-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
    /* Center text explicitly */
    display: block;
}

.app-title-section .subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Main Card (Unified Block) */
.main-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    width: 100%;
    flex: 1;
    /* Take remaining height */
    overflow: hidden;
    /* Contains internal scrolls */
    display: flex;
    flex-direction: column;
}

/* Search Header (Top of Card) */
.search-header {
    padding: 1.25rem 1.5rem 0.75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.search-container-full {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex: 0 0 auto;
}

.input-group,
.select-wrapper {
    position: relative;
    flex: 1;
}

.select-wrapper {
    min-width: 140px;
}

/* Update inputs to match */
input,
select {
    background-color: #f8fafc;
}

/* Status Bar */
.list-status-bar {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Split View Container */
.split-view-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel: List (Inside Card) */
.hospital-list-panel {
    flex: 0 0 320px;
    /* Sidebar width */
    border-right: 1px solid #e2e8f0;
    background: var(--white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Remove shadow/radius as it's inside card now */
    box-shadow: none;
    border-radius: 0;
}

/* Search Controls inside list removal - Handled by HTML change */

/* List Results */
.hospital-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Map Panel (Inside Card) */
.map-panel {
    flex: 1;
    position: relative;
    background: #e2e8f0;
    /* Remove individual radius/shadow */
    border-radius: 0;
    box-shadow: none;
    color: var(--text-secondary);
}

/* Sidebar Search Controls */
.search-container-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-row {
    display: flex;
    gap: 0.5rem;
}

.input-group,
.select-group {
    position: relative;
    flex: 1;
}

.search-icon,
.location-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input,
select {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background-color: #f8fafc;
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.list-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.list-status-bar h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* List Results */
.hospital-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Scrollbar styling */
.hospital-list::-webkit-scrollbar {
    width: 6px;
}

.hospital-list::-webkit-scrollbar-track {
    background: transparent;
}

.hospital-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

/* Hospital Card */
.hospital-card {
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
    /* Changed from hidden to visible to show shadows properly, or strictly handle content */
    flex-shrink: 0;
    /* CRITICAL: Prevent cards from shrinking in flex container */
}

.hospital-card:hover {
    /* border-color: var(--primary-color); */
    border-color: #0ea5e9;
    box-shadow: var(--card-shadow);
    transform: translateY(-2px);
}

.hospital-card.active {
    /* border-color: var(--primary-color); */
    border-color: #0ea5e9;
    background-color: #f0f9ff;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.hospital-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.type-tag {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.type-tag.hospital {
    background-color: #e0f2fe;
    color: #0369a1;
}

.type-tag.clinic {
    background-color: #dcfce7;
    color: #15803d;
}

.hospital-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hospital-card i {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
}

/* Right Panel: Map */
.map-panel {
    flex: 1;
    position: relative;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.map-panel iframe {
    width: 100%;
    height: 100%;
    display: block;
}

.map-overlay-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 2rem;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: var(--card-shadow);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Only show hint if we want to (optional, currently hidden) */

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    body {
        overflow-y: auto;
    }

    .split-view-container {
        flex-direction: column;
        overflow: visible;
    }

    .hospital-list-panel {
        width: 100%;
        height: 50vh;
        /* Adjust height based on preference, 50vh usually good for split */
        min-height: 300px;
        order: 1;
        /* Ensure list is first (default HTML order but just in case) */
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .map-panel {
        width: 100%;
        height: 50vh;
        /* Map takes remaining/half screen */
        min-height: 300px;
        order: 2;
        /* Map second */
    }

    .search-container-full {
        flex-direction: column;
        /* Stack search and filters */
        gap: 0.75rem;
    }

    .filter-group {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .select-wrapper {
        flex: 1;
    }
}