/**
 * Map page styles — scoped to .brightspot-map-page.
 *
 * Shared design tokens (colors, typography, form inputs) live in global.css.
 * This file owns layout + components specific to the map view: container,
 * sidebar, filters, list, cards, Mapbox popup styling, and the legend.
 */

/* Map page sets the body background dark (doesn't affect other pages) */
body[data-page='map'] {
    background: var(--bs-map-bg);
}

.brightspot-map-page {
    display: flex;
    flex-direction: row;
    height: calc(100vh - var(--bs-header-height));
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--bs-text);
    letter-spacing: 0.01em;
}

/* ==========================================================================
   Map container
   ========================================================================== */

.brightspot-map-container {
    flex: 1;
    position: relative;
}

.brightspot-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
    background: var(--bs-map-bg);
}

.mapboxgl-ctrl-group {
    background: var(--bs-cream) !important;
    border: 1px solid var(--bs-border) !important;
    box-shadow: 0 2px 8px rgba(30, 24, 18, 0.1) !important;
    border-radius: 0 !important;
}

.mapboxgl-ctrl-group button {
    border-bottom: 1px solid var(--bs-border) !important;
}

.mapboxgl-ctrl-group button:last-child {
    border-bottom: none !important;
}

.mapboxgl-ctrl-group button:hover {
    background-color: var(--bs-cream-dark) !important;
}

/* ==========================================================================
   Legend
   ========================================================================== */

.brightspot-map-legend {
    position: absolute;
    bottom: 32px;
    left: 16px;
    display: flex;
    gap: 24px;
    padding: 14px 20px;
    background: var(--bs-cream);
    border: 1px solid var(--bs-border);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-text-muted);
    z-index: 1;
    opacity: 0;
    animation: brightspot-legend-in 0.6s var(--transition-slow) forwards;
    animation-delay: 0.8s;
}

@keyframes brightspot-legend-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.brightspot-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brightspot-legend-pin {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.brightspot-legend-vturm       { background: var(--bs-vturm);       box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.3); }
.brightspot-legend-gardenturm  { background: var(--bs-gardenturm);  box-shadow: 0 0 0 2px rgba(125, 154, 111, 0.3); }
.brightspot-legend-observaturm { background: var(--bs-observaturm); box-shadow: 0 0 0 2px rgba(255, 102, 2, 0.3); }

/* ==========================================================================
   Sidebar
   ========================================================================== */

.brightspot-sidebar {
    width: 400px;
    height: 100%;
    background: var(--bs-bg);
    border-left: 1px solid var(--bs-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brightspot-filters {
    padding: 32px 28px 28px;
    border-bottom: 1px solid var(--bs-border);
    background: var(--bs-bg);
}

.brightspot-filters h3 {
    margin: 0 0 24px;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--bs-text);
    letter-spacing: 0.01em;
}

.brightspot-filter-group {
    margin-bottom: 20px;
}

.brightspot-filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--bs-text-muted);
}

.brightspot-filter-select {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--bs-text);
    border: 1px solid var(--bs-border);
    border-radius: 0;
    background: var(--bs-bg);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23b59766' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.brightspot-filter-select:hover {
    border-color: var(--bs-gold);
}

.brightspot-filter-select:focus {
    outline: none;
    border-color: var(--bs-gold);
    box-shadow: 0 0 0 3px rgba(181, 151, 102, 0.15);
}

.brightspot-clear-filters {
    width: 100%;
    padding: 12px 20px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-gold-dark);
    background: transparent;
    border: 1px solid var(--bs-border);
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition-base);
}

.brightspot-clear-filters:hover {
    color: var(--bs-brown);
    border-color: var(--bs-gold);
    background: rgba(181, 151, 102, 0.08);
}

/* ==========================================================================
   List
   ========================================================================== */

.brightspot-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.brightspot-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--bs-border);
    background: var(--bs-bg-alt);
}

.brightspot-count-label {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-text-light);
}

.brightspot-count-label #brightspot-count {
    color: var(--bs-gold-dark);
    font-weight: 600;
}

.brightspot-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    min-height: 0;
}

.brightspot-list-container::-webkit-scrollbar { width: 6px; }
.brightspot-list-container::-webkit-scrollbar-track { background: var(--bs-cream-dark); }
.brightspot-list-container::-webkit-scrollbar-thumb { background: var(--bs-border); border-radius: 3px; }
.brightspot-list-container::-webkit-scrollbar-thumb:hover { background: var(--bs-gold); }

/* ==========================================================================
   Card
   ========================================================================== */

.brightspot-card {
    padding: 20px;
    background: var(--bs-bg);
    border: 1px solid var(--bs-border);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.brightspot-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--transition-base);
}

.brightspot-card:hover {
    border-color: var(--bs-gold);
    box-shadow: 0 4px 16px rgba(30, 24, 18, 0.08);
}

.brightspot-card:hover::before,
.brightspot-card.active::before {
    background: var(--bs-gold);
}

