/* Aigen Nexus - Dark Theme */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-overlay: rgba(10, 10, 10, 0.85);

    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #606060;

    --border-color: #2a2a2a;
    --border-light: #3a3a3a;

    --accent-green: #25B99E;
    --accent-green-dark: #11545C;
    --accent-lime: #a2f705;
    --accent-yellow: #f7e305;
    --accent-orange: #f78a05;
    --accent-red: #ff0000;

    --font-mono: 'JetBrains Mono', monospace;

    --header-height: 48px;
    --timeline-height: 56px;
}

/* ==================== LOGIN SCREEN ==================== */

#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
}

#login-screen.hidden {
    display: none;
}

.login-video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 0;
}

.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 1;
}

.login-container {
    position: relative;
    z-index: 2;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.login-container.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: auto;
    height: 48px;
    margin-bottom: 12px;
    object-fit: contain;
}

.login-header h1 {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.login-header h1 .login-os {
    color: var(--accent-green);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-field input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.login-field input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(37, 185, 158, 0.15);
}

.login-field input::placeholder {
    color: var(--text-muted);
}

.login-error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.login-error.hidden {
    display: none;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-green);
    border: none;
    border-radius: 6px;
    color: #000;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
    background: #2fd4b5;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 24px;
}

/* ==================== BASE STYLES ==================== */

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

body {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
#header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.header-left .logo {
    height: 20px;
    width: auto;
}

.header-left h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 29px;
    font-weight: 400;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Old #farm-select removed - now using custom dropdown */


#loading-indicator {
    color: var(--accent-lime);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hidden {
    display: none !important;
}

/* Date Range Picker */
.date-range-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    margin-right: 8px;
    border-right: 1px solid var(--border-color);
}

.date-range-picker label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-range-picker input[type="date"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.date-range-picker input[type="date"]:hover:not(:disabled) {
    border-color: #25B99E;
}

.date-range-picker input[type="date"]:focus {
    outline: none;
    border-color: #25B99E;
    box-shadow: 0 0 0 2px rgba(37, 185, 158, 0.2);
}

.date-range-picker input[type="date"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

/* Style the date picker calendar icon */
.date-range-picker input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.date-range-picker input[type="date"]:disabled::-webkit-calendar-picker-indicator {
    cursor: not-allowed;
}

/* Profile Menu */
.profile-menu {
    position: relative;
}

.profile-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.profile-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 10100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: #d0d0d0;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: #3a3a3a;
    color: #ffffff;
}

.dropdown-divider {
    height: 1px;
    background: #3a3a3a;
    margin: 4px 0;
}

/* Custom Select Dropdowns */
.custom-select {
    position: relative;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.custom-select-trigger:hover {
    border-color: var(--border-light);
}

.custom-select-trigger:focus {
    outline: none;
    border-color: #25B99E;
}

.custom-select-arrow {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 1002;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.custom-select-option {
    padding: 8px 12px;
    color: #d0d0d0;
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.custom-select-option:hover {
    background: #3a3a3a;
    color: #ffffff;
}

.custom-select-option.selected {
    color: #25B99E;
}

.custom-select-option.disabled {
    color: var(--text-muted);
    opacity: 0.5;
    cursor: not-allowed;
}

.custom-select-option.disabled:hover {
    background: transparent;
    color: var(--text-muted);
}

/* Speed select specific - opens upward */
.speed-select-wrapper {
    flex-shrink: 0;
}

.speed-select-wrapper .custom-select-trigger {
    padding: 4px 8px;
    font-size: 11px;
}

.speed-select-wrapper .custom-select-options {
    min-width: 70px;
    top: auto;
    bottom: calc(100% + 4px);
}

.speed-select-wrapper .custom-select-option {
    font-size: 11px;
    padding: 6px 10px;
}

/* Farm select specific */
.farm-select-wrapper .custom-select-trigger {
    min-width: 200px;
}

.farm-select-wrapper .custom-select-options {
    min-width: 200px;
    max-height: 480px;
    overflow-y: auto;
}

/* Main Content */
#main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
}

/* Map Overlays */
.map-overlay {
    position: absolute;
    background: var(--bg-overlay);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    backdrop-filter: blur(8px);
    z-index: 1000;
}

/* Layer Controls */
#layer-controls {
    bottom: 16px;
    left: 16px;
}

.control-group {
    margin-bottom: 12px;
}

.control-group:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.control-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.checkbox-label:hover,
.radio-label:hover {
    color: var(--text-primary);
}

.checkbox-label input,
.radio-label input {
    display: none;
}

.checkmark,
.radiomark {
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.checkmark {
    border-radius: 3px;
}

.radiomark {
    border-radius: 50%;
}

.checkbox-label input:checked + .checkmark {
    background: #25B99E;
    border-color: #25B99E;
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    font-size: 10px;
    color: var(--bg-primary);
}

.radio-label input:checked + .radiomark {
    border-color: #25B99E;
}

.radio-label input:checked + .radiomark::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #25B99E;
    border-radius: 50%;
}

/* Weather Panel */
#weather-panel {
    top: 16px;
    left: 16px;
    min-width: 200px;
}

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

#weather-panel h3 {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
}

