/* Treatment Centers Map - Insightec Design Redesign */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Primary Colors */
    --tcm-primary: #1e40af;
    /* Blue 800 - Deep Blue for headers */
    --tcm-accent: #2563eb;
    /* Blue 600 - Bright Blue for links/UI */
    --tcm-accent-hover: #1d4ed8;
    /* Blue 700 */

    /* Neutral Colors */
    --tcm-bg-page: #ffffff;
    --tcm-bg-surface: #ffffff;
    --tcm-text-main: #334155;
    /* Slate 700 */
    --tcm-text-secondary: #64748b;
    /* Slate 500 */
    --tcm-border: #e2e8f0;

    /* UI Elements */
    --tcm-radius-sm: 6px;
    --tcm-radius-md: 12px;
    --tcm-radius-lg: 16px;

    /* Shadows */
    --tcm-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --tcm-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tcm-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --tcm-shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.tcm-container {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    max-width: 1280px;
    margin: 0 auto;
    background: var(--tcm-bg-page);
    color: var(--tcm-text-main);
}

/* Hide Leaflet attribution */
.leaflet-control-attribution {
    display: none !important;
}

/* Custom marker */
.tcm-marker {
    background: none !important;
    border: none !important;
}

/* --- Filter Section --- */
.tcm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 32px;
    background: var(--tcm-bg-surface);
    border-bottom: 1px solid var(--tcm-border);
    align-items: flex-end;
}

.tcm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 240px;
    flex: 1;
}

.tcm-filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tcm-text-secondary);
}

/* Steps badges */
.tcm-filter-group label[data-step]::before {
    content: attr(data-step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--tcm-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
}

.tcm-filter-group select,
.tcm-filter-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--tcm-text-main);
    background-color: var(--tcm-bg-surface);
    border: 1px solid var(--tcm-border);
    border-radius: var(--tcm-radius-sm);
    box-shadow: var(--tcm-shadow-sm);
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.tcm-filter-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.tcm-filter-group select:hover,
.tcm-filter-group input:hover {
    border-color: #cbd5e1;
}

.tcm-filter-group select:focus,
.tcm-filter-group input:focus {
    outline: none;
    border-color: var(--tcm-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tcm-filter-group select:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* Search specific */
.tcm-search-group {
    flex: 1.5;
    /* Search takes a bit more space */
}

.tcm-search-group label::before {
    display: none;
}

/* --- Filter Bar --- */
.tcm-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--tcm-border);
    flex-wrap: wrap;
    min-height: 24px;
}

.tcm-filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--tcm-border);
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tcm-text-secondary);
    box-shadow: var(--tcm-shadow-sm);
}

.tcm-filter-tag span {
    color: var(--tcm-primary);
    font-weight: 600;
    margin-left: 6px;
}

.tcm-clear-filter {
    color: var(--tcm-accent);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    margin-left: auto;
    /* Push to right if needed, or keeping it next to tags */
}

.tcm-clear-filter:hover {
    color: var(--tcm-accent-hover);
    text-decoration: underline;
}

.tcm-results-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--tcm-text-secondary);
    margin-left: auto;
}

/* --- Map --- */
.tcm-map {
    height: 500px;
    position: relative;
    z-index: 1;
    border-bottom: 1px solid var(--tcm-border);
}

.tcm-reset-zoom {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 10px 16px;
    background: white;
    color: var(--tcm-text-main);
    border: 1px solid var(--tcm-border);
    border-radius: var(--tcm-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--tcm-shadow-md);
    transition: all 0.2s;
}

.tcm-reset-zoom:hover {
    background: #f8fafc;
    box-shadow: var(--tcm-shadow-lg);
}

/* --- Map Popup --- */
.leaflet-popup-content-wrapper {
    border-radius: var(--tcm-radius-md);
    box-shadow: var(--tcm-shadow-lg);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 280px !important;
}

.tcm-popup {
    padding: 16px;
}

