/* Brokers Map Page Styles */
/* Using existing site CSS variables from style.css */

/* Map Container */
.map-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    margin: 0;
}

.map-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.map-header>div:first-child {
    flex: 1;
    min-width: 200px;
}

.map-header h1 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.3;
}

.map-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.map-stats span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-stats .stat-value {
    font-weight: 700;
    color: var(--secondary-color);
}

/* Search and Filter Controls */
.map-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.map-search {
    position: relative;
}

.map-search input {
    padding: 0.625rem 1rem;
    padding-left: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    width: 280px;
    background: white;
    transition: all 0.2s;
}

.map-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(65, 123, 90, 0.2);
}

.map-search::before {
    content: "🔍";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

.state-filter {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.state-filter:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

#brokers-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* State Markers */
.state-marker-container {
    background: transparent !important;
    border: none !important;
}

.state-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #417b5a 0%, #2d5940 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.state-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.state-marker.small {
    width: 40px;
    height: 40px;
}

.state-marker.medium {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #4b3f72 0%, #352b52 100%);
}

.state-marker.large {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #1f2041 0%, #0f1020 100%);
}

.state-marker .count {
    font-size: 0.95rem;
    line-height: 1;
}

.state-marker.medium .count {
    font-size: 1.1rem;
}

.state-marker.large .count {
    font-size: 1.25rem;
}

.state-marker .label {
    font-size: 0.65rem;
    opacity: 0.9;
    margin-top: 1px;
}

.state-marker.medium .label,
.state-marker.large .label {
    font-size: 0.7rem;
}

/* Selected state marker */
.state-marker-container.selected .state-marker {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(65, 123, 90, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: #fff;
}

/* Results Panel */
.results-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: var(--bg-white);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.results-panel.active {
    display: flex;
}

.results-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: white;
}

.results-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.results-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.results-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.results-list {
    flex: 1;
    overflow-y: auto;
}

/* City headers in results */
.city-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.city-header.state-section {
    background: linear-gradient(90deg, var(--bg-light) 0%, #e8f5e9 100%);
}

.city-header .city-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.city-header .city-count {
    background: var(--secondary-color);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.8rem;
}

/* Broker items */
.results-item {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.results-item:hover {
    background: var(--hover-bg);
}

.results-item .broker-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.results-item .broker-location {
    font-size: 0.85rem;
    color: var(--text-light);
}

.results-item .filer-code {
    display: inline-block;
    background: var(--bg-light);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.results-item .broker-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.35rem;
}

.results-item .contact-link {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-decoration: none;
}

.results-item .contact-link:hover {
    text-decoration: underline;
}

/* More results link */
.results-more {
    padding: 0.75rem 1.25rem;
    color: var(--secondary-color);
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.results-more:hover {
    background: var(--hover-bg);
    text-decoration: underline;
}

/* No results */
.no-results {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--text-light);
}

/* State Legend */
.state-legend {
    position: absolute;
    bottom: 2rem;
    left: 1rem;
    background: var(--bg-white);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 0.85rem;
}

.state-legend h4 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-dot.small {
    background: linear-gradient(135deg, #417b5a 0%, #2d5940 100%);
}

.legend-dot.medium {
    background: linear-gradient(135deg, #4b3f72 0%, #352b52 100%);
}

.legend-dot.large {
    background: linear-gradient(135deg, #1f2041 0%, #0f1020 100%);
}

/* Loading State */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
}

.map-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .map-header {
        flex-direction: column;
        align-items: stretch;
    }

    .map-controls {
        flex-direction: column;
    }

    .map-search input {
        width: 100%;
    }

    .state-filter {
        width: 100%;
    }

    .results-panel {
        width: 100%;
        height: 50%;
        top: auto;
        bottom: 0;
        border-top: 2px solid var(--border-color);
    }

    .state-legend {
        display: none;
    }

    .map-stats {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
}