/* --- Global Styles & Variables --- */
:root {
    --primary-color: #004d40;
    --primary-darker: #002a22;
    --primary-lighter: #00796b;
    --accent-color: #ffab40;
    --light-text: #ffffff;
    --dark-text: #212121;
    --border-color: rgba(255, 255, 255, 0.3);
    --error-bg: #ffebee;
    --error-text: #c62828;
}

/* Universal Reset and Best Practices */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Albert Sans', sans-serif;
    background-color: #000;
    color: var(--light-text);
    /* Prevent scrolling on desktop, will be enabled for mobile */
    overflow: hidden; 
}

/* --- Main Login Container (Grid Layout) --- */
.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    /* Use min-height to ensure it's at least screen height but can grow on mobile */
    min-height: 100vh; 
}

/* --- 1. Branding Section (Left) --- */
.login-branding {
    position: relative;
    overflow: hidden;
    display: flex;
    background-image: url('../styles/pic3.jpg');
    background-size: cover;
    background-position: center;
    animation: kenBurnsEffect 20s ease-in-out infinite alternate;
}

@keyframes kenBurnsEffect {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.branding-overlay {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, rgba(0, 77, 64, 0.75), rgba(0, 121, 107, 0.5));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);


}

.branding-overlay .logo { max-width: 120px; margin-bottom: 25px; }
.branding-overlay h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 15px; }
.branding-overlay p { font-size: 1.1rem; font-weight: 400; max-width: 400px; margin: 0 auto; }


/* --- 2. Form Section (Right) --- */
.login-form-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    position: relative;
    background: linear-gradient(225deg, var(--primary-darker) 0%, var(--primary-color) 35%, var(--primary-lighter) 100%);
    background-size: 200% 200%;
    animation: gradientAnimation 15s ease infinite;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.form-box {
    width: 100%; max-width: 400px; padding: 40px 35px;
    background: rgba(255, 255, 255, 0.1); border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}
.form-box h2 {
    text-align: center; margin-bottom: 30px; font-weight: 600; font-size: 1.8rem;
}
.input-group { position: relative; margin-bottom: 25px; }
.form-input { width: 100%; padding: 14px 14px 14px 45px; background-color: rgba(255, 255, 255, 0.15); border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px; color: var(--light-text); transition: all 0.3s ease; }
.form-input::placeholder { color: transparent; }
.form-input:focus { outline: none; border-color: var(--accent-color); background-color: rgba(255, 255, 255, 0.2); }
.form-label { position: absolute; top: 15px; left: 45px; font-size: 16px; color: rgba(255, 255, 255, 0.7); pointer-events: none; transition: all 0.3s ease; }
.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label { top: -10px; left: 15px; font-size: 12px; color: var(--accent-color); background-color: var(--primary-color); padding: 0 5px; border-radius: 4px; }
.input-icon { position: absolute; left: 15px; top: 15px; color: rgba(255, 255, 255, 0.7); transition: color 0.3s ease; }
.form-input:focus ~ .input-icon { color: var(--accent-color); }
#togglePassword { position: absolute; right: 15px; top: 15px; cursor: pointer; color: rgba(255, 255, 255, 0.7); }
.form-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; font-size: 14px; }
.remember-me { cursor: pointer; display: flex; align-items: center; }
.remember-me input { margin-right: 8px; accent-color: var(--accent-color); }
.forgot-password { color: rgba(255, 255, 255, 0.8); text-decoration: none; }
.forgot-password:hover { color: var(--accent-color); text-decoration: underline; }
.login-btn { width: 100%; padding: 14px; background: var(--accent-color); color: var(--dark-text); border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; display: flex; justify-content: center; align-items: center; gap: 10px; }
.login-btn:hover { background: var(--light-text); box-shadow: 0 0 15px var(--accent-color); }
.login-btn .fa-arrow-right { transition: transform 0.3s ease; }
.login-btn:hover .fa-arrow-right { transform: translateX(5px); }
.error-message { background: var(--error-bg); color: var(--error-text); padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border: 1px solid var(--error-text); display: none; }

/* --- Footer --- */
.form-footer {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    padding: 8px 20px; background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    font-size: 13px; color: rgba(255, 255, 255, 0.7);
    white-space: nowrap; transition: all 0.3s ease;
}
.form-footer:hover { transform: translateX(-50%) translateY(-3px); box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3); }
.form-footer a { color: #ffffff; font-weight: 600; text-decoration: none; transition: color 0.3s ease; }
.form-footer a:hover { color: var(--accent-color); }


/*
=====================================
=== FULLY RESPONSIVE MEDIA QUERIES ===
=====================================
*/

@media (max-width: 992px) {
    body {
        /* CRITICAL FIX: Allow vertical scrolling ONLY on smaller screens */
        overflow-y: auto;
    }

    .login-container {
        /* CRITICAL FIX: Stack the columns and allow height to be determined by content */
        grid-template-columns: 1fr;
        height: auto; 
    }

    .login-branding { 
        min-height: 300px;
        grid-row: 1; 
    }

    .login-form-wrapper {
        /* CRITICAL FIX: Ensure the form wrapper fills at least the screen height on its own */
        min-height: 100vh;
        padding: 60px 20px; /* Increase vertical padding for better spacing */
    }

    .branding-overlay h1 { font-size: 2rem; }

    .form-footer {
        position: static; 
        transform: none;
        margin-top: 40px;
        text-align: center;
        width: auto;
        white-space: normal;
        padding: 10px 15px;
    }
}

/* --- For smaller mobile phones --- */
@media (max-width: 576px) {
    .login-form-wrapper {
        padding: 40px 15px;
    }
    .form-box {
        padding: 30px 25px;

    }
    .branding-overlay h1 {
        font-size: 1.8rem;
    }
    .branding-overlay p {
        font-size: 1rem;
    }
}



/* Tablets (landscape and portrait) */
@media (max-width: 992px) {
    .login-container {
        grid-template-columns: 1fr;
    }

    .login-branding {
        min-height: 250px;
    }

    .login-form-wrapper {
        min-height: auto;
        padding: 40px 20px;
    }

    .form-box {
        width: 100%;
        max-width: 100%;
    }
}

/* Small tablets & large phones */
@media (max-width: 768px) {
    .branding-overlay h1 {
        font-size: 1.8rem;
    }

    .branding-overlay p {
        font-size: 1rem;
    }

    .form-box {
        padding: 25px 20px;
    }

    .login-btn {
        font-size: 15px;
        padding: 12px;
    }
}

/* Mobile phones */
@media (max-width: 576px) {
    body {
        overflow-y: auto; /* enable scrolling */
    }

    .login-branding {
        min-height: 200px;
        background-position: center;
    }

    .branding-overlay .logo {
        max-width: 90px;
    }

    .branding-overlay h1 {
        font-size: 1.5rem;
    }

    .branding-overlay p {
        font-size: 0.9rem;
    }

    .form-box {
        padding: 20px 15px;
    }

    .form-footer {
        font-size: 12px;
        margin-top: 20px;
        padding: 8px 12px;
    }
}


/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
}

/* Ensure container doesn't push outside */
.login-container,
.login-branding,
.login-form-wrapper {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
}

