/* ================================
   Nuclear Effects Simulator - Styles
   Modern UI for 2025/2026
   ================================ */

/* CSS Custom Properties */
:root {
    /* Colors */
    --primary-color: #62d0ff;
    --primary-hover: #7fe0ff;
    --secondary-color: color-mix(in srgb, var(--primary-color) 22%, #07090d);
    --secondary-hover: color-mix(in srgb, var(--primary-color) 32%, #07090d);
    --accent-color: #ffd166;
    --success-color: #17c964;
    --success-hover: #12a150;
    --danger-color: #f31260;
    --danger-hover: #c40e4c;
    --warning-color: #f7b955;
    
    /* Neutral Colors */
    --bg-primary: #0c0d0f;
    --bg-secondary: #11151c;
    --bg-tertiary: #161c25;
    --text-primary: #e8e9eb;
    --text-secondary: #b6bcc6;
    --text-muted: #7d8694;
    --border-color: #212733;
    --panel-shadow: 0 25px 60px rgba(2, 4, 8, 0.55);
    --brand-glow: 0 18px 38px rgba(98, 208, 255, 0.25);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    
    /* Layout */
    --sidebar-width: 380px;
    --header-height: 60px;
    
    /* Mobile breakpoint */
    --mobile-breakpoint: 768px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-xl);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    backdrop-filter: saturate(160%) blur(8px);
    position: relative;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    gap: var(--spacing-lg);
}

.app-header .home-link {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
}

.app-header .home-link:hover {
    opacity: 1;
}

.app-header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
    letter-spacing: 0.05em;
}

.app-header .mobile-title {
    display: none;
}

.app-header .desktop-title {
    display: inline;
}

.header-actions {
    display: flex;
    gap: var(--spacing-md);
}

/* Main Container */
.app-container {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-normal), transform var(--transition-normal);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
    transform: translateX(0);
    border-right: none;
}

.sidebar-content {
    padding: var(--spacing-lg);
}

/* Control Sections */
.control-section {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-tertiary) 92%, transparent), var(--bg-secondary));
    border-radius: 14px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    box-shadow: var(--panel-shadow);
}

.control-section h2 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
    position: relative;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.625rem;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--bg-primary) 80%, transparent);
    box-shadow: 0 0 0 3px rgba(98, 208, 255, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.input-group input[type="number"] {
    flex: 1;
}

.form-range {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Select Dropdowns */
select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

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

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: var(--spacing-sm);
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Effect Icons (Desktop) */
.effects-icons-desktop {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

.effect-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.effect-icon:hover {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 15%, var(--bg-primary));
    transform: translateY(-2px);
}

.effect-icon.active {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 25%, var(--bg-primary));
    color: var(--text-primary);
}

/* Mobile: hide icons, show text labels */
.effects-labels-mobile {
    display: none;
}

/* Buttons */
.btn {
    font-family: var(--font-mono);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    white-space: nowrap;
    background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,.4);
}

.btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 20%, transparent);
    color: var(--primary-color);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary-color) 10%, var(--bg-secondary)), var(--bg-secondary));
    border-color: color-mix(in srgb, var(--primary-color) 40%, var(--border-color));
    color: var(--text-primary);
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--primary-color) 15%, var(--bg-secondary));
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary {
    background: color-mix(in srgb, var(--bg-primary) 60%, transparent);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: color-mix(in srgb, var(--bg-primary) 40%, transparent);
}

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

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

.btn-danger {
    background: linear-gradient(180deg, color-mix(in srgb, var(--danger-color) 10%, var(--bg-secondary)), var(--bg-secondary));
    border-color: color-mix(in srgb, var(--danger-color) 40%, var(--border-color));
    color: var(--text-primary);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--danger-color) 15%, var(--bg-secondary));
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: color-mix(in srgb, var(--bg-secondary) 85%, transparent);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
}

.btn .icon {
    font-size: 1.125rem;
}

