/* =======================================================
   IMPROVED LOGIN PAGE DESIGN (REBRANDED FOR Bin Rafiq)
   ======================================================= */

/* --- Base and Page Layout --- */
body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background-color: var(--body-bg, #f4f4f4);
}

.auth-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* --- Main Login/Signup Card --- */
.auth-container {
    display: flex;
    width: 100%;
    max-width: 900px;
    /* ⭐ FIX: Height is now flexible. Removed fixed min-height. */
    min-height: 650px; /* Ensures a good base height for the image */
    background-color: var(--white, #ffffff);
    border-radius: var(--border-radius-lg, 24px);
    box-shadow: var(--card-shadow, 0 8px 30px rgba(0, 0, 0, 0.1));
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
}

/* --- Left Side: Image Panel --- */
.auth-image-panel {
    flex: 1 1 45%;
    position: relative;
}
.auth-image-panel::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(54, 33, 179, 0.3), transparent);
}
.auth-image-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Right Side: Form Panel --- */
.auth-form-panel {
    flex: 1 1 55%;
    padding: 40px 50px;
    display: flex; /* This is crucial for the vertical centering fix */
    flex-direction: column;
    /* ⭐ FIX: Removed justify-content: center to allow content to flow naturally */
    position: relative;
}

/* 
=================================================
--- ⭐ CORRECTED FORM TOGGLING & LAYOUT ⭐ ---
=================================================
*/

.auth-form {
    width: 100%;
    /* ⭐ FIX: This vertically centers the form ONLY if there is extra space.
       For tall forms like registration, it allows them to take up full height. */
    margin: auto 0; 
}

.auth-form.is-hidden {
    /* ⭐ FIX: Changed from absolute positioning to simple display:none.
       This is a more robust way to toggle visibility and ensures correct layout. */
    display: none;
}

/* --- Logo and Typography --- */
.auth-logo {
    display: block;
    max-width: 120px;
    height: auto;
    margin: 0 auto 25px auto;
}
.auth-form-panel h2 {
    text-align: center;
    color: var(--text-dark, #333);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 10px 0;
}
.auth-subheading {
    text-align: center;
    color: var(--text-light, #666);
    font-size: 0.95rem;
    margin: 0 0 30px 0;
}

/* --- Input Fields with Icons --- */
.form-group {
    position: relative;
    margin-bottom: 18px;
}
.form-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light, #666);
    font-size: 0.9rem;
    transition: color 0.3s ease;
}
.form-group input {
    width: 100%;
    padding: 14px 18px 14px 50px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--border-radius-md, 12px);
    color: var(--text-dark, #333);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}
.form-group input::placeholder { color: var(--text-light, #666); }
.form-group input:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px var(--light-cyan-bg);
}
.form-group input:focus ~ i {
    color: var(--primary-cyan);
}

/* --- Password Toggle Icon --- */
.toggle-password {
    right: 18px;
    left: auto;
    cursor: pointer;
}

/* --- Messages: Error and Success with Icons --- */
.error-container,
.success-container {
    padding: 15px 15px 15px 50px;
    border-radius: var(--border-radius-md, 12px);
    margin-bottom: 20px;
    text-align: left;
    position: relative;
}
.error-container {
    background: #FFF0F1;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
}
.success-container {
    background: var(--light-cyan-bg);
    color: #00636e;
    border: 1px solid var(--primary-cyan);
}
.error-container p, .success-container p { margin: 0; }
.error-container::before,
.success-container::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}
.success-container::before {
    content: '\f058';
    color: var(--primary-cyan);
}
.error-container::before {
    content: '\f06a';
    color: var(--danger-red);
}

/* --- Buttons & Links --- */
.form-button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--border-radius-md, 12px);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--primary-cyan);
    background: linear-gradient(90deg, var(--primary-violet) 0%, var(--accent-magenta) 100%);
    box-shadow: 0 4px 15px rgba(54, 33, 179, 0.2);
    margin-top: 10px;
    background-size: 200% auto;
    transition: all 0.4s ease;
}
.form-button:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(212, 0, 255, 0.3);
}

.form-switcher { text-align: center; margin-top: 25px; font-size: 0.9rem; color: var(--text-light, #666); }
.form-switcher a.toggle-link {
    color: var(--primary-cyan);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}
.form-switcher a.toggle-link:hover {
    color: var(--primary-violet);
}

/* --- Keyframe Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive Design for Mobile --- */
@media (max-width: 850px) {
    .auth-image-panel { display: none; }
    .auth-form-panel { flex-basis: 100%; padding: 40px; }
    .auth-container { 
      flex-direction: column; 
      max-width: 450px; 
      min-height: auto; /* Allow height to be fully dynamic on mobile */
      height: auto;
    }
}
@media (max-width: 500px) {
    .auth-form-panel { padding: 30px 25px; }
    .auth-form-panel h2 { font-size: 1.5rem; }
}

/*
========================================
--- STYLES FOR FORGOT PASSWORD ---
========================================
*/
.form-options {
    display: flex;
    justify-content: flex-end;
    margin: -10px 0 15px 0;
    padding-right: 5px;
}
.form-options a {
    font-size: 14px;
    color: #888;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}
.form-options a:hover {
    color: #3621B3;
    text-decoration: underline;
}
.form-group .fa-lock {
    left: 18px;
}