#weather-panel .unit-toggle {
    display: flex;
    gap: 4px;
}

#weather-panel .unit-btn {
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}

#weather-panel .unit-btn:hover {
    border-color: var(--border-light);
}

#weather-panel .unit-btn.active {
    background: #25B99E;
    color: var(--bg-primary);
    border-color: #25B99E;
}

/* Stats Panel */
#stats-panel {
    top: 16px;
    right: 16px;
    min-width: 210px;
}

#stats-panel h3 {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

#stats-panel h4 {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 8px 0;
}

#stats-panel h4 + div + h4 {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
}

.stat-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 600;
    cursor: help;
    vertical-align: middle;
    transition: all 0.15s;
    position: relative;
}

.stat-info:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-primary);
}

.stat-info::after {
    content: attr(data-tooltip);
    position: absolute;
    right: -8px;
    bottom: calc(100% + 8px);
    transform: none;
    width: 200px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 100;
}

.stat-info:hover::after {
    opacity: 1;
    visibility: visible;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
}

.stat-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Color Legend */
#color-legend,
#weed-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-label {
    color: var(--text-secondary);
    flex: 1;
}

.legend-value {
    color: var(--text-primary);
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

/* Segment Details */
#segment-details {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 340px;
    padding: 16px 52px 16px 16px;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

#segment-details h3 {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

#details-content {
    font-size: 12px;
}

#details-content .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

#details-content .detail-row:last-child {
    border-bottom: none;
}

#details-content .detail-label {
    color: var(--text-secondary);
}

#details-content .detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Timeline */
#timeline {
    height: var(--timeline-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    flex-shrink: 0;
}

.timeline-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.timeline-btn:hover {
    background: var(--bg-primary);
    border-color: #25B99E;
}

.timeline-btn:active {
    transform: scale(0.95);
}

#slider-container {
    flex: 1;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    margin: 0 8px;
}

#time-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #11545C;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

#time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#time-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Slider tooltip that follows the thumb during playback */
#slider-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#slider-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border-color);
}

#time-display {
    min-width: 140px;
    text-align: right;
}

#current-time {
    font-size: 13px;
    color: #25B99E;
    font-weight: 500;
}

/* Old .speed-control removed - now using custom dropdown */

/* Leaflet Overrides */
.leaflet-container {
    background: var(--bg-primary);
    font-family: var(--font-mono);
}

.leaflet-control-zoom {
    border: none !important;
}

.leaflet-control-zoom a {
    background: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 30px !important;
    font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-secondary) !important;
    border-color: var(--border-light) !important;
}

.leaflet-control-zoom-in {
    border-radius: 4px 4px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 4px 4px !important;
    border-top: none !important;
}

/* Reset View Control */
.reset-view-control {
    margin-bottom: 8px !important;
}

.reset-view-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.reset-view-btn:hover {
    background: var(--bg-secondary) !important;
    color: #fff !important;
}

.reset-view-btn svg {
    width: 16px;
    height: 16px;
}

.leaflet-control-attribution {
    background: var(--bg-overlay) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

/* Align bottom-right controls with chat button */
.leaflet-bottom.leaflet-right {
    right: 10px;
    bottom: 12px;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-overlay);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    min-width: 240px;
}

.leaflet-popup-content {
    margin: 14px 36px 14px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.leaflet-popup-tip {
    background: var(--bg-overlay);
    border: 1px solid var(--border-color);
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
    top: 8px !important;
    right: 8px !important;
    width: 24px !important;
    height: 24px !important;
    font-size: 20px !important;
    line-height: 22px !important;
    padding: 0 !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

/* Responsive */
@media (max-width: 768px) {
    #stats-panel,
    #weather-panel {
        display: none;
    }

    #time-display {
        min-width: auto;
    }

    #current-time {
        font-size: 11px;
    }
}

/* ============================================
   Onboarding Tour
   ============================================ */

#tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
}

#tour-spotlight {
    position: fixed;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    z-index: 9998;
    pointer-events: none;
    transition: all 0.3s ease;
}

#tour-tooltip {
    position: fixed;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px 24px 20px 24px;
    max-width: 400px;
    min-width: 340px;
    min-height: 240px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

#tour-title {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

#tour-description {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 auto 0;
}

#tour-description strong {
    color: var(--text-primary);
    font-weight: 500;
}

.tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.tour-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.tour-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.tour-btn.primary {
    background: #25B99E;
    color: #000;
    border: none;
}

.tour-btn.primary:hover {
    background: #2fd4b5;
    color: #000;
}