.tcm-popup strong {
    display: block;
    color: var(--tcm-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.tcm-popup p {
    margin: 4px 0 12px;
    color: var(--tcm-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.tcm-popup a {
    display: inline-block;
    color: var(--tcm-accent);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    margin-right: 12px;
}

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

.tcm-download-btn {
    display: inline-flex;
    text-decoration: none;
    background-color: transparent;
    border: 2px solid var(--tcm-accent);
    color: var(--tcm-accent);
    padding: 12px 24px;
    font-size: 16px;
}

.tcm-download-btn:hover {
    background-color: var(--tcm-accent);
    color: white;
    text-decoration: none;
}

/* --- Contact Modal --- */
.tcm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tcm-modal-overlay.open {
    display: flex;
    opacity: 1;
}

.tcm-modal {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: var(--tcm-radius-md);
    box-shadow: var(--tcm-shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: tcm-slide-up 0.3s ease-out;
}

@keyframes tcm-slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.tcm-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--tcm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tcm-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--tcm-primary);
}

.tcm-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--tcm-text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.tcm-modal-close:hover {
    color: var(--tcm-primary);
}

.tcm-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.tcm-form-group {
    margin-bottom: 16px;
}

.tcm-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--tcm-primary);
    font-size: 14px;
}

.tcm-form-group input,
.tcm-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: var(--tcm-radius-sm);
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.tcm-form-group input:focus,
.tcm-form-group textarea:focus {
    outline: none;
    border-color: var(--tcm-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tcm-radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.tcm-radio-label {
    font-weight: normal !important;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.tcm-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    background: var(--tcm-accent);
    color: white;
    border: none;
    border-radius: var(--tcm-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.tcm-btn:hover {
    background: var(--tcm-accent-hover);
}

.tcm-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* --- List Section --- */
.tcm-list-section {
    padding: 40px 32px;
    background: var(--tcm-bg-page);
}

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

.tcm-list-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--tcm-primary);
    margin: 0;
}

.tcm-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* --- Cards --- */
.tcm-card {
    background: white;
    border-radius: var(--tcm-radius-md);
    border: 1px solid var(--tcm-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    /* Added subtle shadow to separate from white background */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.tcm-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tcm-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background-color: transparent;
    color: var(--tcm-primary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: 9999px;
    border: 1px solid var(--tcm-primary);
}

.tcm-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tcm-shadow-hover);
    border-color: #cbd5e1;
    z-index: 2;
}

.tcm-card-header {
    margin-bottom: 12px;
}

.tcm-card-name {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--tcm-primary);
    line-height: 1.4;
}

.tcm-card-body {
    flex: 1;
}

.tcm-card-address {
    font-size: 14px;
    color: var(--tcm-text-secondary);
    line-height: 1.6;
    margin: 0 0 20px 0;
}

/* Staff Items */
.tcm-staff-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
}

.tcm-staff-item {
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: var(--tcm-radius-sm);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.tcm-staff-role {
    font-weight: 600;
    color: var(--tcm-primary);
}

.tcm-staff-name {
    color: var(--tcm-text-secondary);
}

/* Card Footer */
.tcm-card-footer {
    padding-top: 20px;
    margin-top: auto;
    border-top: 1px solid var(--tcm-border);
    display: flex;
    flex-direction: column;
    /* Stacked links like original but cleaner */
    gap: 12px;
}

.tcm-card-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tcm-accent);
    text-decoration: none;
    transition: color 0.2s;
}

.tcm-card-link svg {
    width: 18px;
    height: 18px;
    color: var(--tcm-accent);
    stroke-width: 2px;
}

.tcm-card-link:hover {
    color: var(--tcm-accent-hover);
    text-decoration: underline;
    background: none;
    border-color: transparent;
}

/* Contact Center button - reset to match link style */
button.tcm-card-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

/* Loading & No Results */
.tcm-loading,
.tcm-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--tcm-text-secondary);
}

.tcm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--tcm-accent);
    border-radius: 50%;
    animation: tcm-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.tcm-no-results-icon {
    width: 48px;
    height: 48px;
    color: #cbd5e1;
    margin-bottom: 24px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.tcm-error {
    margin: 40px;
    padding: 24px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: var(--tcm-radius-md);
    text-align: center;
}

@keyframes tcm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .tcm-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tcm-filters {
        flex-direction: column;
        align-items: stretch;
        padding: 24px;
    }

    .tcm-filters .tcm-filter-group {
        min-width: 0;
    }

    .tcm-filter-bar {
        padding: 16px 24px;
    }

    .tcm-list {
        grid-template-columns: 1fr;
    }

    .tcm-card {
        padding: 20px;
    }

    .tcm-map {
        height: 400px;
    }
}