body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background-color: #e9f5f9; /* Light blue background */
    color: #333;
    line-height: 1.6;
}

.container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 90%;
    max-width: 550px;
    box-sizing: border-box;
}

h1 {
    color: #2c3e50; /* Darker blue */
    margin-bottom: 20px;
    font-size: 2.2em;
}

p {
    margin-bottom: 25px;
    color: #555;
    font-size: 1.1em;
}

button {
    background-color: #3498db; /* Bright blue */
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px auto; /* Center button and add space below */
    min-width: 220px; /* Ensure button doesn't shrink too much */
}

button:hover:not(:disabled) {
    background-color: #2980b9; /* Slightly darker blue on hover */
    transform: translateY(-2px);
}

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

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.8;
}

#locationResult {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #dcdcdc; /* Default border */
    border-radius: 8px;
    min-height: 80px; /* Ensure some space even when empty */
    display: flex;
    flex-direction: column; /* Stack text and map */
    align-items: center; /* Center items horizontally */
    justify-content: center;
    font-size: 1.1em;
    color: #333; /* Default text color */
    background-color: #f9f9f9; /* Default background */
    word-wrap: break-word;
    text-align: left;
    transition: border-color 0.3s ease, background-color 0.3s ease; /* Smooth transitions */
}

/* New div for text content inside locationResult */
#locationText {
    width: 100%; /* Take full width */
    text-align: center; /* Center status messages */
}

/* Styles for paragraphs within locationText (or locationResult if no locationText) */
#locationResult p { /* This rule will now apply to paragraphs inside #locationText */
    margin: 5px 0;
    text-align: left; /* Keep coordinates left-aligned */
    width: 100%; /* Take full width of parent */
}

/* Specific styles for success/error messages */
#locationResult .status-success {
    color: #27ae60; /* Darker green */
    font-weight: bold;
    margin-bottom: 10px; /* Space below the status message */
    text-align: center;
}

#locationResult .status-error {
    color: #c0392b; /* Darker red */
    font-weight: bold;
    margin-bottom: 10px; /* Space below the status message */
    text-align: center;
}

/* Styles for the #locationResult container itself on success/error */
#locationResult.success {
    border-color: #2ecc71; /* Green border for success */
    background-color: #e8f8f5; /* Light green background */
}

#locationResult.error {
    border-color: #e74c3c; /* Red border for error */
    background-color: #fdeded; /* Light red background */
}

/* Map specific styles */
.map-container {
    height: 300px; /* IMPORTANT: Give the map a height */
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px; /* Space between text and map */
    /* Hide the map initially */
    display: none;
}

.map-container.visible {
    display: block; /* Show map when it has location */
}


.note {
    margin-top: 35px;
    font-size: 0.9em;
    color: #777;
    padding: 10px;
    border-top: 1px solid #eee;
}

/* Spinner Styles */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

.button-text {
    display: inline-block;
}

/* Animation for spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Adjust button text/spinner visibility */
button[disabled] .button-text {
    display: none;
}

button:not([disabled]) .spinner {
    display: none !important; /* Hide spinner when not disabled */
}