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

:root {
    --primary: #007bff;
    --primary-dark: #0069d9;
    --background: #f8fafc;
    --text: #0f172a;
    --error: #ef4444;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 2rem;
}

.form-container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 800px;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
    letter-spacing: -0.025em;
    text-align: center;
}

/* Form Styling */
form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.form-group {
    width: 100%;
    max-width: 400px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text);
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230f172a' 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 0.75rem center;
    background-size: 1em;
}

select:hover {
    border-color: var(--primary);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15); /* Updated color for focus shadow */
}

button {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    min-width: 200px;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.error {
    color: var(--error);
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgb(239 68 68 / 0.1);
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    display: none; /* Hide by default */
}

/* Map container */
.result {
    width: 100%;
    max-width: 2200px;
    margin-top: 2rem;
    padding: 0 1rem;
    display: none;
    margin-left: auto;
    margin-right: auto;
}

.map-frame {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: white;
}

.back-button {
    display: inline-block;
    background: #f1f1f1;
    color: black;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-top: 2rem;
    margin-bottom: 2rem;
}
.back-button:hover {
    background: #ddd;
    border-color: #ccc;
}

/* Added to support forms on individual pages */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: start;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 1.5rem;
}
.form-row .form-group {
    max-width: none; /* Override max-width inside a form-row */
}
.form-row button {
    margin-top: 1.75rem; /* Align button with dropdowns */
    min-width: auto;
}

@media (max-width: 900px) {
    .container {
        padding: 1.5rem 1.25rem;
    }
    .form-container {
        padding: 1.5rem;
    }
    h1 {
        font-size: 1.75rem;
    }
    .form-row {
        gap: 16px;
    }
    .map-frame {
        height: 500px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 0.95rem;
    }
    .container {
        padding: 1rem;
    }
    h1 {
        font-size: 1.35rem;
        line-height: 1.3;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .form-row button {
        width: 100%;
        margin-top: 0.5rem;
    }
    .form-group,
    .error,
    .back-button {
        max-width: 100%;
    }
    button {
        width: 100%;
        min-width: auto;
    }
    select {
        font-size: 0.9rem;
        padding: 0.65rem 0.85rem;
        background-position: right 0.5rem center;
    }
    label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    .map-frame {
        height: 360px;
    }
    .result {
        padding: 0;
    }
    .back-button {
        text-align: center;
    }
}
