/* =========================================
   Authentication Pages
   Login / Register
========================================= */

.auth-page {
    position: relative;
    min-height: calc(100vh - 90px);
    padding: 55px 0 80px;
    overflow: hidden;
    isolation: isolate;
    background:
            radial-gradient(
                    circle at 12% 18%,
                    rgba(214, 173, 85, .14),
                    transparent 30%
            ),
            radial-gradient(
                    circle at 88% 80%,
                    rgba(18, 52, 90, .55),
                    transparent 34%
            ),
            linear-gradient(
                    135deg,
                    #071426 0%,
                    #0b1f3a 52%,
                    #06101f 100%
            );
}

/* عناصر تزئینی پس‌زمینه */
.auth-page::before,
.auth-page::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    border: 1px solid rgba(214, 173, 85, .16);
    border-radius: 50%;
}

.auth-page::before {
    top: -180px;
    right: -140px;
    width: 420px;
    height: 420px;
    box-shadow:
            0 0 0 25px rgba(214, 173, 85, .025),
            0 0 0 55px rgba(214, 173, 85, .02);
}

.auth-page::after {
    bottom: -220px;
    left: -170px;
    width: 460px;
    height: 460px;
}

/* کانتینر اصلی کارت */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

/* کارت ورود و ثبت‌نام */
.auth-card {
    width: 100%;
    max-width: 500px;
    padding: 34px 38px 30px;
    color: var(--text-light);
    background:
            linear-gradient(
                    145deg,
                    rgba(255, 255, 255, .115),
                    rgba(255, 255, 255, .045)
            );
    border: 1px solid rgba(214, 173, 85, .38);
    border-radius: 18px;
    box-shadow:
            0 22px 60px rgba(0, 0, 0, .34),
            inset 0 1px 0 rgba(255, 255, 255, .08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.auth-card-register {
    max-width: 540px;
}

/* سربرگ کارت */
.auth-card-header {
    margin-bottom: 25px;
    text-align: center;
}

.auth-icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 16px;
    border: 1px solid rgba(214, 173, 85, .5);
    border-radius: 18px;
    color: var(--navy-deep);
    background:
            linear-gradient(
                    135deg,
                    var(--gold-light),
                    var(--gold)
            );
    box-shadow:
            0 8px 20px rgba(214, 173, 85, .2),
            inset 0 1px 0 rgba(255, 255, 255, .6);
    font-size: 29px;
}

.auth-card-header h1 {
    margin: 0 0 10px;
    color: var(--gold-light);
    font-size: 25px;
    font-weight: 800;
    line-height: 1.7;
}

.auth-card-header p {
    margin: 0 auto;
    max-width: 410px;
    color: var(--text-muted-light);
    font-size: 13px;
    line-height: 2;
}

/* فرم */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-label {
    display: block;
    color: #f4dfaa;
    font-size: 13px;
    font-weight: 700;
}

.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(214, 173, 85, .28);
    border-radius: 9px;
    outline: none;
    color: var(--text-light);
    background: rgba(3, 13, 27, .38);
    font-family: inherit;
    font-size: 13px;
    direction: rtl;
    transition:
            border-color .2s ease,
            box-shadow .2s ease,
            background .2s ease;
}

.auth-input::placeholder {
    color: #8f9dad;
}

.auth-input:hover {
    border-color: rgba(214, 173, 85, .52);
}

.auth-input:focus {
    border-color: var(--gold-light);
    background: rgba(3, 13, 27, .56);
    box-shadow:
            0 0 0 3px rgba(214, 173, 85, .13),
            0 5px 16px rgba(0, 0, 0, .16);
}

/* لینک فراموشی رمز */
.auth-forgot-link {
    color: var(--gold-light);
    font-size: 12px;
    transition: color .2s ease;
}

.auth-forgot-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* پیام خطای فیلدها */
.auth-field-error {
    display: block;
    color: #ffb4b4;
    font-size: 11px;
    line-height: 1.8;
}

/*
   JSF ممکن است پیام را به شکل جدول رندر کند.
   این قوانین ظاهر پیش‌فرض جدول را خنثی می‌کنند.
*/
.auth-field-error table,
.auth-field-error tbody,
.auth-field-error tr,
.auth-field-error td {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
}