/* Button Group */
.button-group {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.button-group .btn {
    flex: 1;
    min-width: 150px;
}

/* Coordinate Display */
.coord-display {
    padding: 0.625rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--primary-color);
}

/* Timestamp Controls */
.date-inputs {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-sm);
}

.minutes-control {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.minutes-input {
    width: 100%;
}

.timestamp-display {
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 1.125rem;
    color: var(--primary-color);
    text-align: center;
    font-weight: 600;
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.search-result-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
}

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

/* Map Controls */
.map-controls {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: 500;
}

/* Timeline toggle button - highlight when active */
#toggleTimeline.active {
    background: var(--primary-color);
    color: #04121d;
    border-color: var(--primary-color);
    box-shadow: var(--brand-glow);
}

/* Detonations list toggle button - highlight when active */
#toggleDetonationsList.active {
    background: var(--primary-color);
    color: #04121d;
    border-color: var(--primary-color);
    box-shadow: var(--brand-glow);
}

/* Detonations Panel */
.detonations-panel {
    position: absolute;
    bottom: var(--spacing-lg);
    left: var(--spacing-lg);
    width: 400px;
    max-height: 50vh;
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    border-radius: 16px;
    box-shadow: var(--panel-shadow);
    overflow: hidden;
    z-index: 500;
}

.panel-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: color-mix(in srgb, var(--bg-tertiary) 85%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

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

.detonations-list {
    padding: var(--spacing-md);
    max-height: calc(50vh - 60px);
    overflow-y: auto;
}

.detonation-item {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-tertiary) 92%, transparent), var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: var(--spacing-md);
    transition: all var(--transition-fast);
}

.detonation-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.detonation-item.selected {
    border-color: var(--primary-color);
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary-color) 15%, var(--bg-tertiary)), color-mix(in srgb, var(--primary-color) 8%, var(--bg-secondary)));
    box-shadow: 0 0 0 1px var(--primary-color), var(--shadow-md);
}

.detonation-info {
    grid-column: 1;
    grid-row: 1 / 3;
}

.detonation-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.detonation-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.casualty-data {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: var(--spacing-xs) 0 0 0;
}

.detonation-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    gap: var(--spacing-xs);
    align-self: start;
}

.wind-readout {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--text-muted);
    align-self: end;
}

.wind-readout .wind-label {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.wind-readout .wind-value {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.wind-readout .wind-meta {
    display: block;
    font-size: 0.65rem;
    opacity: 0.8;
}

.detonation-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Statistics Panel */
.stats-panel {
    position: absolute;
    top: var(--spacing-lg);
    left: var(--spacing-lg);
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    border-radius: 16px;
    padding: var(--spacing-lg);
    min-width: 300px;
    box-shadow: var(--panel-shadow);
    z-index: 500;
}

.stats-panel h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
}

.stats-grid {
    display: grid;
    gap: var(--spacing-md);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: color-mix(in srgb, var(--bg-tertiary) 90%, transparent);
    border-radius: 12px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    font-family: var(--font-mono);
}

/* Timeline Panel */
.timeline-panel {
    position: absolute;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    border-radius: 16px;
    min-width: 400px;
    max-width: 600px;
    box-shadow: var(--panel-shadow);
    z-index: 500;
}

.timeline-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.timeline-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-controls {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.timeline-content {
    padding: var(--spacing-lg);
}

.timeline-bar {
    position: relative;
    height: 20px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--warning-color));
    width: 0%;
    transition: width 0.3s ease;
}

.timeline-slider {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    opacity: 0.8;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 100%;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 100%;
    background: var(--text-primary);
    cursor: pointer;
    border-radius: 3px;
}

.timeline-slider::-moz-range-thumb {
    width: 20px;
    height: 100%;
    background: var(--text-primary);
    cursor: pointer;
    border: none;
    border-radius: 3px;
}

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

.timeline-time {
    display: flex;
    gap: var(--spacing-sm);
    align-items: baseline;
}

