/* ================== VARIABLES & GLOBAL STYLES ================== */
:root {
    --primary-color: #0d47a1; /* كحلي - اللون الرئيسي */
    --primary-dark: #002171; /* كحلي أغمق */
    --secondary-color: #f5f8ff; /* خلفية هادئة للجزء الأبيض */
    --text-dark: #212529; /* لون النص الأساسي */
    --text-light: #6c757d; /* لون النص الثانوي */
    --white-color: #ffffff;
    --border-color: #dee2e6; /* لون الحدود */
    --google-color: #DB4437; /* لون جوجل */
    --facebook-color: #4267B2; /* لون فيسبوك */
    --error-color: #dc3545; /* لون الخطأ */
    --success-color: #28a745; /* لون النجاح */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    line-height: 1.7;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* ================== AUTH WRAPPER & LAYOUT ================== */
.auth-wrapper {
    display: flex;
    width: 100%;
    max-width: 1100px;
    min-height: 650px;
    background-color: var(--white-color);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ================== AUTH SHOWCASE (الجزء الأيسر الأزرق) ================== */
.auth-showcase {
    flex-basis: 50%;
    background: linear-gradient(-45deg, var(--primary-color), var(--primary-dark));
    color: var(--white-color);
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.showcase-cap-icon {
    font-size: 120px;
    color: var(--white-color);
    margin-bottom: 30px;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.4));
    transition: all 0.3s ease-in-out;
}

.showcase-cap-icon:hover {
    transform: translateY(-6px) scale(1.03);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.6));
}

.showcase-title {
    font-size: 40px;
    font-weight: 900;
    margin-bottom: 18px;
    line-height: 1.2;
}

.showcase-description {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 40px;
    max-width: 400px;
}

.showcase-graphic {
    font-size: 120px;
    opacity: 0.15;
    margin-top: 20px;
    color: var(--white-color);
}

/* ================== AUTH FORM PANEL (الجزء الأيمن الأبيض) ================== */
.auth-form-panel {
    flex-basis: 50%;
    padding: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================== FORM STYLES & TRANSITIONS ================== */
.auth-form {
    width: 100%;
    max-width: 380px;
    /* We use absolute positioning to easily switch between forms */
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, visibility 0.3s;
}

.auth-form.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.form-header {
    text-align: center;
    margin-bottom: 30px;
}
.form-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}
.form-header p {
    color: var(--text-light);
    font-size: 15px;
}

/* --- Floating Label Effect --- */
.form-group.floating {
    position: relative;
    margin-bottom: 28px;
}
.form-control {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
    font-size: 16px;
    transition: border-color 0.3s;
    color: var(--text-dark);
}
.form-control:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}
.form-group.floating label {
    position: absolute;
    top: 12px;
    right: 0;
    font-size: 16px;
    color: var(--text-light);
    pointer-events: none;
    transition: all 0.2s ease-in-out;
}
.form-control:focus + label,
.form-control:not(:placeholder-shown) + label {
    top: -12px;
    font-size: 13px;
    color: var(--primary-color);
}

.toggle-password-icon {
    position: absolute;
    top: 15px;
    left: 10px;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
}
.toggle-password-icon:hover {
    color: var(--primary-color);
}

.form-link {
    display: block;
    text-align: left;
    margin-top: -10px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}
.form-link:hover {
    color: var(--primary-color);
}

/* ================== BUTTONS & SEPARATOR ================== */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.form-separator {
    text-align: center;
    margin: 25px 0;
    color: var(--text-light);
    display: flex;
    align-items: center;
    font-size: 14px;
}
.form-separator span {
    padding: 0 15px;
}
.form-separator::before, .form-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.btn-social {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--white-color);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    color: var(--text-dark);
}
.btn-social i {
    font-size: 18px;
}
.btn-social.google:hover { background-color: #f7f7f7; border-color: var(--google-color); color: var(--google-color); }
.btn-social.facebook:hover { background-color: #f7f7f7; border-color: var(--facebook-color); color: var(--facebook-color); }

.form-footer {
    text-align: center;
    margin-top: 25px;
    color: var(--text-light);
    font-size: 15px;
}
.form-footer a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
}
.form-footer a:hover {
    text-decoration: underline;
}

/* ================== STYLES FOR VERIFICATION CODE INPUT ================== */
.code-input-group {
    direction: ltr; /* هذا السطر سيجعل الخانات تترتب من اليسار لليمين */
}


.code-input-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 35px 0;
}

.code-input {
    width: 48px;
    height: 60px;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background-color: var(--secondary-color);
    color: var(--text-dark);
    transition: border-color 0.3s, box-shadow 0.3s;
    -moz-appearance: textfield; /* Firefox */
}
.code-input::-webkit-outer-spin-button,
.code-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 71, 161, 0.15);
}
.code-input.error {
    border-color: var(--error-color);
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ================== CUSTOM MESSAGE BOX (MODAL) STYLES ================== */
#message-box {
    position: fixed;
    top: -150px; /* Start hidden off-screen */
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: 8px;
    background-color: #333; /* Default dark */
    color: white;
    z-index: 1000;
    transition: top 0.5s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

#message-box.show {
    top: 20px; /* Slide in */
}

#message-box.success {
    background-color: var(--success-color); /* Green */
}

#message-box.error {
    background-color: var(--error-color); /* Red */
}


/* ================== RESPONSIVE DESIGN (FINAL REFINEMENT) ================== */

/* --- For Tablets (and below) --- */
@media (max-width: 992px) {
    body {
        align-items: flex-start; 
        overflow-y: auto;
    }
    .auth-wrapper {
        flex-direction: column;
        min-height: 100vh;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    .auth-showcase {
        /* Make the blue section a compact header, not a huge block */
        flex-basis: auto; 
        padding: 50px 30px; 
        min-height: auto;
    }
    .showcase-cap-icon { font-size: 80px; margin-bottom: 20px; }
    .showcase-title { font-size: 30px; margin-bottom: 12px; }
    .showcase-description { font-size: 16px; max-width: 90%; margin-bottom: 0; }
    .showcase-graphic { display: none; } /* Hide decorative graphic to save space */

    .auth-form-panel {
        flex-basis: auto;
        flex-grow: 1;
        /* Give the form more vertical breathing room */
        padding: 70px 30px; 
    }
    .auth-form {
        max-width: 400px; 
        margin: 0 auto;
        /* THIS IS CRUCIAL: change position for natural document flow on mobile */
        position: relative; 
        /* Reset transforms from desktop view */
        opacity: 1;
        visibility: visible;
        transform: none;
        /* Hide non-active forms on mobile */
        display: none;
    }
    .auth-form.active {
        display: block;
    }
}

/* --- For Small Mobiles --- */
@media (max-width: 576px) {
    .auth-showcase {
        padding: 40px 20px;
    }
    .showcase-cap-icon {
        font-size: 60px;
        margin-bottom: 15px;
    }
    .showcase-title {
        font-size: 24px;
    }
    .showcase-description {
        font-size: 14px;
    }

    .auth-form-panel {
        padding: 50px 20px;
    }
    .auth-form {
        max-width: 100%; 
    }
    .form-header h2 {
        font-size: 22px;
    }
    .btn-primary, .btn-social {
        padding: 13px;
        font-size: 15px;
    }
    .code-input-group {
        gap: 8px;
    }
    .code-input {
        /* This is the key change: make inputs flexible */
        flex-grow: 1;
        width: 1%; /* A trick to make flex-grow work correctly */
        height: 58px;
        font-size: 1.8rem;
    }
}