/* گزینه‌ها */
.auth-options,
.auth-terms {
    margin-top: 1px;
}

.auth-check-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--text-muted-light);
    font-size: 12px;
    line-height: 1.9;
    cursor: pointer;
}

.auth-checkbox {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin-top: 3px;
    accent-color: var(--gold);
    cursor: pointer;
}

/* دکمه اصلی */
.auth-submit {
    width: 100%;
    min-height: 46px;
    margin-top: 4px;
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    color: var(--navy-deep);
    background:
            linear-gradient(
                    135deg,
                    var(--gold-light),
                    var(--gold)
            );
    box-shadow: 0 7px 18px rgba(214, 173, 85, .2);
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition:
            transform .2s ease,
            box-shadow .2s ease,
            background .2s ease;
}

.auth-submit:hover {
    color: var(--navy-deep);
    background:
            linear-gradient(
                    135deg,
                    #ffe59b,
                    var(--gold-light)
            );
    box-shadow: 0 10px 24px rgba(214, 173, 85, .3);
    transform: translateY(-2px);
}

.auth-submit:active {
    transform: translateY(0);
}

/* پیام‌های عمومی */
.auth-alert {
    display: block;
    width: 100%;
    margin: 0 0 18px;
    padding: 11px 13px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.9;
}

.auth-alert table,
.auth-alert tbody,
.auth-alert tr,
.auth-alert td {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
}

.auth-alert-danger {
    color: #ffd1d1;
    background: rgba(170, 45, 45, .2);
    border: 1px solid rgba(255, 125, 125, .32);
}

.auth-alert-success {
    color: #d8f7df;
    background: rgba(47, 145, 76, .2);
    border: 1px solid rgba(116, 222, 137, .32);
}

/* جداکننده */
.auth-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 25px 0 18px;
    color: #aeb9c6;
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(
            90deg,
            transparent,
            rgba(214, 173, 85, .35)
    );
}

.auth-divider::after {
    background: linear-gradient(
            90deg,
            rgba(214, 173, 85, .35),
            transparent
    );
}

.auth-divider span {
    padding: 0 14px;
    color: var(--gold-light);
}

/* ورود با گوگل */
.google-login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 9px;
    color: var(--text-light);
    background: rgba(255, 255, 255, .07);
    font-size: 13px;
    font-weight: 700;
    transition:
            color .2s ease,
            background .2s ease,
            border-color .2s ease,
            transform .2s ease;
}

.google-login-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, .13);
    border-color: rgba(255, 255, 255, .38);
    transform: translateY(-2px);
}

.google-icon {
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    color: #4285f4;
    background: #fff;
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    direction: ltr;
}

/* پایین کارت */
.auth-footer-text {
    margin-top: 23px;
    color: var(--text-muted-light);
    text-align: center;
    font-size: 12px;
    line-height: 2;
}

.auth-link {
    margin-right: 4px;
    color: var(--gold-light);
    font-weight: 800;
    transition: color .2s ease;
}

.auth-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* حالت خطادار ورودی‌ها */
.auth-input.error,
.auth-input[aria-invalid="true"] {
    border-color: #e57979;
}

.auth-input.error:focus,
.auth-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(229, 121, 121, .14);
}

/* =========================================
   Responsive Authentication
========================================= */

@media (max-width: 576px) {
    .auth-page {
        min-height: calc(100vh - 70px);
        padding: 28px 0 48px;
    }

    .auth-card,
    .auth-card-register {
        max-width: none;
        padding: 27px 19px 24px;
        border-radius: 14px;
    }

    .auth-card-header {
        margin-bottom: 21px;
    }

    .auth-icon {
        width: 54px;
        height: 54px;
        margin-bottom: 12px;
        border-radius: 15px;
        font-size: 25px;
    }

    .auth-card-header h1 {
        font-size: 21px;
    }

    .auth-card-header p {
        font-size: 12px;
        line-height: 1.9;
    }

    .auth-form {
        gap: 15px;
    }

    .auth-input {
        height: 44px;
        font-size: 12px;
    }

    .auth-label {
        font-size: 12px;
    }

    .auth-submit {
        min-height: 44px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .auth-card,
    .auth-card-register {
        padding-right: 15px;
        padding-left: 15px;
    }

    .auth-label-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .auth-forgot-link {
        font-size: 11px;
    }
}
