/* ========================================
   Interactive Prop Firm Map
   ======================================== */

.map-page {
    padding-top: 1rem;
}

/* Header */
.map-header {
    margin-bottom: 1.5rem;
}
.map-title {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}
.map-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    margin: 0;
}

/* Region Stats Bar */
.region-stats-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.region-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 1rem;
    cursor: default;
}
.region-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
    line-height: 1.2;
}
.region-name {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters */
.map-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1rem;
}
.map-filter-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.map-filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.map-filter-btn.active {
    background: #7A95F8;
    border-color: #7A95F8;
    color: #fff;
    font-weight: 600;
}

/* Map + Sidebar Layout */
.map-layout {
    display: flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
    min-height: 500px;
}
.map-container {
    flex: 1;
    min-height: 500px;
}
#firmMap {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border-radius: 0;
    z-index: 1;
}

/* Override Leaflet defaults */
.leaflet-control-zoom a {
    background: #fff !important;
    color: #333 !important;
    border-color: #e5e7eb !important;
}
.leaflet-control-zoom a:hover {
    background: #f0f0f5 !important;
}
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #888 !important;
    font-size: 10px !important;
}
.leaflet-control-attribution a {
    color: #6366f1 !important;
}

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

/* Popup Styles */
.firm-popup .leaflet-popup-content-wrapper {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    color: #333;
}
.firm-popup .leaflet-popup-tip {
    background: #fff;
    border: 1px solid #e5e7eb;
}
.firm-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
}
.map-popup {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    min-width: 200px;
}
.map-popup-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: #f8f9fa;
    padding: 4px;
    flex-shrink: 0;
}
.map-popup-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.map-popup-name {
    font-size: 0.95rem;
    color: #1a1a2e;
    font-weight: 600;
}
.map-popup-country {
    font-size: 0.75rem;
    color: #888;
}
.map-popup-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
}
.map-popup-stats span {
    font-size: 0.75rem;
    color: #666;
}
.map-popup-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
}
.map-popup-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}

/* Sidebar */
.map-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    max-height: 500px;
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 0;
}
.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}
.sidebar-count {
    font-size: 0.8rem;
    color: #888;
}
.sidebar-search {
    padding: 10px 16px;
}
.sidebar-search-input {
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 12px;
    color: #333;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.sidebar-search-input::placeholder {
    color: #aaa;
}
.sidebar-search-input:focus {
    border-color: #6366f1;
}
.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 8px;
}
.sidebar-list::-webkit-scrollbar {
    width: 4px;
}
.sidebar-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* Country groups in sidebar */
.sidebar-country {
    border-bottom: 1px solid #f1f3f5;
}
.country-header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.country-header:hover {
    background: #f8f9fa;
}
.country-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a1a2e;
}
.country-count {
    font-size: 0.75rem;
    color: #888;
    background: #f1f3f5;
    padding: 1px 8px;
    border-radius: 10px;
    margin-right: 8px;
}
.country-chevron {
    color: #aaa;
    transition: transform 0.2s;
    font-size: 1rem;
}

/* Firm items in sidebar */
.sidebar-firm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 6px 28px;
    text-decoration: none;
    transition: background 0.15s;
}
.sidebar-firm:hover {
    background: #f0f0f5;
    text-decoration: none;
}
.sidebar-firm-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.sidebar-firm-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    background: #f8f9fa;
    padding: 2px;
    flex-shrink: 0;
}
.sidebar-firm-logo-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}
.sidebar-firm-name {
    display: block;
    font-size: 0.8rem;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.sidebar-firm-meta {
    display: block;
    font-size: 0.7rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.sidebar-firm-score {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Section heading */
.section-heading {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

/* Country Detail Cards */
.country-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.country-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
    transition: border-color 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.country-card:hover {
    border-color: #6366f1;
}
.country-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.country-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}
.country-card-count {
    font-size: 0.8rem;
    color: #888;
}
.country-card-firms {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.country-card-firm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}
.country-card-firm:hover {
    background: #f8f9fa;
    text-decoration: none;
}
.country-card-firm img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
}
.country-card-firm span {
    font-size: 0.85rem;
    color: #333;
}
.country-card-more {
    font-size: 0.8rem;
    color: #888;
    padding-left: 30px;
    font-style: italic;
}

/* CTA Section */
.map-cta {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.map-cta h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}
.map-cta p {
    color: #666;
    margin-bottom: 1.25rem;
}
.map-cta-links {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.map-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e5e7eb;
}
.map-cta-btn:hover {
    background: #f0f0f5;
    color: #1a1a2e;
    text-decoration: none;
}
.map-cta-btn.primary {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.map-cta-btn.primary:hover {
    background: #4f46e5;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 991px) {
    .map-layout {
        flex-direction: column;
    }
    .map-sidebar {
        width: 100%;
        max-height: 350px;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }
    .map-container {
        min-height: 350px;
    }
    #firmMap {
        min-height: 350px;
    }
}

@media (max-width: 767px) {
    .map-title {
        font-size: 1.5rem;
    }
    .map-subtitle {
        font-size: 0.9rem;
    }
    .region-stats-bar {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    .region-count {
        font-size: 1.2rem;
    }
    .region-name {
        font-size: 0.65rem;
    }
    .map-container {
        min-height: 300px;
    }
    #firmMap {
        min-height: 300px;
    }
    .map-sidebar {
        max-height: 300px;
    }
    .country-cards-grid {
        grid-template-columns: 1fr;
    }
    .map-cta {
        padding: 1.25rem;
    }
    .map-cta-links {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 375px) {
    .map-filters {
        gap: 0.35rem;
    }
    .map-filter-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
}