.brightspot-card.active {
    border-color: var(--bs-gold);
    background: rgba(181, 151, 102, 0.04);
}

.brightspot-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.brightspot-card-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    color: var(--bs-brown);
    flex: 1;
    line-height: 1.3;
}

.brightspot-card-type,
.brightspot-popup-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    white-space: nowrap;
    border-radius: 0;
}

.brightspot-card-type::before,
.brightspot-popup-type::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.brightspot-card-type--vturm,
.brightspot-popup-type--vturm       { background: rgba(201, 169, 98, 0.12); color: #9a7d3d; }
.brightspot-card-type--vturm::before,
.brightspot-popup-type--vturm::before { background: var(--bs-vturm); }

.brightspot-card-type--gardenturm,
.brightspot-popup-type--gardenturm       { background: rgba(125, 154, 111, 0.12); color: #5a7350; }
.brightspot-card-type--gardenturm::before,
.brightspot-popup-type--gardenturm::before { background: var(--bs-gardenturm); }

.brightspot-card-type--observaturm,
.brightspot-popup-type--observaturm       { background: rgba(255, 102, 2, 0.12); color: #b85a16; }
.brightspot-card-type--observaturm::before,
.brightspot-popup-type--observaturm::before { background: var(--bs-observaturm); }

.brightspot-card-location {
    font-size: 13px;
    color: var(--bs-text-muted);
    margin-bottom: 4px;
    line-height: 1.5;
}

.brightspot-card-owner {
    font-size: 12px;
    color: var(--bs-text-light);
    font-style: italic;
}

/* ==========================================================================
   Mapbox popup
   ========================================================================== */

.mapboxgl-popup {
    max-width: 300px !important;
}

.mapboxgl-popup-content {
    padding: 0;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(30, 24, 18, 0.2);
    border: 1px solid var(--bs-border);
    background: var(--bs-cream);
}

.mapboxgl-popup-close-button {
    font-size: 20px;
    padding: 8px 12px;
    color: var(--bs-text-light);
    transition: color var(--transition-fast);
}

.mapboxgl-popup-close-button:hover {
    color: var(--bs-gold);
    background: transparent;
}

.mapboxgl-popup-tip {
    border-top-color: var(--bs-cream) !important;
}

.brightspot-popup {
    padding: 20px 24px;
}

.brightspot-popup-type {
    margin-bottom: 12px;
    padding: 5px 12px;
}

.brightspot-popup-title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: var(--bs-brown);
    line-height: 1.3;
}

.brightspot-popup-location {
    font-size: 13px;
    color: var(--bs-text-muted);
    margin-bottom: 6px;
    line-height: 1.5;
}

.brightspot-popup-owner {
    font-size: 12px;
    color: var(--bs-text-light);
    font-style: italic;
}

.brightspot-popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--bs-border);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bs-gold-dark);
    text-decoration: none;
    transition: color var(--transition-fast);
    width: 100%;
}

.brightspot-popup-link:hover { color: var(--bs-brown); }
.brightspot-popup-link::after {
    content: '→';
    transition: transform var(--transition-fast);
}
.brightspot-popup-link:hover::after { transform: translateX(4px); }

/* ==========================================================================
   Loading / empty
   ========================================================================== */

.brightspot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--bs-text-light);
    font-size: 13px;
    letter-spacing: 0.04em;
}

.brightspot-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    margin-top: 16px;
    border: 1px solid var(--bs-border);
    border-top-color: var(--bs-gold);
    border-radius: 50%;
    animation: bs-spin 1s linear infinite;
}

.brightspot-empty {
    padding: 60px 28px;
    text-align: center;
    color: var(--bs-text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {
    .brightspot-map-page {
        flex-direction: column;
        height: auto;
    }

    .brightspot-map-container {
        height: 55vh;
        min-height: 400px;
    }

    .brightspot-sidebar {
        width: 100%;
        height: 55vh;
        border-left: none;
        border-top: 1px solid var(--bs-border);
    }

    .brightspot-map-legend {
        bottom: 16px;
        left: 12px;
        gap: 16px;
        padding: 10px 14px;
        font-size: 10px;
    }
}

@media (max-width: 575px) {
    .brightspot-filters {
        padding: 24px 20px;
    }

    .brightspot-filters h3 {
        font-size: 20px;
    }

    .brightspot-list-header {
        padding: 14px 20px;
    }

    .brightspot-list-container {
        padding: 12px 16px;
    }

    .brightspot-card {
        padding: 16px;
    }

    .brightspot-card-title {
        font-size: 16px;
    }

    .brightspot-map-legend {
        flex-direction: column;
        gap: 10px;
    }
}

/* ==========================================================================
   Rollover ranking box
   ========================================================================== */

.brightspot-hover .brightspot-popup-title {
    margin-bottom: 8px;
}

.brightspot-rank {
    font-size: 12px;
    color: var(--bs-text-muted);
    line-height: 1.7;
}

.brightspot-rank > div:first-child {
    color: var(--bs-text);
    font-weight: 600;
}
