﻿/* ================================
   1) Variables / Helpers
   ================================ */
:root {
    /* Brand */
    --brand: #26a69a;
    --brand-hover: #1f8d83;
    /* Layout */
    --login-card-xpad: 30px;
    --field-xpad: 14px;
    --fw-strong: 700;
    --login-bg: #705757;
    /* Typography */
    --base-font-size: 14px;
    --heading-weight: 600;
    --text-weight: 400;
    /* Actions layout (you can tune these) */
    --actions-gap: 50px; /* المسافة الأفقية بين Login و Google */
    --actions-row-gap: 0px; /* المسافة الرأسية بين صف الأزرار وصف الرابط */
    --forgot-extra: 12px; /* Padding علوي إضافي لصف الرابط */
    --forgot-spacer: 0px; /* Spacer صريح قبل الرابط (لو محتاج) */
}

.auto-anim {
    display: none;
}

/* ================================
   2) Page Layout
   ================================ */
body.login {
    background: var(--login-bg);
    font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif !important;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.42857143;
    direction: ltr;
    padding: 0 !important;
    margin: 0 !important;
}

/* ================================
   3) Card (content)
   ================================ */
.content {
    background: #fff;
    border-radius: 14px;
    padding: 30px;
    max-width: 400px;
    margin: 30px auto;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    transition: box-shadow .25s ease;
}

    .content:hover {
        box-shadow: 0 10px 24px rgba(0,0,0,.20);
    }

.login .content {
    background-color: #eceef1;
    border-radius: 7px;
    width: 400px;
    margin: 40px auto 12px;
    padding-top: 10px;
    padding-inline: var(--login-card-xpad);
    position: relative;
    overflow: hidden;
}
    /* keep centered even if inline styles exist */
    .login .content[style*="margin-left"],
    .login .content[style*="margin-right"] {
        margin-left: auto !important;
        margin-right: auto !important;
    }

/* ================================
   4) Typography
   ================================ */
html, body {
    font-family: Verdana,Arial,sans-serif !important;
    font-size: var(--base-font-size) !important;
    font-weight: var(--text-weight) !important;
    line-height: 1.6 !important;
}

    body.ar, body.ar * {
        font-family: 'GE SS', Verdana, Arial, sans-serif !important;
    }

h1, h2, h3, h4, h5, h6, .form-title {
    font-weight: var(--heading-weight) !important;
    line-height: 1.3 !important;
}

.form-title {
    text-align: center;
    margin-bottom: 25px;
}

.login .form-control::placeholder {
    font-weight: var(--fw-strong);
    opacity: .85;
}

::placeholder {
    font-family: inherit !important;
    font-size: inherit !important;
}

*[style*="font-family"], [class*="font-"] {
    font-family: inherit !important;
}

/* ================================
   5) Form Blocks
   ================================ */
.login .login-form {
    padding-inline: 0;
}

.form-control {
    border-radius: 10px !important;
    padding: 12px var(--field-xpad);
    border: 1px solid #ddd;
    box-shadow: none !important;
    font-size: 15px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

    .form-control:focus {
        border-color: var(--brand);
        outline: 0;
        box-shadow: 0 0 0 3px rgba(38,166,154,.15) !important;
    }

#loginCard {
    position: relative;
}

/* Inputs direction */
input#UserName, input#Password {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] #UserName, html[dir="rtl"] #Password {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

    html[dir="rtl"] #UserName::placeholder, html[dir="rtl"] #Password::placeholder {
        text-align: right;
    }

html[dir="ltr"] #UserName::placeholder, html[dir="ltr"] #Password::placeholder {
    text-align: left;
}

/* ================================
   6) Buttons
   ================================ */
.btn {
    font-weight: 600;
    border-radius: 8px;
    transition: all .2s ease;
    line-height: 1.2;
    font-size: calc(var(--base-font-size) * 0.95) !important;
}

    .btn.green {
        background-color: var(--brand);
        border-color: var(--brand);
        color: #fff;
        padding: 10px 20px;
    }

        .btn.green:hover {
            background-color: var(--brand-hover);
            border-color: var(--brand-hover);
        }

#submit {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box;
    height: 40px;
    width: 125px;
    margin: 0 !important;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background .2s;
}

    #submit:hover {
        background: var(--brand-hover);
    }

/* Google round button */
#btnGoogle, .btn.google-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff !important;
    border: 1px solid var(--brand) !important;
    color: var(--brand) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    padding: 0;
    cursor: pointer !important;
    transition: background .2s, color .2s, border-color .2s;
}

    #btnGoogle .g-logo {
        width: 20px;
        height: 20px;
        display: inline-block;
        vertical-align: middle;
        pointer-events: none;
    }

    #btnGoogle:hover, #btnGoogle:active {
        background: var(--brand) !important;
        border-color: var(--brand-hover) !important;
        color: #fff !important;
    }

    #btnGoogle:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(38,166,154,.15);
    }

    #btnGoogle[disabled] {
        cursor: not-allowed !important;
        opacity: .7;
    }

/* ================================
   7) GSI helpers
   ================================ */
.gsi-ctr {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 0;
    box-sizing: content-box;
}

    .gsi-ctr .g_id_signin, .gsi-ctr .g_id_signin > div {
        line-height: 0;
    }

    .gsi-ctr.round .g_id_signin {
        overflow: hidden;
        border-radius: 50%;
    }

/* ================================
   8) Info / Alerts / Footer
   ================================ */
