/* Custom styles for Clinic Map Interface */

/* General Styles */
body {
    background-color: #f8f9fa;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
}

.navbar-brand i {
    color: #ffc107;
}

/* Map Styles */
#map {
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sidebar Styles */
.clinic-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 12px;
}

.clinic-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
    border-color: #007bff;
}

.clinic-card.highlighted {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.clinic-card .card-body {
    padding: 12px 16px;
}

.clinic-name {
    color: #007bff;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.clinic-address {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.clinic-type {
    background-color: #e7f3ff;
    color: #0056b3;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.clinic-city {
    background-color: #f8f9fa;
    color: #495057;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-left: 4px;
}

.clinic-coords-badge {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    display: inline-block;
    margin-left: 4px;
}

.badge-insurance {
    font-size: 0.65rem;
    padding: 2px 5px;
    margin-left: 4px;
    font-weight: 600;
    border-radius: 3px;
}

.badge-wiener {
    background-color: #0d6efd;
    color: white;
}

.badge-generali {
    background-color: #dc3545;
    color: white;
}

/* Filters Panel */
.filters-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
}

/* Statistics Cards */
.stats-card {
    background: white;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

/* Map Markers */
.custom-marker-icon {
    background: #007bff;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.custom-marker-icon.selected {
    background: #dc3545;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.clinic-popup h6 {
    color: #007bff;
    margin-bottom: 8px;
    font-weight: 600;
}

.clinic-popup .popup-address {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.clinic-popup .popup-details {
    font-size: 0.85rem;
}

.clinic-popup .btn {
    font-size: 0.8rem;
    padding: 4px 12px;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-content {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

/* Modal Styles */
.modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Statistics Modal */
.stat-item {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Clinic Details Modal */
.detail-row {
    border-bottom: 1px solid #f1f3f4;
    padding: 12px 0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #495057;
}

.detail-value {
    color: #6c757d;
}

/* Height utility classes (desktop default) */
.map-vh {
    height: 70vh;
    min-height: 500px;
}

.sidebar-vh {
    max-height: 70vh;
    overflow-y: auto;
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    /* Reduce map height on small screens and ensure the list is visible */
    .map-vh {
        height: 45vh;
        min-height: 260px;
    }
    .sidebar-vh {
        max-height: 55vh;
    }
    .clinic-card {
        margin-bottom: 8px;
    }
    .clinic-card .card-body {
        padding: 10px 12px;
    }
    .stats-number {
        font-size: 1.5rem;
    }
}

/* Medium screens tweaks */
@media (min-width: 577px) and (max-width: 768px) {
    .map-vh { height: 55vh; min-height: 360px; }
    .sidebar-vh { max-height: 45vh; }
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Search Input */
.search-highlight {
    background-color: yellow;
    padding: 1px 2px;
    border-radius: 2px;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Filters */
.form-select:focus,
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-outline-primary:hover {
    background-color: #007bff;
    border-color: #007bff;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Success/Error States */
.success-state {
    color: #28a745;
}

.error-state {
    color: #dc3545;
}

.warning-state {
    color: #ffc107;
}

/* Footer */
footer {
    border-top: 1px solid #dee2e6;
}

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --accent: #ffc107;
    --bg: #f8f9fa;
    --muted: #6c757d;
    --card-border: #e9ecef;
}

/* Navbar polish */
.navbar.bg-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.25);
}
.navbar .navbar-brand i { color: var(--accent); }

/* Filters panel polish */
.filters-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
    border-bottom: 1px solid #e5e9f0;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
    position: relative; /* Create a higher stacking context for dropdowns */
    z-index: 1000; /* Above Leaflet panes but below modals (1050+) */
    overflow: visible; /* Allow dropdown to overflow panel */
}
.filters-panel .btn,
.filters-panel .form-control,
.filters-panel .form-select {
    border-radius: 10px;
}
.dropdown-menu {
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    z-index: 5000; /* Ensure dropdowns appear above map and navbar */
}
/* Extra safety: when visible, keep on top */
.dropdown-menu.show {
    z-index: 5001;
}

/* Sidebar header polish */
.sticky-top.bg-white.border-bottom {
    box-shadow: 0 4px 10px -6px rgba(0,0,0,0.25);
}

/* Clinic card tweaks */
.clinic-card {
    border-radius: 12px;
    border-color: var(--card-border);
}
.clinic-card .clinic-name { font-size: 1rem; }
.clinic-card .clinic-address { font-size: 0.875rem; }
.clinic-card .badge { border-radius: 999px; }

/* Map container subtle rounding on edges next to sidebar */
#map { border-right: 1px solid #eef1f4; }

/* Footer subtle bg */
footer { background: #fafbfc; }

.filters-panel .input-group-text {
    background: #f1f4f8;
    border-color: #dde3ea;
    color: #6b7280;
}

/* Right-aligned clear button styling (neutral to fit overall palette) */
.filters-clear-btn {
    border-color: #cfd4da;
    color: #495057;
    background: #fff;
}
.filters-clear-btn:hover {
    background: #f1f3f5;
    border-color: #c1c8d0;
    color: #212529;
}

/* Subtle blur and elevation for sticky results header */
.sticky-top.bg-white.border-bottom {
    backdrop-filter: saturate(180%) blur(6px);
    -webkit-backdrop-filter: saturate(180%) blur(6px);
}

/* Stats visuals */
.bg-light .card.bg-transparent .card-body h6.card-title i {
    opacity: 0.9;
}
.bg-light .card.bg-transparent .card-body h5 {
    font-weight: 700;
}

/* Dropdown search input in city menu */
#cityDropdownMenu .form-control-sm {
    border-radius: 8px;
}

/* Checkbox alignment improvement */
.form-check-inline .form-check-input {
    width: 1.05rem;
    height: 1.05rem;
}

/* Better hover for dropdown button */
#cityDropdownBtn:hover {
    background-color: #f3f6fb;
}

/* Responsive: ensure clear button full width on xs */
@media (max-width: 576px) {
    .filters-clear-btn { width: 100%; }
}

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --accent: #ffc107;
    --bg: #f8f9fa;
    --muted: #6c757d;
    --card-border: #e9ecef;
}

/* Dark mode overrides for custom components */
[data-bs-theme="dark"] body {
    background-color: #0b1020;
    color: #e5e7eb;
}
[data-bs-theme="dark"] .filters-panel {
    background: linear-gradient(180deg, #121826 0%, #0b1020 100%);
    border-bottom: 1px solid #1f2937;
}
[data-bs-theme="dark"] .filters-panel .input-group-text {
    background: #111827;
    border-color: #1f2937;
    color: #9ca3af;
}
[data-bs-theme="dark"] .dropdown-menu {
    background: #0f1625;
    border-color: #1f2937;
    color: #e5e7eb;
}
[data-bs-theme="dark"] .dropdown-menu .form-control-sm {
    background: #0b1020;
    border-color: #1f2937;
    color: #e5e7eb;
}
[data-bs-theme="dark"] .sticky-top.bg-white.border-bottom {
    background-color: rgba(16,23,42,0.85) !important;
    border-bottom-color: #1f2937 !important;
    box-shadow: 0 4px 10px -6px rgba(0,0,0,0.6);
}
[data-bs-theme="dark"] .sidebar,
[data-bs-theme="dark"] .bg-white.sidebar,
[data-bs-theme="dark"] .border-start.sidebar {
    background: #0f1625 !important;
    border-color: #1f2937 !important;
}
[data-bs-theme="dark"] .clinic-card {
    background: #0f1625;
    border-color: #1f2937;
}
[data-bs-theme="dark"] .clinic-name { color: #93c5fd; }
[data-bs-theme="dark"] .clinic-address { color: #94a3b8; }
[data-bs-theme="dark"] .clinic-type {
    background-color: rgba(59,130,246,0.15);
    color: #bfdbfe;
}
[data-bs-theme="dark"] .clinic-city {
    background-color: rgba(148,163,184,0.12);
    color: #cbd5e1;
}
[data-bs-theme="dark"] .clinic-coords-badge {
    background-color: rgba(34,197,94,0.15);
    color: #86efac;
    border-color: rgba(34,197,94,0.25);
}
[data-bs-theme="dark"] footer {
    background: #0f1625;
    border-top-color: #1f2937;
}
[data-bs-theme="dark"] footer .text-muted { color: #9ca3af !important; }
[data-bs-theme="dark"] #map { border-right: 1px solid #1f2937; }
[data-bs-theme="dark"] .leaflet-popup-content-wrapper {
    background: #0f1625;
    color: #e5e7eb;
}
[data-bs-theme="dark"] .loading-overlay { background: rgba(0,0,0,0.6); }
[data-bs-theme="dark"] .loading-content {
    background: #0f1625;
    border-color: #1f2937;
    color: #e5e7eb;
}


/* Dark theme: lower quick stats panel adjustments (avoid affecting footer) */
[data-bs-theme="dark"] main .bg-light {
    background: linear-gradient(180deg, #0f1625 0%, #0b1020 100%) !important;
    border-top: 1px solid #1f2937;
    border-bottom: 1px solid #1f2937;
}
[data-bs-theme="dark"] main .bg-light .card.bg-transparent .card-body h5 {
    color: #e5e7eb;
}


/* Dark theme: ensure footer with .bg-light becomes dark */
[data-bs-theme="dark"] footer.bg-light {
    background: #0f1625 !important;
    border-top: 1px solid #1f2937 !important;
}

/* Dark theme: neutral clear button */
[data-bs-theme="dark"] .filters-clear-btn {
    background: transparent;
    border-color: #374151;
    color: #e5e7eb;
}
[data-bs-theme="dark"] .filters-clear-btn:hover {
    background: #111827;
    border-color: #4b5563;
    color: #ffffff;
}


/* I18N overflow handling: allow wrapping on smaller screens */
.filters-panel .row.align-items-center {
    flex-wrap: wrap;
}

/* Prevent line breaks inside key controls */
.filters-panel .btn,
.filters-panel .form-check-label,
.filters-panel .input-group-text,
.filters-panel .form-select {
    white-space: nowrap;
}
/* Results header: keep single line; allow container to scroll horizontally if needed */
.sidebar .sticky-top .p-3 h6,
.sidebar .sticky-top .p-3 small {
    white-space: nowrap;
}


/* Dark theme: modal and statistics modal support */
[data-bs-theme="dark"] .modal-content {
    background: #0f1625;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}
[data-bs-theme="dark"] .modal-body {
    background: transparent;
    color: inherit;
}
[data-bs-theme="dark"] .modal-header {
    background: linear-gradient(135deg, #0a58ca 0%, #0b3b8a 100%);
    color: #e5e7eb;
    border-bottom: 1px solid #1f2937;
}
[data-bs-theme="dark"] .modal-header .btn-close {
    filter: invert(1) brightness(1.2);
}
[data-bs-theme="dark"] .stat-item {
    background: #121826;
    border: 1px solid #1f2937;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
[data-bs-theme="dark"] .stat-label {
    color: #9ca3af;
}
[data-bs-theme="dark"] .stat-value {
    color: #e5e7eb;
}

/* Popup Rating Styles */
.popup-rating {
    display: flex;
    align-items: center;
}

.popup-rating .text-warning {
    font-size: 0.9em;
}

.popup-rating .fa-star,
.popup-rating .fa-star-half-alt {
    color: #ffc107;
}

.popup-rating .fa-star.far {
    color: #dee2e6;
}

/* Google Reviews Styles */
.reviews-container {
    max-height: 400px;
    overflow-y: auto;
}

.review-card {
    border: 1px solid #e9ecef;
    transition: box-shadow 0.2s ease;
}

.review-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.review-card .card-body {
    padding: 1rem;
}

.review-card .text-warning {
    font-size: 1.1em;
    letter-spacing: 2px;
}

.review-card strong,
.review-card p {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Fix modal content overflow */
.modal-body .detail-value {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.modal-body .row > [class*="col-"] {
    overflow: hidden;
}

[data-bs-theme="dark"] .review-card {
    background: #121826;
    border-color: #1f2937;
}

[data-bs-theme="dark"] .review-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