.tour-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#tour-dots {
    display: flex;
    gap: 4px;
}

.tour-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s;
}

.tour-dot.active {
    background: #25B99E;
}

#tour-counter {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

#tour-skip {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.15s;
}

#tour-skip:hover {
    color: var(--text-secondary);
}

/* Tour responsive */
@media (max-width: 768px) {
    #tour-tooltip {
        max-width: calc(100vw - 32px);
        min-width: 300px;
    }
}

/* ============================================
   Chat Assistant
   ============================================ */

#chat-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(17, 84, 92, 0.5);
    transition: all 0.2s;
}

#chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 185, 158, 0.6);
}

#chat-button.active {
    background: linear-gradient(135deg, #11545C 0%, #25B99E 100%);
    box-shadow: 0 0 12px rgba(37, 185, 158, 0.8);
}

#chat-panel {
    position: fixed;
    bottom: 72px;
    right: 16px;
    width: 380px;
    height: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    z-index: 10001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transition: all 0.2s ease;
}

#chat-panel.maximized {
    top: 48px;
    bottom: 56px;
    right: 0;
    left: auto;
    width: 420px;
    height: calc(100vh - 48px - 56px);
    border-radius: 0;
    border-right: none;
    border-top: none;
    border-bottom: none;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.chat-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chat-header-actions {
    display: flex;
    gap: 4px;
}

.chat-icon-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chat-icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message code {
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.chat-message.assistant code {
    background: rgba(255, 255, 255, 0.1);
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Suggestion Chips */
#chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}

#chat-suggestions.hidden {
    display: none;
}

.suggestion-chip {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.suggestion-chip:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-primary);
}

/* Streaming Cursor */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--accent-green);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

#chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

#chat-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

#chat-input:focus {
    border-color: #25B99E;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

#chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #25B99E 0%, #11545C 100%);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

#chat-send:hover {
    background: linear-gradient(135deg, #2fd4b5 0%, #1a7a6a 100%);
}

#chat-send:active {
    transform: scale(0.95);
}

/* API Key Modal */
#api-key-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    padding-top: 32px;
    width: 400px;
    max-width: calc(100vw - 32px);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.modal-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    margin-bottom: 16px;
    outline: none;
}

.modal-content input:focus {
    border-color: #25B99E;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.modal-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-btn.primary {
    background: var(--accent-green);
    color: #000;
    border: none;
}

.modal-btn.primary:hover {
    background: #2fd4b5;
}

/* Chat responsive */
@media (max-width: 768px) {
    #chat-panel {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 64px;
        height: 60vh;
    }

    #chat-panel.maximized {
        left: 0;
        right: 0;
        width: 100%;
    }

    #chat-button {
        width: 36px;
        height: 36px;
    }
}

/* ========================================
   Image Viewer Styles
   ======================================== */

/* Full-screen image modal */
#image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#image-modal.hidden {
    display: none;
}

.image-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.image-modal-content {
    position: relative;
    display: flex;
    max-width: 95vw;
    max-height: 95vh;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Navigation buttons */
.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}

.image-modal-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.image-modal-nav.hidden {
    display: none;
}

.image-modal-prev {
    left: 16px;
}

.image-modal-next {
    right: 316px; /* Account for details panel width (300px + padding) */
}

/* Image counter */
.image-modal-counter {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
}

.image-modal-counter.hidden {
    display: none;
}

.image-modal-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-width: 0;
}

.image-modal-main img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.image-modal-details {
    width: 280px;
    padding: 20px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.image-modal-details h3 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.detail-row {
    margin-bottom: 12px;
}

.detail-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.detail-filename {
    font-size: 11px;
    word-break: break-all;
    color: var(--text-secondary);
}

/* Popup thumbnails */
.segment-popup {
    min-width: 200px;
}

.popup-segment-info {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.popup-images {
    padding-top: 4px;
}

.popup-images-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.popup-images-label svg {
    color: #25B99E;
}

.popup-thumbnails {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.image-thumbnail {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, transform 0.2s;
}

.image-thumbnail:hover {
    border-color: #25B99E;
    transform: scale(1.05);
}

.image-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-thumbnail:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-overlay svg {
    color: #fff;
}

.popup-more-images {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Photo marker on map */
.photo-marker-icon {
    background: transparent !important;
}

.photo-marker {
    background: transparent;
    width: 28px;
    height: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.photo-marker:hover {
    transform: scale(1.15);
}

.photo-marker svg {
    width: 28px;
    height: 40px;
}

/* Leaflet popup customization for images - uses main popup styles above */

.leaflet-popup-tip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-left: none;
}

/* Responsive modal */
@media (max-width: 768px) {
    .image-modal-content {
        flex-direction: column;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .image-modal-details {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        max-height: 200px;
    }

    .image-modal-main img {
        max-height: 60vh;
    }
}
