/* Basic Reset & Body Styling */
html, body {
    height: 100%; /* Crucial for full viewport height */
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    display: flex; /* Flexbox for centering */
    justify-content: center; /* Centers horizontally */
    align-items: center; /* Centers vertically */
    min-height: 100vh; /* Ensures body is at least full viewport height */
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); /* Gradient background */
    color: #333;
    overflow: hidden; /* Hide overflow during initial animations */

    /* NEW FOR PAGE FADE-OUT TRANSITION */
    transition: opacity 0.5s ease-out, transform 0.5s ease-out; /* Smooth transition for the page itself */
}

/* Class added by JS for page fade-out */
body.fade-out-page {
    opacity: 0;
    transform: scale(0.95); /* Optional: slight shrink effect */
}


.login-container {
    perspective: 1000px; /* Needed for 3D transforms */
    padding: 20px; /* Padding around the box itself */
    box-sizing: border-box; /* Include padding in the width calculation */
    width: 100%; /* Allow it to take full width of its parent */
    max-width: 600px; /* Limit the maximum width for very large screens */
}

.login-box {
    background-color: #fff;
    padding: 60px 40px; /* Increased padding for expanded feel */
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25); /* Deeper shadow */
    text-align: center;
    width: 100%; /* Makes it fill its container */
    max-width: 500px; /* Max width for the internal box */
    opacity: 0; /* Starts hidden for the main box animation */
    transform: translateY(-50px); /* Starts slightly above its final position */
    animation: fadeInSlideDown 1s ease-out forwards; /* Main box entrance animation */
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, opacity 0.8s ease-out; /* Smooth transitions for hover AND JS fade */
}

.login-box:hover {
    transform: translateY(-5px) scale(1.01); /* Lifts slightly and scales a tiny bit */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); /* Deeper shadow on hover */
}

/* Keyframe for the main login-box entrance */
@keyframes fadeInSlideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    color: #333;
    margin-bottom: 15px; /* Adjusted margin */
    font-size: 2.8em; /* Made title bigger */
    opacity: 0; /* Start hidden for staggered animation */
    transform: translateY(20px); /* Start slightly below */
    animation: fadeInSlideUp 0.8s ease-out forwards;
    animation-delay: 0.5s; /* Staggered delay */
}

p {
    color: #666;
    margin-bottom: 40px; /* Adjusted margin */
    font-size: 1.1em; /* Made tagline bigger */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.8s ease-out forwards;
    animation-delay: 0.7s; /* Staggered delay */
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.8s ease-out forwards;
}

.input-group:nth-of-type(1) { /* First input group (username) */
    animation-delay: 0.9s;
}

.input-group:nth-of-type(2) { /* Second input group (password) */
    animation-delay: 1.1s;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="password"] {
    width: calc(100% - 24px); /* Account for padding */
    padding: 14px 12px; /* Slightly more padding for a bigger feel */
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 17px; /* Slightly larger font */
    transition: border-color 0.3s ease; /* Smooth transition for focus */
    background-color: #fff; /* Ensure they have a white background */
    color: #333; /* Ensure text is a dark color */
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #2575fc; /* Highlight on focus */
}

.login-button {
    background-color: #2575fc;
    color: white;
    padding: 15px 25px; /* Bigger button */
    border: none;
    border-radius: 8px;
    font-size: 1.2em; /* Bigger font */
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: 100%;
    margin-top: 15px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.8s ease-out forwards;
    animation-delay: 1.3s; /* Staggered delay */
}

.login-button:hover {
    background-color: #1a5ac7;
    transform: translateY(-2px); /* Slight lift on hover */
}

.forgot-password {
    display: block;
    margin-top: 20px;
    color: #2575fc;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.8s ease-out forwards;
    animation-delay: 1.5s; /* Staggered delay */
}

.forgot-password:hover {
    color: #1a5ac7;
    text-decoration: underline;
}

/* Universal Keyframe for elements sliding up and fading in */
@keyframes fadeInSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles for Login Messages and Spinner (from JS interactivity section) */
.message {
    font-weight: bold;
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    background-color: #f0f0f0;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: calc(100% - 20px); /* Adjust width to fit container with padding */
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.message.success {
    background-color: #4CAF50; /* Green */
    color: white;
}

.message.error {
    background-color: #f44336; /* Red */
    color: white;
}

/* Basic spinner CSS (optional, but adds nice visual feedback) */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-left: 20px; /* Space from text */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Ensure this style exists if you put the loading screen inside the body directly */
.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    font-size: 2em;
    text-align: center;
    animation: fadeIn 1s forwards;
}
