/* Base styles and box-sizing for all elements */
* {
    box-sizing: border-box; /* Ensures padding and border are included in the element's total width and height */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif; /* Fallback font */
    background-color: #f4f7f6; /* Light background for the whole page */
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Main Contact Section */
#contact {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap to the next line on smaller screens */
    align-items: center; /* Vertically align items in the center */
    justify-content: center; /* Horizontally center items */
    padding: 4rem 1.5rem; /* Fluid padding with rem units */
    height: auto; /* Allow height to adjust based on content */
    min-height: 100vh; /* Ensure it takes full viewport height if content is short */
    overflow: hidden; /* Hide overflow during animations */
}

/* Initial state for elements before animation */
#contact-image-adjust,
.contact-form-adjust {
    opacity: 0;
    /* Transformations for slideInLeft/Right are handled by the JS-added classes */
}

/* Classes added by JavaScript for animations (assuming a JS observer adds 'is-in-view') */
#contact-image-adjust.is-in-view {
    animation: slideInLeft 1s ease-out forwards;
}

.contact-form-adjust.is-in-view {
    animation: slideInRight 1s ease-out forwards;
    animation-delay: 0.2s; /* Stagger the form animation slightly */
}


.contact-rows {
    flex: 1 1 450px; /* Allows rows to grow, min width 450px before wrapping to next line */
    margin: 1rem; /* Gap between columns/rows using rem for fluidity */
    border-radius: 6px;
    height: auto; /* Height adjusts to content */
    max-width: 600px; /* Limit max width for columns on very large screens */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Subtle shadow for definition */
}

/* Image Container */
#contact-image-adjust {
    position: relative;
    max-width: 550px; /* Max width for image to control its size */
    transition: transform 0.4s ease; /* Hover transition for transform */
    overflow: hidden; /* Ensures border-radius and overlay work correctly */
}

#contact-image-adjust img {
    display: block;
    width: 100%;
    height: auto; /* Ensure image scales proportionally */
    border-radius: 6px;
    transition: transform 0.4s ease; /* Smooth scaling on hover */
}

#contact-image-adjust:hover {
    transform: scale(1.02); /* Slight zoom on hover */
}

/* Overlay for Image */
#contact-image-adjust::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(1, 49, 83, 0.2); /* Semi-transparent blue overlay */
    border-radius: 6px; /* Match image border-radius */
    opacity: 1; /* Default visible overlay */
    transition: opacity 0.4s ease; /* Smooth fade out on hover */
}

#contact-image-adjust:hover::after {
    opacity: 0; /* Fade out overlay on hover */
}

/* Contact Form Container */
.contact-form-adjust {
    padding: 2rem; /* Fluid padding with rem units */
    background-color: rgba(1, 49, 83, 0.9); /* More opaque background for the form for better contrast */
    border-radius: 6px;
    color: #fff; /* Ensure text is readable */
    height: 100%; /* Make form container fill height of flex row */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically center content within form container */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Add shadow for consistency */
}

/* Form Elements */
.contact-form-adjust form { /* Target form specifically within this container */
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* 20px, fluid gap */
    text-align: left; /* Align labels/inputs to the left */
}

.contact-form-adjust label {
    font-weight: bold;
    color: #f0f0f0; /* Lighter color for labels on dark background */
    margin-bottom: 0.3rem; /* Small margin below label */
    display: block; /* Make label appear on its own line */
    font-size: 0.95em;
}

.contact-form-adjust input[type="text"],
.contact-form-adjust input[type="email"],
.contact-form-adjust textarea {
    width: 100%; /* Full width */
    padding: 0.75rem; /* Fluid padding */
    border: 1px solid #0056b3; /* Border color related to theme */
    background-color: rgba(255, 255, 255, 0.9); /* Slightly transparent white for inputs */
    color: #333;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.3s ease, background-color 0.3s ease; /* Smooth transitions */
}

.contact-form-adjust input[type="text"]:focus,
.contact-form-adjust input[type="email"]:focus,
.contact-form-adjust textarea:focus {
    border-color: #aad8ff; /* Highlight on focus */
    background-color: #fff; /* Solid white on focus */
}

.contact-form-adjust textarea {
    resize: vertical; /* Allow vertical resizing */
    min-height: 6.25rem; /* 100px, fluid min-height */
}

.contact-form-adjust button[type="submit"] {
    background-color: #007bff; /* Primary button color */
    color: white;
    padding: 0.9rem 1.5rem; /* Fluid padding */
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease; /* Smooth hover effects */
    width: 100%;
    margin-top: 1rem; /* Space above the button */
}

.contact-form-adjust button[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-2px); /* Slight lift on hover */
}

