body { /* Updated for better background image handling */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #2d3748;
    margin: 0;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    background-color: #f8fafc; /* Fallback color */
    background-image: url('images/background.png');
    background-size: cover; /* Ensures the image covers the entire page */
    background-position: center; /* Centers the image for better coverage */
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    position: relative; /* Establishes a stacking context */
    isolation: isolate; /* Prevents the ::before from rendering behind the body's background */
}

/* Overflow fix: ensure elements respect container width */
*, *::before, *::after {
    box-sizing: border-box;
}

input[type="text"], input[type="password"], .styled-select, button {
    max-width: 100%;
}

/* Add semi-transparent overlay to ensure text readability */
body::before {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 100%; /* Start gradient after the man's position */
    background: linear-gradient(to right, rgba(248, 250, 252, 0.1), #f8fafc 70%);
    pointer-events: none; /* Allows clicking through the overlay */
    z-index: -1; /* Position it behind the content but over the background-image */
}

.container {
    width: 100%;
    max-width: 490px;
    margin: 50 auto;
}

h1 {
    text-align: center;
    color: #1a365d;
    margin-bottom: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.card {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card h2 {
    margin-top: 0;
    color: #34495e;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    letter-spacing: -0.25px;
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-group label {
    font-weight: 600;
    flex-basis: 150px;
    flex-shrink: 0;
    color: #4a5568;
}

.styled-select, input[type="text"], input[type="password"] {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background-color: #fff;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.styled-select:focus, input[type="text"]:focus, input[type="password"]:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
    outline: none;
}

.styled-select:disabled {
    background-color: #edf2f7;
    cursor: not-allowed;
}

button {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(to bottom, #3498db, #2980b9);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

button:hover {
    background: linear-gradient(to bottom, #3182ce, #2b6cb0);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button.success { 
    background: linear-gradient(to bottom, #2ecc71, #27ae60);
}
button.error { 
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
}
button:disabled { 
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#log-output {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.hidden {
    display: none;
}

.gps-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 0.9rem;
}

.gps-active {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.gps-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        margin: 0;
        max-width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .form-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .form-group label {
        flex-basis: auto;
    }

    .gps-status {
        bottom: 10px;
        right: 10px;
        font-size: 0.8rem;
    }
}