:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --dark: #2d3748;
    --light: #f7fafc;
    --border: #e2e8f0;
    --text: #2d3748;
    --text-light: #718096;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(102, 126, 234, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 0.4rem 1.5rem;
    border-bottom: 2px solid var(--primary);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    gap: 1rem;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.header-count {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
    margin-left: 0.25rem;
}

.icon {
    font-size: 1.4rem;
}

.header-logo {
    height: 2rem;
    width: auto;
    object-fit: contain;
}

.icon-small {
    font-size: 1.2rem;
}

.icon-large {
    font-size: 3rem;
}

.badge {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--shadow-lg);
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 60px);
    gap: 0;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    overflow-y: auto;
    box-shadow: 4px 0 20px var(--shadow);
    z-index: 1000;
}

.sidebar-section {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 0.5rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-lg);
}

.btn-secondary {
    background: var(--info);
    color: white;
}

.btn-secondary:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.btn-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    margin-bottom: 0.25rem;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

/* Small Button */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Location List */
.location-list {
    max-height: 300px;
    overflow-y: auto;
}

.location-item {
    background: var(--light);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
    cursor: pointer;
}

.location-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
    box-shadow: 0 4px 12px var(--shadow);
}

.location-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.location-item-name {
    font-weight: 700;
    color: var(--dark);
    font-size: 0.95rem;
}

.location-item-category {
    font-size: 1.2rem;
}