/* Message Display Area within the form container */
.contact-form-adjust .notification-message {
    margin-bottom: 1.5rem; /* Space below the message */
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    font-size: 1em;
    display: none; /* Hidden by default */
    animation: fadeIn 0.5s ease-out forwards; /* Fade in animation for messages */
}

.contact-form-adjust .notification-message h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.4em;
}

.contact-form-adjust .notification-message p {
    margin-bottom: 0;
    font-size: 0.9em;
}

.contact-form-adjust .notification-message.success {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green text */
    border: 1px solid #c3e6cb;
}

.contact-form-adjust .notification-message.error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red text */
    border: 1px solid #f5c6cb;
}

/* Text Styling within the form container */
.contact-form-adjust .contact-h2-adjust { /* Target specifically within the form container */
    font-family: 'Albert Sans', sans-serif; /* Ensure font consistency */
    font-size: clamp(1.8rem, 3.5vw, 2.5rem); /* Adjusted clamp for form title */
    margin-bottom: 1rem;
    color: #fff;
    text-align: center; /* Center heading inside the form */
    transition: color 0.3s ease; /* Subtle transition for fun */
}
.contact-form-adjust .contact-h2-adjust:hover {
    color: #aad8ff;
}

.contact-form-adjust .contact-p-adjust { /* Target specifically within the form container */
    color: #e0f2ff; /* Lighter color for paragraph on dark background */
    font-size: clamp(0.9rem, 1.8vw, 1.1rem); /* Adjusted clamp for paragraph */
    line-height: 1.5;
    padding-bottom: 1.5rem;
    text-align: center; /* Center paragraph inside the form */
    transition: color 0.3s ease;
}
.contact-form-adjust .contact-p-adjust:hover {
    color: #fff;
}


/* --- Media Queries for Responsiveness --- */

/* Tablet and Smaller Desktops (approx. 992px and below) */
@media (max-width: 992px) {
    #contact {
        flex-direction: column; /* Stack image and form vertically */
        padding: 3rem 1rem;
    }

    .contact-rows {
        flex: 1 1 100%; /* Each item takes full width */
        max-width: 700px; /* Constrain max width for readability/aesthetic */
        margin: 1.5rem 0; /* Adjust margin when stacked, more space */
    }

    #contact-image-adjust {
        order: -1; /* Place image above form */
    }

    .contact-form-adjust {
        padding: 2rem; /* Maintain decent padding */
    }

    .contact-form-adjust .contact-h2-adjust,
    .contact-form-adjust .contact-p-adjust {
        text-align: center; /* Center text on tablets */
    }
    
    /* Animation adjustments for stacked layout */
    #contact-image-adjust.is-in-view {
        animation: slideUp 1s ease-out forwards; /* Use slideUp when stacked */
    }

    .contact-form-adjust.is-in-view {
        animation: slideUp 1s ease-out forwards; /* Use slideUp when stacked */
        animation-delay: 0.2s; /* Maintain stagger */
    }
}

/* Mobile Phones (approx. 768px and below) */
@media (max-width: 768px) {
    #contact {
        padding: 2rem 0.5rem;
    }

    .contact-rows {
        margin: 1rem 0; /* Reduce margin further */
    }

    .contact-form-adjust {
        padding: 1.5rem; /* More reduced padding */
    }

    .contact-form-adjust input,
    .contact-form-adjust textarea,
    .contact-form-adjust form button[type="submit"] {
        padding: 0.75rem; /* Slightly smaller padding for inputs/buttons */
        font-size: 0.95rem;
    }

    .contact-form-adjust .contact-h2-adjust {
        font-size: 1.6rem; /* Fixed smaller size for small phones */
    }

    .contact-form-adjust .contact-p-adjust {
        font-size: 0.85rem; /* Fixed smaller size */
        padding-bottom: 1rem;
    }
}

/* Modal styles (moved and slightly adjusted for organization) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    display: flex; /* Use flexbox to center content */
    align-items: center; /* Vertically center */
    justify-content: center; /* Horizontally center */
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none; /* Allows clicks to pass through when hidden */
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #fff;
    margin: auto; /* For browsers that don't fully support flex centering */
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    transform: translateY(-20px); /* Initial state for slide-in effect */
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.modal-content p {
    color: #555;
    margin-bottom: 25px;
    font-size: 1.1em;
}

.modal-content button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.modal-content button:hover {
    background-color: #0056b3;
}

/* Specific styles for success/error within the modal */
.modal-content.success {
    border: 2px solid #28a745; /* Green border for success */
}
.modal-content.error {
    border: 2px solid #dc3545; /* Red border for error */
}

/* Loading spinner styles */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007bff; /* Blue spinner */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
    display: none; /* Hidden by default */
}