/* --- Basic Reset and Typography --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f4f8; /* Light background for the overall page */
}

.container {
    display: flex;
    width: 80%; /* Total width of the login container */
    max-width: 1000px; /* Optional: maximum size */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden; /* Important for border-radius */
    min-height: 600px;
    background-color: white;
}

/* --- 1. Left Half: Logo/Visual Section --- */
.logo-section {
    flex: 1; /* Takes 50% of the container width */
    background: #008080; /* Primary brand color gradient */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.logo-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.logo-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.logo-icon {
    font-size: 6rem; /* Large icon for visual impact */
    margin-top: 30px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* --- 2. Right Half: Login Form Section --- */
.login-section {
    flex: 1; /* Takes 50% of the container width */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background-color: white;
}

.login-box {
    width: 100%;
    max-width: 350px; /* Constrain form width inside its half */
}

.login-box h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 30px;
    border-left: 5px solid #4a90e2; /* Accent line */
    padding-left: 10px;
}

/* Input Group Styling */
.input-group, .captcha-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box; /* Ensures padding doesn't increase width */
    transition: border-color 0.3s;
}

input:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.2);
}

/* CAPTCHA Specific Styling */
.captcha-display-area {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    border: 1px dashed #adb5bd;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

#captchaDisplay {
    flex-grow: 1;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 5px;
    color: #333;
    /* Optional: Add a slight text-shadow for a 'code' look */
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1); 
    user-select: none; /* Prevent text selection */
}

#refreshCaptcha {
    background: none;
    border: none;
    color: #0056b3;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 10px;
    transition: color 0.2s;
}

#refreshCaptcha:hover {
    color: #4a90e2;
}

.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 5px;
    height: 1.2em; /* Reserve space for error message */
}

/* Button Styling */
.login-button {
    width: 100%;
    padding: 12px;
    background-color: #008080;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    margin-top: 10px;
}

.login-button:hover {
    background-color: #4a90e2;
}

.login-button:active {
    transform: scale(0.99);
}

/* Footer Link */
.forgot-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}

.forgot-link a {
    color: #4a90e2;
    text-decoration: none;
}

/* --- Responsiveness (for smaller screens) --- */
@media (max-width: 768px) {
    .container {
        flex-direction: column; /* Stacks the halves vertically */
        width: 90%;
        min-height: auto;
        box-shadow: none; /* Simplify on mobile */
    }

    .logo-section {
        height: 200px; /* Give the logo section a fixed height */
        border-radius: 12px 12px 0 0;
    }

    .login-section {
        padding: 30px 20px;
    }
}
/* ... (Previous CSS code) ... */

/* Button Styling (Updates) */
.login-button {
    /* ... (Existing styles for width, padding, background, etc.) ... */
    position: relative; /* Essential for positioning the loader */
    overflow: hidden; /* Keeps the spinner inside the button */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 44px; /* Ensure button doesn't collapse when text is hidden */
}

/* Text inside the button */
.login-button .button-text {
    transition: opacity 0.3s;
}

/* State when button is loading (hides the text) */
.login-button.loading .button-text {
    opacity: 0;
}

/* --- Loader Spinner Styles --- */
.loader-spinner {
    display: none; /* Hidden by default */
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3); /* Light border */
    border-top-color: white; /* Colored top for the spin effect */
    border-radius: 50%;
    animation: spin 0.8s linear infinite; /* Spin animation */
    position: absolute; /* Position over the text */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* State when button is loading (shows the spinner) */
.login-button.loading .loader-spinner {
    display: block !important;
}

/* Keyframes for the spinning animation */
@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ... (Remaining CSS code) ... */