.create-account {
    margin-top: -12px !important;
    padding: 16px 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    font-size: 15px;
    color: #444;
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
    transition: box-shadow .2s ease, transform .2s ease;
}

    .create-account:hover {
        box-shadow: 0 4px 10px rgba(0,0,0,.07);
        transform: translateY(-1px);
    }

    .create-account p {
        margin: 0;
        line-height: 1.6;
        font-weight: 400 !important;
    }

    .create-account a {
        font-weight: 600;
        color: var(--brand);
        text-decoration: none;
        padding: 2px 6px;
        border-radius: 6px;
        transition: all .2s ease;
    }

        .create-account a:hover {
            background: var(--brand);
            color: #fff;
        }

.alert {
    border-radius: 10px;
}

.alert-danger {
    border-color: #f5c6cb;
}

.alert-success {
    border-color: #c3e6cb;
}

.copyright {
    margin-top: 8px;
}

/* ================================
   9) Language switch
   ================================ */
.lang-switch {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
    font-weight: 600;
}

html[dir="rtl"] .lang-switch {
    right: auto;
    left: 20px;
}

.lang-switch .lang-link {
    padding: 4px 10px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid transparent;
}

    .lang-switch .lang-link.active {
        border-color: #26a69a;
    }

.lang-switch .sep {
    margin: 0 6px;
    opacity: .6;
}

/* RTL helpers */
html[dir="rtl"] .form-title,
html[dir="rtl"] .form-group label {
    direction: rtl;
}

html[dir="rtl"] .create-account p {
    text-align: center !important;
}

/* ================================
   10) Form Actions (final, normalized)
   - Row 1: Login + GAP + Google (RTL/LTR aware)
   - Row 2: Forgot link centered
   ================================ */
html[dir] .form-actions {
    /* grid of 3 columns: button / gap / button */
    display: grid !important;
    grid-template-columns: auto var(--actions-gap) auto !important;
    grid-template-rows: auto auto !important;
    column-gap: 0 !important;
    row-gap: var(--actions-row-gap) !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 10px 0 0 !important;
}

/* LTR: Login left, Google right */
html[dir="ltr"] #submit {
    grid-area: 1 / 1 / 2 / 2 !important;
    justify-self: start !important;
}

html[dir="ltr"] #btnGoogle {
    grid-area: 1 / 3 / 2 / 4 !important;
    justify-self: end !important;
}

/* RTL: Login right, Google left */
html[dir="rtl"] #submit {
    grid-area: 1 / 3 / 2 / 4 !important;
    justify-self: end !important;
}

html[dir="rtl"] #btnGoogle {
    grid-area: 1 / 1 / 2 / 2 !important;
    justify-self: start !important;
}

/* Row 2: Forgot link centered across all columns and dropped a bit */
html[dir] .form-actions .forgot-inline {
    grid-area: 2 / 1 / 3 / 4 !important;
    justify-self: center !important;
    text-align: center !important;
    margin: 0 !important;
    float: none !important;
    padding-top: var(--forgot-extra) !important;
}

    html[dir] .form-actions .forgot-inline::before {
        content: "";
        display: block;
        height: var(--forgot-spacer);
    }

    /* Make "Forgot Password?" a plain text link */
    html[dir] .form-actions .forgot-inline a {
        display: inline !important;
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        color: #0d6efd !important;
        font-weight: 600;
        text-decoration: none;
        line-height: inherit;
    }

        html[dir] .form-actions .forgot-inline a:hover,
        html[dir] .form-actions .forgot-inline a:focus {
            text-decoration: underline;
        }

/* ================================
   11) OTP Modal (compact, normalized)
   ================================ */
.modal-backdrop.otp-backdrop {
    background: var(--login-bg) !important;
    opacity: 1 !important;
}

#OtpDialog {
    position: relative;
    margin: 80px auto 0;
    float: none !important;
    width: auto !important;
    max-width: 420px;
    min-width: 320px;
    left: 50%;
    transform: translateX(-50%);
}

@media (min-width:481px) {
    #OtpDialog {
        max-width: 520px;
        min-width: 340px;
    }
}

@media (max-width:480px) {
    #OtpDialog {
        width: 92vw !important;
        max-width: none;
        min-width: 0;
        margin-top: 60px;
    }
}

.otp-dialog {
    border-radius: 4px;
    border: 1px solid #d5d5d5;
    background: #fff;
    box-shadow: 1px 1px 7px 1px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: calc(100vh - 140px);
}

#OtpModal .modal-content {
    padding-inline: var(--login-card-xpad);
}

#OtpModal .modal-body {
    overflow: auto;
    padding-block: 8px;
    max-height: calc(100vh - 240px);
}

#OtpModal .modal-footer {
    padding-block: 10px;
}

/* Header: title left & X right (consistent) */
.otp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d5d5d5;
    padding: 10px 14px;
}

.otp-title {
    margin: 0;
    font-weight: 600;
    color: #2e2e2e;
}

.otp-close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    border: 0;
    background: transparent;
    cursor: pointer;
}

/* ================================
   12) OTP Inline Panel (inside login card)
   ================================ */
#otpPanel {
    display: none;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

    #loginCard .form-control, #otpPanel .form-control {
        max-width: 100%;
    }

.otp-body {
    padding-inline: 0;
}

.otp-footer {
    padding-inline: 0;
}

@media (max-width:480px) {
    #otpPanel {
        padding: 12px;
    }

    .otp-header {
        margin: -12px -12px 10px;
    }
}

/* ================================
   13) Misc
   ================================ */
.busy-box {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}
