:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --safe: #10b981;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.1);
    --header-height: 70px;
}

.btn.success {
    background: var(--safe);
    color: white;
}

.btn.success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn.secondary {
    background: #475569;
    color: white;
}

/* Modal Styles */
.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: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    color: white;
    margin-bottom: 0.5rem;
    text-transform: none;
    font-size: 1.25rem;
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Change to flex-start to keep elements together */
    padding: 0 2rem;
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-btns {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0;
}

.logo svg {
    color: #3b82f6;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn.primary {
    background: var(--accent);
    color: white;
}

.btn.primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn.large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

main {
    height: calc(100vh - var(--header-height));
    display: flex;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border);
}

#map-container {
    flex: 1;
    position: relative;
    background: #1e293b;
}

#map {
    width: 100%;
    height: 100%;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

#startup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    max-width: 500px;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.overlay-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.sidebar {
    width: 350px;
    background: rgba(15, 23, 42, 0.95);
    border-left: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.info-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.value.danger {
    color: var(--danger);
}

.slider-container {
    margin: 1rem 0;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: #334155;
    border-radius: 3px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Toggle Switch Styles */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider.round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider.round:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider.round {
    background-color: var(--accent);
}

input:checked+.slider.round:before {
    transform: translateX(20px);
}

.threshold-value {
    margin-top: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: right;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.safe {
    background-color: var(--safe);
    box-shadow: 0 0 10px var(--safe);
}

.dot.danger {
    background-color: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.api-key-warning {
    margin-top: auto;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-size: 0.8rem;
    color: #fca5a5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Custom Marker Styles */
.custom-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
}

.marker-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.custom-marker.safe .marker-dot {
    background-color: var(--safe);
    box-shadow: 0 0 10px var(--safe);
}

.custom-marker.danger .marker-dot {
    background-color: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.marker-label {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

/* Zoom dependent visibility */
.zoom-detailed .marker-label {
    opacity: 1;
    transform: translateY(0);
}

.custom-marker:hover .marker-dot {
    transform: scale(1.2);
}

/* Feature Guide Styles */
.feature-guide {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.guide-header {
    text-align: center;
    margin-bottom: 4rem;
}

.guide-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.guide-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.guide-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
}

.guide-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.guide-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.guide-icon.primary {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.guide-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.guide-icon.accent {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.guide-icon.secondary {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
}

.guide-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.guide-card h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.guide-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

footer {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.5);
}

@media (max-width: 1024px) {
    main {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    #map-container {
        height: 500px;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}