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

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: #2d2d2d;
    border-bottom: 2px solid #404040;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo {
    width: 24px;
    height: 24px;
    /* Invert colors for dark theme */
    filter: invert(1) brightness(0.9);
    /* Subtle glow effect */
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    /* Ensure it doesn't affect header height */
    flex-shrink: 0;
}

.logo:hover {
    filter: invert(1) brightness(1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #b0b0b0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
}

.main-container {
    display: flex;
    flex: 1;
}

.controls-panel {
    background: #252525;
    width: 320px;
    border-right: 2px solid #404040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
    max-height: calc(100vh - 60px);
    position: relative;
}

.panel-section {
    border-bottom: 1px solid #404040;
    padding: 20px;
    transition: padding-bottom 0.3s ease;
}

.panel-section.collapsed {
    padding-bottom: 0;
}

.section-title {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-group {
    margin-bottom: 16px;
}

.param-group label {
    display: block;
    color: #b0b0b0;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-group input, .param-group select {
    width: 100%;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.2s ease;
}

/* Custom styling for select dropdowns */
.param-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
    font-weight: 500;
}

.param-group select:hover {
    border-color: #555555;
    background-color: #222222;
}

.param-group input:focus, .param-group select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.param-group input:hover {
    border-color: #555555;
    background-color: #222222;
}

/* Style dropdown options */
.param-group select option {
    background: #2a2a2a;
    color: #e0e0e0;
    padding: 8px;
    font-size: 1rem;
}

.param-group select option:hover {
    background: #4CAF50;
    color: #ffffff;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #333333;
    border: 1px solid #555555;
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    margin-bottom: 8px;
}

.btn:hover {
    background: #404040;
}

.btn.primary {
    background: #4CAF50;
    border-color: #4CAF50;
}

.btn.secondary {
    background: #2196F3;
    border-color: #2196F3;
}

.status-message {
    padding: 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    border-left: 4px solid #4CAF50;
}

.status-message.info {
    background: rgba(33, 150, 243, 0.1);
    border-left-color: #2196F3;
    color: #90CAF9;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4CAF50;
    color: #A5D6A7;
}

.status-message.warning {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: #FF9800;
    color: #FFCC02;
}

.map-container {
    flex: 1;
    position: relative;
    background: #000000;
}

#map {
    height: 100%;
    width: 100%;
}

.viewer-container {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 400px;
    height: 300px;
    background: #000000;
    border: 2px solid #404040;
    border-radius: 4px;
    z-index: 500;
    transition: all 0.3s ease;
}

.viewer-container.fullscreen {
    top: 60px;
    left: 320px;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    border-radius: 0;
}

#viewer3d {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.viewer-controls {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
}

.viewer-btn {
    flex: 1;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
    cursor: pointer;
}

.viewer-btn:hover {
    background: rgba(64, 64, 64, 0.9);
}

.viewer-btn.active {
    background: rgba(76, 175, 80, 0.8);
}

.instruction {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid #FF9800;
    border-radius: 4px;
    padding: 12px;
    font-size: 0.85rem;
    color: #FFCC02;
    margin-bottom: 16px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.9rem;
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.stat-item {
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
    padding: 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4CAF50;
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    color: #b0b0b0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.legend-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-label {
    color: #e0e0e0;
    font-size: 0.9rem;
}

/* Collapsible section styles */
.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
}

.collapsible-header:hover {
    color: #4CAF50;
}

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

.collapse-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.collapsible.expanded .collapse-arrow {
    transform: rotate(180deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 1000px; /* Large enough for any content */
}

.collapsible-content[style*="display: none"] {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Awaiting stats message */
.awaiting-stats {
    text-align: center;
    color: #888;
    font-style: italic;
    font-size: 0.85rem;
    padding: 20px;
    border: 1px solid #404040;
    border-radius: 4px;
    background: #1a1a1a;
    margin-top: 16px;
}

/* Info icon and tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #404040;
    color: #b0b0b0;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: help;
    margin-left: 8px;
    position: relative;
    z-index: 50000;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background: #4CAF50;
    color: #ffffff;
}

.info-tooltip {
    position: fixed;
    top: auto;
    left: 340px;
    background: #2d2d2d;
    color: #e0e0e0;
    padding: 18px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
    max-width: 500px;
    min-width: 320px;
    white-space: normal;
    text-transform: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid #404040;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Disabled - now handled by JavaScript to escape container overflow
.info-icon:hover .info-tooltip {
    opacity: 1;
    visibility: visible;
}
*/

.info-tooltip::before {
    content: '';
    position: absolute;
    top: var(--arrow-offset, 8px);
    left: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid #2d2d2d;
}

.info-tooltip ol {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: decimal;
}

.info-tooltip ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.info-tooltip li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.info-tooltip li:last-child {
    margin-bottom: 0;
}

.info-tooltip p {
    margin: 8px 0;
    line-height: 1.6;
}

.info-tooltip p:first-child {
    margin-top: 0;
}

.info-tooltip p:last-child {
    margin-bottom: 0;
}

.info-tooltip strong {
    color: #ffffff;
    font-weight: 600;
}

.info-tooltip br {
    line-height: 2;
}

.info-tooltip .key {
    display: inline-block;
    background: #404040;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid #555555;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    margin: 0 1px;
}

/* Customize Leaflet draw control icons */
.leaflet-draw-draw-polyline::before {
    content: '✈';
    font-size: 16px;
    line-height: 1;
    color: #333;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.leaflet-draw-draw-polyline {
    background-image: none !important;
    position: relative;
}

/* 3D Viewer Loading and Placeholder States */
.viewer-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.viewer-loading.active {
    display: flex;
}

.loading-spinner {
    margin-bottom: 20px;
}

.spinning-logo {
    width: 64px;
    height: 64px;
    animation: logoSpin 1.2s linear infinite;
    filter: brightness(1.2);
}

@keyframes logoSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #94a3b8;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

.viewer-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.viewer-placeholder.hidden {
    display: none;
}

.placeholder-content {
    text-align: center;
    color: #64748b;
}

.placeholder-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
    filter: brightness(0.8);
}

.diagonal-line {
    width: 200px;
    height: 2px;
    background: linear-gradient(45deg, transparent 40%, #475569 50%, transparent 60%);
    margin: 0 auto 30px;
    opacity: 0.6;
    transform: rotate(45deg);
}

.placeholder-text {
    font-size: 18px;
    font-weight: 500;
    opacity: 0.8;
}

/* Button disabled state */
.viewer-btn:disabled,
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #64748b !important;
    color: #94a3b8 !important;
}

/* Animation controls styling */
.animation-controls {
    position: absolute;
    bottom: 60px;
    left: 12px;
    right: 12px;
    z-index: 10;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.animation-controls.show {
    opacity: 1;
    transform: translateY(0);
}

.viewer-btn {
    transition: all 0.3s ease;
    transform: scale(1);
}

.viewer-btn.animate-in {
    animation: slideInScale 0.3s ease forwards;
}

.viewer-btn.animate-out {
    animation: slideOutScale 0.3s ease forwards;
}

@keyframes slideInScale {
    0% {
        opacity: 0;
        transform: scale(0.8) translateX(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

@keyframes slideOutScale {
    0% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateX(20px);
    }
}

.animation-controls input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #404040;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.animation-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.animation-controls input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}