/* ==========================================================================
   Login / register / reset-password popup (layouts/partials/auth-modal).
   Self-contained: the pages it opens over (frontend/index3, layouts.app)
   don't load modern-ui.css, so the tokens and the few .mu-* primitives the
   reused auth forms rely on are redefined here, scoped to the popup.
   ========================================================================== */

#auth-modal {
    --brand: #00398f;
    --brand-dark: #002a68;
    --brand-soft: #eaf0fb;
    --ink: #16233f;
    --ink-soft: #5b6b8c;
    --line: #e7ecf5;
    --surface: #ffffff;
    --surface-soft: #f5f8fd;
    direction: rtl;
}

#auth-modal .modal-dialog {
    max-width: 420px;
}

#auth-modal .modal-content {
    border: none;
    border-radius: 18px;
    box-shadow: 0 24px 60px -20px rgba(0, 30, 80, .35);
    overflow: hidden;
}

.auth-pop {
    padding: 18px 24px 20px;
    color: var(--ink);
}

.auth-pop__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.auth-pop__head .btn-close {
    margin: 0;
    font-size: 12px;
}

.auth-pop__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--brand);
}

.auth-pop__tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.auth-pop__tabs button {
    flex: 1 1 0;
    padding: 8px 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    transition: background .15s, color .15s, box-shadow .15s;
}

.auth-pop__tabs button.is-active {
    background: var(--surface);
    color: var(--brand);
    box-shadow: 0 2px 8px rgba(20, 35, 70, .1);
}

.auth-pop__title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-pop__subtitle {
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 18px;
}

.auth-pop__body {
    transition: opacity .15s;
}

.auth-pop__body.is-busy {
    opacity: .5;
    pointer-events: none;
}

.auth-pop__foot {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
}

.auth-pop__link {
    border: none;
    background: none;
    padding: 0;
    color: var(--brand);
    font-weight: 600;
    cursor: pointer;
}

.auth-pop__link:hover {
    text-decoration: underline;
}

/* --- primitives used by the reused auth forms (see modern-ui.css) --- */

#auth-modal .mu-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
    display: inline-block;
}

#auth-modal .mu-field .form-control {
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    background: var(--surface-soft);
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

#auth-modal .mu-field .form-control:focus {
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

#auth-modal .mu-field .form-control.is-invalid {
    border-color: #dc3545;
}

#auth-modal .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

#auth-modal .form-check .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
    border: 1px solid #b7c2d6;
}

#auth-modal .mu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 11px 24px;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    box-shadow: 0 12px 24px -12px rgba(0, 57, 143, .55);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}

#auth-modal .mu-btn:hover,
#auth-modal .mu-btn:focus {
    color: #fff;
    transform: translateY(-1px);
}

#auth-modal .mu-btn[disabled] {
    opacity: .65;
    transform: none;
}

#auth-modal .mu-btn-ghost {
    background: var(--surface);
    color: var(--brand);
    border: 1.5px solid var(--line);
    box-shadow: none;
}

#auth-modal .mu-btn-ghost:hover {
    color: var(--brand);
    border-color: var(--brand);
    background: var(--brand-soft);
}

#auth-modal .mu-btn-block {
    width: 100%;
}

/* Phones: slide up from the bottom as a sheet, so the page behind stays
   visible above it (same idea as the template's category .m-modal). */
@media (max-width: 575.98px) {
    #auth-modal .modal-dialog {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        max-width: none;
        min-height: 0;
        align-items: flex-end;
    }

    #auth-modal.fade .modal-dialog {
        transform: translateY(100%);
        transition: transform .25s ease-out;
    }

    #auth-modal.show .modal-dialog {
        transform: none;
    }

    #auth-modal .modal-content {
        border-radius: 18px 18px 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }

    .auth-pop {
        padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
    }
}
