:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #0F172A;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border-color: rgba(255, 255, 255, 0.1);
    --success: #10B981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: radial-gradient(circle at top right, #1e1b4b, #0f172a);
}

header {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, #60A5FA, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.container {
    display: block;
    flex: 1;
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.form-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 400px;
    max-height: calc(100% - 40px);
    overflow-y: auto;
    z-index: 1000;
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.form-panel::-webkit-scrollbar {
    width: 8px;
}
.form-panel::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
}
.form-panel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
}

.map-panel {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--panel-bg);
    overflow: hidden;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.location-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #EF4444; /* red when empty */
}

.status-dot.active {
    background: var(--success); /* green when set */
}

button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
}

button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.instructions {
    background: rgba(96, 165, 250, 0.1);
    border-left: 4px solid #60A5FA;
    padding: 1rem;
    border-radius: 4px 8px 8px 4px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Sidebar Toggle Button */
.toggle-sidebar-btn {
    position: absolute;
    top: 20px;
    right: -40px;
    width: 40px;
    height: 40px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    transition: background 0.2s;
}
.toggle-sidebar-btn:hover {
    background: rgba(255,255,255,0.1);
}

.form-panel {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-panel.collapsed {
    transform: translateX(calc(-100% - 20px));
}

/* Map overlay for controls */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.map-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.map-btn:hover {
    background: rgba(255,255,255,0.2);
}

.map-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-hover);
}

/* Result Modal */
#resultModal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-content h2 {
    color: var(--success);
    margin-bottom: 1rem;
}

.score-display {
    font-size: 3rem;
    font-weight: bold;
    color: #FCD34D;
    margin: 1rem 0;
}

.close-btn {
    margin-top: 1.5rem;
    padding: 0.75rem 2rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
}
.close-btn:hover {
    background: rgba(255,255,255,0.1);
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 900px) {
    .container {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .form-panel {
        position: relative;
        top: 0; left: 0;
        width: 100%;
        max-height: none;
        border-radius: 0;
    }
    .map-panel {
        position: relative;
        width: 100%;
        min-height: 500px;
    }
}