.time-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.time-value {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--primary-color);
}

.timeline-stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-normal);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-secondary) 95%, transparent), var(--bg-primary));
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--panel-shadow);
    animation: slideUp var(--transition-normal);
}

.modal-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.modal-body {
    padding: var(--spacing-xl);
    overflow-y: auto;
    flex: 1;
}

/* Tabs */
.scenario-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Scenarios List */
.scenarios-list, .presets-list {
    display: grid;
    gap: var(--spacing-md);
}

.scenario-item, .preset-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-lg);
    transition: all var(--transition-fast);
}

.scenario-item:hover, .preset-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.scenario-item h4, .preset-item h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.02em;
}

.scenario-item p, .preset-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.scenario-item .scenario-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.scenario-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Import Zone & Dropzone Styles */
.import-zone {
    text-align: center;
}

.import-instructions {
    margin-bottom: var(--spacing-lg);
}

.import-instructions h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.import-instructions p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: var(--spacing-xl);
    background: var(--bg-tertiary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.dropzone:hover {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.dropzone.dragover {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 14%, transparent);
    border-style: solid;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.dropzone-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.dropzone-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.dropzone-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Enhanced Preset Card Styles */
.preset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.preset-warning {
    display: inline-block;
    background: var(--warning-color);
    color: #1d1306;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: var(--spacing-sm);
    font-weight: 600;
}

.preset-description {
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
    color: var(--text-secondary);
}

.preset-metadata {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.875rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metadata-label {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-xl);
    font-size: 0.875rem;
}

/* Warning Text */
.warning {
    color: var(--warning-color);
    padding: var(--spacing-md);
    background: color-mix(in srgb, var(--warning-color) 20%, transparent);
    border-left: 3px solid var(--warning-color);
    border-radius: 4px;
    font-size: 0.875rem;
}

/* About Footer */
.about-footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.about-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.about-footer a:hover {
    text-decoration: underline;
}

/* About modal typography improvements */
.modal-body .intro-text {
    margin-top: 0;
    margin-bottom: var(--spacing-lg);
}

.modal-body .key-features-list {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.modal-body .disclaimer-section {
    margin-left: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.modal-body .newsletter-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.modal-body .newsletter-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.modal-body .data-attribution {
    font-size: 0.85em;
    line-height: 1.5;
    color: var(--text-secondary);
}

.modal-body .data-attribution p {
    margin-bottom: var(--spacing-sm);
}

.modal-body .data-attribution a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-body .data-attribution a:hover {
    text-decoration: underline;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-xl);
    z-index: 3000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--spacing-lg));
    right: var(--spacing-lg);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 6px;
    padding: var(--spacing-md) var(--spacing-lg);
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight var(--transition-normal);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Footer */
.app-footer {
    background: color-mix(in srgb, var(--bg-secondary) 95%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    padding: var(--spacing-md) var(--spacing-xl);
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: var(--spacing-xl);
    align-items: flex-start;
}

.footer-left {
    flex: 1;
}

.footer-left p {
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 0.8125rem;
}

.newsletter-form {
    max-width: 450px;
}

.newsletter-row {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

.newsletter-form input[type="email"] {
    flex: 1;
    padding: 0.5rem 0.875rem;
    background: color-mix(in srgb, var(--bg-primary) 90%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    transition: border-color var(--transition-fast);
}

.newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.newsletter-form button {
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border: 1px solid color-mix(in srgb, var(--primary-color) 60%, var(--border-color));
    background: color-mix(in srgb, var(--bg-secondary) 70%, transparent);
    color: var(--text-primary);
}

.newsletter-form button:hover {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--primary-color) 80%, var(--bg-primary) 8%),
        color-mix(in srgb, var(--primary-color) 60%, var(--bg-primary) 4%));
    color: #04121d;
    border-color: color-mix(in srgb, var(--primary-color) 75%, var(--border-color));
    box-shadow: var(--brand-glow);
}

.form-msg {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: var(--spacing-xs) 0 0 0;
}

.footer-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
}

.footer-right p {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: 0 0 var(--spacing-xs) 0;
}

.footer-right a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-right a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1000;
        box-shadow: var(--shadow-xl);
    }
    
    .detonations-panel {
        width: 300px;
    }
    
    .stats-panel {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }
    
    /* Mobile: show text labels, hide icons */
    .effects-icons-desktop {
        display: none;
    }
    
    .effects-labels-mobile {
        display: flex;
    }
    
    .app-header {
        padding: 0 var(--spacing-md);
    }
    
    .app-header .home-link {
        font-size: 0.75rem;
    }
    
    .app-header h1 {
        font-size: 1rem;
    }
    
    .header-actions {
        gap: var(--spacing-sm);
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    .app-footer {
        padding: var(--spacing-md);
    }
    
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .footer-right {
        text-align: left;
    }
    
    .newsletter-row {
        flex-direction: column;
    }
    
    .newsletter-form button {
        width: 100%;
    }
    
    .detonations-panel,
    .stats-panel {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
        width: auto;
    }
    
    .map-controls {
        right: var(--spacing-sm);
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .app-header,
    .map-controls,
    .detonations-panel,
    .modal {
        display: none !important;
    }
    
    .map-container {
        width: 100%;
        height: 100vh;
    }
}

/* Leaflet Custom Styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-tip {
    background: var(--bg-secondary);
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-muted);
}

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

/* Effect Ring Labels */
.effect-label {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ================================
   MOBILE RESPONSIVE STYLES
   ================================ */

/* Mobile Tap Overlay */
.mobile-tap-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--spacing-xl);
    text-align: center;
}

