/* FreeLitterAT V0.1 - Main Stylesheet */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-panel: rgba(22, 33, 62, 0.95);
    --text-primary: #e8e8e8;
    --text-muted: #a0a0a0;
    --accent: #00d9ff;
    --accent-hover: #00c4e6;
    --danger: #ef476f;
    --success: #06d6a0;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Push MapLibre controls below the header */
.maplibregl-ctrl-top-left {
    top: 90px;
}

/* Splash Screen */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.splash-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.splash-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
}

.splash-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
}

.splash-title span {
    color: var(--accent);
}

.splash-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.splash-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
}

.splash-logos {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.splash-logo {
    background: var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 12px;
}

.splash-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.splash-enter, .splash-tour {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.splash-enter {
    background: var(--accent);
    color: var(--bg-primary);
}

.splash-enter:hover {
    background: var(--accent-hover);
}

.splash-tour {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.splash-footnote {
    margin-top: 30px;
    font-size: 12px;
    color: var(--text-muted);
}

.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
}

.lang-btn {
    background: var(--border);
    border: none;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.lang-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

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

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

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

/* Header */
.overlay-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    padding: 12px 20px;
    z-index: 100;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header h1 span {
    color: var(--accent);
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-btn {
    background: var(--border);
    border: none;
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.header-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

.badge {
    background: var(--accent);
    color: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.stats-row {
    display: flex;
    gap: 30px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.stat-val {
    color: var(--text-primary);
    font-weight: 600;
}

/* Layer Panel */
.layer-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 280px;
    max-height: calc(100vh - 120px);
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 15px;
    z-index: 100;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.layer-panel h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 13px;
}

.layer-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Side Panel */
.side-panel {
    position: fixed;
    top: 80px;
    left: -350px;
    width: 320px;
    max-height: calc(100vh - 120px);
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 15px;
    z-index: 100;
    overflow-y: auto;
    box-shadow: var(--shadow);
    transition: left 0.3s;
}

.side-panel.open {
    left: 20px;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.side-panel-header h2 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.layer-badge {
    background: var(--accent);
    color: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.side-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.props-table {
    width: 100%;
    font-size: 12px;
}

.props-table td {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.props-table td:first-child {
    color: var(--text-muted);
    width: 40%;
}

/* Bottom Controls */
.overlay-bottom {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    padding: 15px 25px;
    border-radius: 12px;
    z-index: 100;
    box-shadow: var(--shadow);
}

.time-display {
    text-align: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.time-val {
    color: var(--text-primary);
    font-weight: 600;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls .btn {
    background: var(--border);
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.controls .btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

#slider {
    width: 200px;
    cursor: pointer;
}

.speed-control {
    display: flex;
    gap: 5px;
}

.speed-btn {
    background: var(--border);
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.speed-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Charts */
.charts-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    margin-top: 15px;
    border-top: 1px solid var(--border);
}

.charts-container {
    padding-top: 10px;
}

.chart-section {
    margin-bottom: 20px;
}

.chart-section h4 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.chart-wrapper {
    height: 120px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-panel);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

/* Legend */
.legend-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.legend-bar {
    height: 10px;
    border-radius: 5px;
    margin: 10px 0 5px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* Data Info Panel */
.data-info-panel {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.data-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.data-info-header h3 {
    margin: 0;
    font-size: 14px;
}

.copy-btn {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}

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

.data-info-content {
    font-size: 12px;
    color: var(--text-muted);
}

.data-info-content p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.data-info-content a {
    color: var(--accent);
    text-decoration: none;
}

.data-info-content a:hover {
    text-decoration: underline;
}

.data-info-empty {
    font-style: italic;
}

.dataset-info p {
    margin-bottom: 10px;
}

/* Layer Item Rows */
.layer-item-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    min-width: 0;
}

.layer-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.layer-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.layer-name {
    cursor: pointer;
    flex: 1;
    font-size: 13px;
    transition: color 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.layer-name:hover {
    color: var(--accent);
}

/* Grid/Polygon layer icon - translucent fill with hard border */
.layer-icon-grid {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid;
    border-radius: 2px;
    vertical-align: middle;
}

/* WMS/Raster overlay icon - stacked lines representing raster data */
.layer-icon-wms {
    display: inline-block;
    width: 14px;
    height: 12px;
    vertical-align: middle;
    background: repeating-linear-gradient(
        to bottom,
        var(--accent) 0px,
        var(--accent) 2px,
        transparent 2px,
        transparent 4px
    );
    border-radius: 2px;
    opacity: 0.8;
}

/* Base Layers */
.base-layers {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.base-layers .layer-item {
    padding: 5px 0;
}

/* Header Lang Switcher (in header) */
.header-lang-switcher {
    display: flex;
    gap: 3px;
}

.header-lang-switcher .lang-btn {
    padding: 4px 8px;
    font-size: 11px;
}

/* Share Modal */
.share-modal {
    position: relative;
}

.share-modal h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.share-url-container {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    word-break: break-all;
    font-size: 12px;
    font-family: monospace;
}

.share-actions {
    display: flex;
    justify-content: flex-end;
}

.share-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.share-btn.primary {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Color Picker */
.layer-color-picker {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.layer-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.layer-color-picker::-webkit-color-swatch {
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Time Controls */
.time-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 20px;
}

.time-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.time-picker input[type="number"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.btn-small {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}

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

/* Year Filter Controls */
.year-filter-section {
    padding-bottom: 10px;
}

.year-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 20px;
}

.year-filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.year-filter-toggle input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

.year-range-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.year-slider-container {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.year-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.year-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.year-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
    pointer-events: auto;
}

.year-slider::-moz-range-track {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.year-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    pointer-events: auto;
}

.time-controls-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}

.animation-section {
    padding-top: 5px;
}

/* Multi-select Results */
.multi-select-results {
    max-height: 350px;
    overflow-y: auto;
}

.selection-stats {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.selection-stats h4 {
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 8px;
}

.layer-group {
    margin-bottom: 15px;
}

.layer-group h4 {
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.feature-list {
    font-size: 11px;
}

.feature-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.feature-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 12px;
}

.feature-coords {
    display: block;
    color: var(--text-muted);
    font-family: monospace;
    font-size: 10px;
    margin-top: 2px;
}

.feature-props {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.feature-props span {
    color: var(--text-muted);
    font-size: 10px;
}

.feature-more {
    padding: 8px 0;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.layer-group ul {
    list-style: none;
    padding-left: 0;
    font-size: 12px;
}

.layer-group li {
    padding: 3px 0;
    color: var(--text-muted);
}

/* Box Selection */
.box-select-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

/* Format Badges */
.format-badge {
    background: var(--border);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Selection Tools */
.selection-tools {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.selection-tools h3 {
    margin-bottom: 10px;
}

.selection-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.selection-btn {
    flex: 1;
    background: var(--border);
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.selection-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.selection-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.selection-btn.danger {
    background: var(--danger);
    color: white;
}

.selection-btn.danger:hover {
    background: #d63a5c;
}

.selection-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    min-height: 16px;
}

/* Share URL Input */
.share-url {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 12px;
}

.share-url:focus {
    outline: none;
}

/* Splash Badge Sub */
.splash-badge-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* Light Theme - softer colors */
[data-theme="light"] {
    --bg-primary: #e8eaed;
    --bg-secondary: #d8dce0;
    --bg-panel: rgba(240, 242, 245, 0.95);
    --text-primary: #2d3436;
    --text-muted: #636e72;
    --accent: #0077b6;
    --accent-hover: #0096c7;
    --border: rgba(0, 0, 0, 0.12);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Basemap Options */
.basemap-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.basemap-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
}

.basemap-option input[type="radio"] {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .layer-panel {
        width: 240px;
        right: 10px;
    }

    .side-panel {
        width: 280px;
    }

    .overlay-bottom {
        width: calc(100% - 40px);
        padding: 12px 15px;
    }

    #slider {
        width: 100px;
    }
}

/* ============================================
   Shepherd.js Tour Styling
   Simple, consistent with site panels
   ============================================ */

/* Reset all Shepherd defaults */
.shepherd-element,
.shepherd-element *,
.shepherd-element *::before,
.shepherd-element *::after {
    box-sizing: border-box;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.shepherd-element {
    max-width: 400px;
    z-index: 10000;
}

/* Main modal - match site's panel styling */
.shepherd-content {
    background: var(--bg-panel) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px;
    box-shadow: var(--shadow) !important;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.shepherd-header {
    padding: 16px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

/* Main tour title */
.shepherd-header::before {
    content: 'Derilinx Proof of Concept Tour';
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    padding-right: 30px;
}

/* Step title as sub-header */
.shepherd-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
    opacity: 0.8;
}

.shepherd-cancel-icon {
    position: absolute;
    top: 14px;
    right: 16px;
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 400;
    transition: color 0.2s;
    line-height: 1;
    cursor: pointer;
}

.shepherd-cancel-icon:hover {
    color: var(--danger);
}

.shepherd-text {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    padding: 12px 20px 16px;
}

.shepherd-text p {
    margin: 0 0 10px;
}

.shepherd-text p:last-child {
    margin-bottom: 0;
}

.shepherd-text strong {
    color: var(--accent);
    font-weight: 600;
}

.shepherd-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border) !important;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* When there are 2 buttons, space them apart */
.shepherd-footer:has(.shepherd-button:nth-child(2)) {
    justify-content: space-between;
}

.shepherd-button {
    background: var(--border) !important;
    border: none !important;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    transition: all 0.2s;
}

.shepherd-button:hover {
    background: var(--accent) !important;
    color: var(--bg-primary);
}

/* Primary button (Next/Done) */
.shepherd-button:last-child {
    background: var(--accent) !important;
    color: var(--bg-primary);
}

.shepherd-button:last-child:hover {
    background: var(--accent-hover) !important;
}

/* Hide the arrow completely for cleaner look */
.shepherd-arrow {
    display: none !important;
}

/* Modal overlay */
.shepherd-modal-overlay-container {
    background: rgba(0, 0, 0, 0.5) !important;
}

/* Highlighted element */
.shepherd-target-click-disabled {
    pointer-events: none;
}

.shepherd-enabled .shepherd-target {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}