.location-item-address {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.location-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.location-item-btn {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-view {
    background: var(--info);
    color: white;
}

.btn-delete {
    background: var(--danger);
    color: white;
}

.location-item-btn:hover {
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
}

.empty-state p {
    margin: 0.5rem 0;
    font-weight: 600;
}

.empty-state small {
    font-size: 0.75rem;
}

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

#map {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.control-btn {
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px var(--shadow);
}

.control-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Status Message */
.status-message {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 2rem;
    box-shadow: 0 4px 20px var(--shadow);
    font-weight: 600;
    display: none;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.status-message.show {
    display: block;
}

.status-message.success {
    border-left: 4px solid var(--success);
}

.status-message.error {
    border-left: 4px solid var(--danger);
}

.status-message.info {
    border-left: 4px solid var(--info);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.location-list::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.location-list::-webkit-scrollbar-track {
    background: var(--light);
}

.sidebar::-webkit-scrollbar-thumb,
.location-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.location-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px var(--shadow);
}

.leaflet-popup-content {
    margin: 1rem;
    font-family: 'Inter', sans-serif;
}

.popup-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.popup-address {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.popup-category {
    display: inline-block;
    background: var(--light);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 2100;
    margin-left: 1rem;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--primary);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.mobile-menu-btn.active span:first-child {
    transform: rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
    }

    .sidebar {
        position: fixed;
        left: -320px;
        top: 60px;
        height: calc(100vh - 60px);
        width: 320px;
        transition: left 0.3s ease;
        z-index: 2000;
        border-right: 1px solid var(--border);
    }

    .sidebar.active {
        left: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    .header {
        padding: 0.5rem 1rem;
    }

    .header-content {
        padding: 0;
        gap: 0.5rem;
    }

    .header-title {
        font-size: 0.75rem;
        gap: 0.3rem;
    }

    .header-logo {
        height: 1.5rem;
    }

    .header-count {
        display: none;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .header-btn {
        display: none;
    }

    .icon {
        font-size: 1.25rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    animation: spin 1s linear infinite;
}

/* ===================================================== */
/* HEALTH FACILITIES SPECIFIC STYLES */
/* ===================================================== */

/* Facility Popup Enhancements */
.facility-popup {
    min-width: 280px;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.popup-icon {
    font-size: 2rem;
}

.popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.popup-body {
    margin-bottom: 1rem;
}

.popup-info {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.popup-info strong {
    color: var(--dark);
    display: inline-block;
    min-width: 80px;
}

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

.popup-info a:hover {
    text-decoration: underline;
}

.popup-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.popup-btn {
    flex: 1;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-lg);
}

/* Metadata Badges */
.location-item-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
}

/* Custom Marker Styling */
.custom-marker {
    animation: markerBounce 0.5s ease-out;
}

@keyframes markerBounce {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

    50% {
        transform: translateY(5px);
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 0.75rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.leaflet-popup-content {
    margin: 1.25rem 1.25rem 1rem 1.25rem;
    font-family: 'Inter', sans-serif;
}

.leaflet-popup-tip {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1);
}

/* Marker Cluster Customization */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(102, 126, 234, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(102, 126, 234, 0.8);
    color: white;
    font-weight: 700;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .facility-popup {
        min-width: 250px;
    }

    .popup-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .popup-icon {
        font-size: 1.5rem;
    }

    .popup-title {
        font-size: 1rem;
    }

    .meta-badge {
        font-size: 0.65rem;
    }
}

/* Leaflet Popup Close Button Enhancement */
.leaflet-popup-close-button {
    width: 32px !important;
    height: 32px !important;
    font-size: 28px !important;
    font-weight: bold !important;
    color: #dc3545 !important;
    padding: 0 !important;
    line-height: 28px !important;
    text-align: center !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    top: 5px !important;
    right: 2px !important;
}

.leaflet-popup-close-button:hover {
    color: #a71d2a !important;
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 3px 10px rgba(220, 53, 69, 0.3) !important;
    transform: scale(1.1) !important;
}

/* Details View Style */
.details-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 2rem;
}

.details-card {
    background: white;
    border-radius: 8px;
    padding: 0.85rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    animation: sidebarSlideIn 0.3s ease-out;
}

@keyframes sidebarSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    gap: 0.65rem;
}

.details-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
}

.details-type-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.details-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.details-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.details-info strong {
    color: var(--text);
    font-weight: 600;
    width: 24px;
    text-align: center;
}

.details-info a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.details-info a:hover {
    text-decoration: underline;
}

.details-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.details-btn {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.details-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Details Social Media Icons */
.details-social {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    align-items: center;
}

.details-social .social-link,
.popup-social .social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    text-decoration: none;
    opacity: 0.9;
}

.details-social .social-link:hover,
.popup-social .social-link:hover {
    transform: scale(1.15);
    opacity: 1;
}

.details-social svg,
.popup-social svg {
    display: block;
}

/* Popup Social Media */
.popup-social {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: 0.25rem;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-light);
}

/* Search Suggestions */
.search-container {
    position: relative;
    width: 100%;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 2500;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    margin-top: 5px;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--light);
}

.suggestion-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.suggestion-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.suggestion-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-wrap: break-word;
    line-height: 1.4;
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Search Input Custom Background */
#searchInput {
    background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 100%) !important;
    border: 2px solid #d0d9ff !important;
}

#searchInput:focus {
    background: linear-gradient(135deg, #e8f0ff 0%, #f0e8ff 100%) !important;
    border-color: var(--primary) !important;
}

/* Hospital Sign Icon Override */
.hospital-sign {
    background-color: #0033cc;
    color: white;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    border-radius: 4px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-family: 'Inter', sans-serif;
    line-height: 1;
    margin-right: 4px;
    vertical-align: middle;
    text-shadow: none;
}

.custom-marker .hospital-sign {
    width: 32px;
    height: 32px;
    font-size: 20px;
    margin-right: 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text);
}

.report-error-btn {
    margin-top: 1rem;
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem !important;
    font-size: 0.9rem !important;
    background: #fff5f5 !important;
    color: #c53030 !important;
    border: 1px dashed #feb2b2 !important;
    border-radius: 0.75rem !important;
    cursor: pointer;
    transition: all 0.2s;
}

.report-error-btn:hover {
    background: #fee2e2 !important;
}

.popup-btn-report {
    background: #fff5f5 !important;
    color: #c53030 !important;
    border: 1px dashed #feb2b2 !important;
    flex: 1 1 100% !important;
    /* Force to its own line or take full width if needed */
    margin-top: 0.25rem;
}

.popup-btn-report:hover {
    background: #fee2e2 !important;
}