:root {
    --bg-dark: #050505;
    --bg-card: #121212;
    --accent: #00f2ff;
    --accent-glow: rgba(0, 242, 255, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --danger: #ff4b2b;
}

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

body,
html {
    height: 100%;
    width: 100%;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

/* Map Styling */
#map {
    height: 100vh;
    width: 100vw;
    background: var(--bg-dark);
}

/* Header UI */
.header-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.header-overlay h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

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

.header-overlay p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* FAB Button */
.fab {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 0 20px var(--accent-glow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab:active {
    transform: translateX(-50%) scale(0.95);
}

.fab .icon {
    font-size: 1.4rem;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.intensity-options {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.intensity-options input {
    display: none;
}

.intensity-options label {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.intensity-options input:checked+label {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.location-toggle {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.location-toggle input {
    display: none;
}

.location-toggle label {
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    display: block;
}

.location-toggle label:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.location-toggle input:checked+label {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 4px 20px rgba(0, 242, 255, 0.2);
}

/* Map selector UI */
.map-selection-active #map {
    cursor: crosshair;
}

.map-instruction {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--bg-dark);
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 800;
    z-index: 3000;
    display: none;
    box-shadow: 0 0 20px var(--accent-glow);
}

.map-selection-active .map-instruction {
    display: block;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Custom Marker Pulsing */
.noctiluca-marker {
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 15px 5px var(--accent-glow);
    border: 2px solid #fff;
    animation: pulse 2s infinite;
    transition: all 0.5s ease;
    position: relative;
}

/* Verified GPS marker (Intense glow) */
.noctiluca-marker.verified {
    box-shadow: 0 0 20px 8px var(--accent-glow);
    border-color: #00ffcc;
}

.noctiluca-marker.verified::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #00ffcc;
    color: #000;
    font-size: 8px;
    font-weight: 800;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fff;
}

/* Manual/Remote marker (Subtle glow) */
.noctiluca-marker.manual {
    box-shadow: 0 0 10px 2px rgba(0, 242, 255, 0.4);
    opacity: 0.9;
}

/* Old Marker (24h+) */
.noctiluca-marker.old {
    background: #666;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    border-color: #999;
    animation: none;
    opacity: 0.6;
}

/* User Location Marker (Orange Pin) */
.user-location-marker {
    width: 20px !important;
    height: 20px !important;
    background: #ff9100;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 0 15px 5px rgba(255, 145, 0, 0.4);
    border: 2px solid #fff;
    animation: userPulse 2s infinite;
}

/* Container for the pin to handle rotation/alignment */
.user-marker-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes userPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 145, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 25px 15px rgba(255, 145, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 145, 0, 0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 20px 15px rgba(0, 242, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0);
    }
}

/* Toast */
.toast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 3000;
    border: 1px solid var(--accent);
    transition: top 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.active {
    top: 20px;
}

/* Leaflet dark theme tweaks */
.leaflet-container {
    background: #000 !important;
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.5) !important;
    color: #555 !important;
}

.leaflet-bar a {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem !important;
}

.center-location-btn {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' width='20px' height='20px'%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
}