/* ============================================================
   LIGHT POLLUTION MAP — lightpollution.css
   Orbit | RiSa Astronomy
   ============================================================ */

/* --- Hero --- */
.lp-hero {
    text-align: center;
    margin-bottom: var(--space-8);
}

.lp-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

/* --- Map Section --- */
.lp-map-section {
    margin-bottom: var(--space-10);
}

.lp-map-controls {
    display: flex;
    align-items: flex-end;
    gap: var(--space-5);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.lp-control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.lp-year-select {
    min-width: 180px;
}

.lp-slider-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.lp-opacity-slider {
    width: 140px;
    accent-color: var(--color-blue-400);
    cursor: pointer;
}

.lp-opacity-value {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    min-width: 36px;
}

.lp-search-group {
    min-width: 200px;
}

.lp-search-row {
    display: flex;
    gap: var(--space-2);
}

.lp-search-input {
    flex: 1;
    font-size: var(--text-sm) !important;
}

.lp-search-results {
    position: relative;
}

.lp-search-result {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
}

.lp-search-result:hover {
    background: var(--bg-surface-raised);
}

/* --- Map Container --- */
.lp-map-wrap {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
}

.lp-map {
    width: 100%;
    height: 520px;
    background: #0d1117;
}

/* --- Map Legend --- */
.lp-map-legend {
    position: absolute;
    bottom: 24px;
    right: 12px;
    z-index: 1000;
    background: rgba(13, 17, 23, 0.92);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.lp-legend-title {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.lp-legend-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lp-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.lp-legend-swatch {
    width: 14px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* --- Map Attribution --- */
.lp-map-attribution {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
    text-align: center;
}

.lp-map-attribution a {
    color: var(--text-accent);
}

/* --- Leaflet Overrides for Dark Theme --- */
.lp-map .leaflet-control-zoom a {
    background: rgba(13, 17, 23, 0.9);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.lp-map .leaflet-control-zoom a:hover {
    background: rgba(30, 40, 55, 0.95);
}

.lp-map .leaflet-control-attribution {
    background: rgba(13, 17, 23, 0.7);
    color: var(--text-tertiary);
    font-size: 10px;
}

.lp-map .leaflet-control-attribution a {
    color: var(--text-accent);
}

.lp-map .leaflet-popup-content-wrapper {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.lp-map .leaflet-popup-tip {
    background: var(--bg-surface);
}

.lp-map .leaflet-popup-close-button {
    color: var(--text-secondary);
}

/* --- Bortle Section --- */
.lp-bortle-section {
    margin-bottom: var(--space-10);
}

.lp-bortle-section h2 {
    margin-bottom: var(--space-2);
}

.lp-bortle-section > .text-muted {
    margin-bottom: var(--space-6);
}

/* --- Bortle Grid --- */
.lp-bortle-grid {
    display: grid;
    gap: var(--space-5);
}

/* --- Bortle Card --- */
.lp-bortle-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    animation: fadeIn 0.4s ease-out both;
}

.lp-bortle-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.lp-bortle-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.lp-bortle-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    flex-shrink: 0;
    line-height: 1;
}

.lp-bortle-header-text {
    flex: 1;
    min-width: 0;
}

.lp-bortle-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: var(--space-1);
}

.lp-bortle-mag {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.lp-bortle-mag strong {
    color: var(--text-accent);
}

.lp-bortle-card-body {
    padding: var(--space-5);
}

.lp-bortle-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

/* --- Equipment tiers within card --- */
.lp-equipment-tiers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.lp-tier {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.lp-tier-label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

.lp-tier-label .tier-icon {
    font-size: var(--text-sm);
}

.lp-tier-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lp-tier-items li {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    padding: 2px 0;
    line-height: var(--leading-normal);
}

.lp-tier-items li::before {
    content: "\2022 ";
    color: var(--text-tertiary);
    margin-right: var(--space-1);
}

/* --- Visibility Section --- */
.lp-visibility-section {
    margin-bottom: var(--space-10);
}

.lp-visibility-section h2 {
    margin-bottom: var(--space-2);
}

.lp-visibility-section > .text-muted {
    margin-bottom: var(--space-6);
}

.lp-selector-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.lp-bortle-select {
    max-width: 320px;
}

/* --- Visibility Results --- */
.lp-visibility-results {
    min-height: 100px;
}

.lp-vis-empty {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.lp-vis-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    animation: fadeIn 0.3s ease-out;
}

.lp-vis-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.lp-vis-indicator {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.lp-vis-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-heading);
}

.lp-vis-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.lp-vis-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.lp-vis-col h4 {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-blue-300);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lp-vis-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lp-vis-col li {
    font-size: var(--text-sm);
    color: var(--text-primary);
    padding: var(--space-1) 0;
    line-height: var(--leading-normal);
}

.lp-vis-col li::before {
    content: "\2713 ";
    color: var(--color-green-400);
    margin-right: var(--space-1);
    font-weight: 700;
}

/* --- Stagger card animation --- */
.lp-bortle-card:nth-child(1) { animation-delay: 0s; }
.lp-bortle-card:nth-child(2) { animation-delay: 0.05s; }
.lp-bortle-card:nth-child(3) { animation-delay: 0.1s; }
.lp-bortle-card:nth-child(4) { animation-delay: 0.15s; }
.lp-bortle-card:nth-child(5) { animation-delay: 0.2s; }
.lp-bortle-card:nth-child(6) { animation-delay: 0.25s; }
.lp-bortle-card:nth-child(7) { animation-delay: 0.3s; }
.lp-bortle-card:nth-child(8) { animation-delay: 0.35s; }
.lp-bortle-card:nth-child(9) { animation-delay: 0.4s; }

/* --- Responsive --- */
@media (max-width: 767px) {
    .lp-map {
        height: 400px;
    }

    .lp-map-controls {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .lp-control-group {
        width: 100%;
    }

    .lp-year-select {
        min-width: 100%;
    }

    .lp-opacity-slider {
        width: 100%;
        flex: 1;
    }

    .lp-map-legend {
        bottom: 8px;
        right: 8px;
        padding: var(--space-2);
    }

    .lp-legend-item {
        font-size: 10px;
    }

    .lp-bortle-card-header {
        gap: var(--space-3);
        padding: var(--space-4);
    }

    .lp-bortle-number {
        width: 44px;
        height: 44px;
        font-size: var(--text-xl);
    }

    .lp-bortle-card-body {
        padding: var(--space-4);
    }

    .lp-equipment-tiers {
        grid-template-columns: 1fr;
    }

    .lp-selector-row {
        flex-direction: column;
        align-items: stretch;
    }

    .lp-bortle-select {
        max-width: 100%;
    }

    .lp-vis-columns {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .lp-vis-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}