.mobile-tap-overlay.active {
    display: flex;
}

.mobile-tap-content {
    background: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: var(--spacing-xl);
    max-width: 400px;
    animation: pulse 2s ease-in-out infinite;
}

.mobile-tap-content h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.mobile-tap-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.mobile-tap-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    display: block;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Mobile Footer Modal */
.mobile-footer-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    padding: var(--spacing-lg);
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 9999;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

.mobile-footer-modal.active {
    display: block;
    transform: translateY(0);
}

.mobile-footer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.mobile-footer-header h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin: 0;
    letter-spacing: -0.02em;
}

.mobile-footer-modal .btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-footer-modal .btn-close:hover {
    color: var(--text-primary);
}

.mobile-footer-content p {
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.mobile-footer-content .newsletter-form {
    margin-bottom: var(--spacing-md);
}

.mobile-footer-content .footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
}

.mobile-footer-content .footer-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.mobile-footer-content .footer-links a:hover {
    text-decoration: underline;
}

.mobile-footer-content .copyright {
    margin-top: var(--spacing-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    font-size: 1.5rem;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    z-index: 8000;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

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

.mobile-menu-btn.visible {
    display: flex;
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 8999;
    display: none;
}

.mobile-sidebar-overlay.active {
    display: block;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    /* Header adjustments */
    .app-header {
        padding: 0 var(--spacing-md);
        height: auto;
        min-height: var(--header-height);
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm) 0;
    }
    
    .app-header .home-link {
        font-size: 0.75rem;
        order: 1;
        flex-basis: 100%;
    }
    
    .app-header h1 {
        font-size: 1.25rem;
        order: 2;
        flex: 1;
        text-align: left;
        line-height: 1.2;
    }
    
    .app-header .desktop-title {
        display: none;
    }
    
    .app-header .mobile-title {
        display: inline;
    }
    
    .header-actions {
        order: 3;
        gap: var(--spacing-sm);
    }
    
    .header-actions .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
    }
    
    /* Hide desktop footer */
    .app-footer {
        display: none;
    }
    
    /* Sidebar becomes full-screen slide-up panel on mobile */
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 85vh;
        max-height: 85vh;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 9000;
        border-radius: 20px 20px 0 0;
        box-shadow: var(--shadow-xl);
        overflow-y: auto;
    }
    
    .sidebar.mobile-visible {
        transform: translateY(0);
    }
    
    .sidebar-content {
        padding-bottom: 80px; /* Space for floating button */
    }
    
    /* Map controls */
    .map-controls {
        display: none; /* Hide sidebar toggle on mobile - use floating button instead */
    }
    
    /* Detonations panel adjustments */
    .detonations-panel {
        max-width: 95%;
        max-height: 60vh;
        top: auto;
        bottom: var(--spacing-lg);
        right: var(--spacing-md);
        left: var(--spacing-md);
    }
    
    /* Stats panel adjustments - compact mobile version */
    .stats-panel {
        top: var(--spacing-md);
        left: var(--spacing-md);
        right: auto;
        bottom: auto;
        min-width: auto;
        width: auto;
        max-width: 140px;
        padding: 0.5rem 0.75rem;
        border-radius: 12px;
    }
    
    /* Hide title on mobile */
    .stats-panel h3 {
        display: none;
    }
    
    /* Compact grid - no backgrounds, no padding */
    .stats-grid {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .stat-item {
        padding: 0;
        background: none;
        border-radius: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    
    /* Hide labels on mobile */
    .stat-label {
        display: none;
    }
    
    /* Just show values - larger and centered */
    .stat-value {
        font-size: 0.9rem;
        color: var(--text-primary);
        font-weight: 500;
    }
    
    /* Hide Leaflet zoom controls on mobile */
    .leaflet-control-zoom {
        display: none !important;
    }
    
    /* Timeline panel adjustments */
    .timeline-panel {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-lg);
        max-width: calc(100% - 2rem);
    }
    
    .timeline-controls {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .timeline-controls .btn {
        font-size: 0.75rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    /* Hide detonation count on mobile (no room) */
    .timeline-stats {
        display: none;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: var(--spacing-md);
        max-height: 90vh;
    }
    
    .modal-body {
        padding: var(--spacing-md);
    }
    
    /* Form adjustments */
    .form-control,
    .btn {
        font-size: 1rem; /* Prevent iOS zoom on focus */
    }
    
    /* Control sections */
    .control-section {
        padding: var(--spacing-md);
    }
    
    .control-section h2 {
        font-size: 1.1rem;
    }
    
    /* Detonation cards */
    .detonation-item {
        padding: var(--spacing-md);
        font-size: 0.9rem;
    }
    
    /* Button groups */
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn {
        width: 100%;
    }
    
    /* Scenario tabs */
    .scenario-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: auto;
        padding: var(--spacing-sm);
        font-size: 0.85rem;
    }
    
    /* Preset list */
    .preset-card {
        padding: var(--spacing-md);
    }
    
    .preset-header h3 {
        font-size: 1rem;
    }
    
    .preset-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .preset-actions .btn {
        width: 100%;
    }
    
    /* Toast notifications */
    .toast {
        max-width: calc(100% - 2rem);
        margin: 0 var(--spacing-md);
    }
    
    /* Loading indicator */
    .loading-indicator {
        padding: var(--spacing-md);
    }
    
    /* Newsletter form in mobile modal */
    .mobile-footer-modal .newsletter-form input[type="email"] {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .mobile-footer-modal .newsletter-row {
        flex-direction: column;
    }
    
    .mobile-footer-modal .newsletter-form button {
        width: 100%;
    }
}

/* Very small phones */
@media (max-width: 375px) {
    .app-header h1 {
        font-size: 1.1rem;
    }
    
    .header-actions .btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.75rem;
    }
    
    .mobile-menu-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        height: 90vh;
        max-height: 90vh;
    }
    
    .mobile-tap-content {
        padding: var(--spacing-md);
    }
    
    .mobile-tap-content h2 {
        font-size: 1.25rem;
    }
}

