/**
 * Auth UI design system (AUTH-IMPL-005R).
 * Armani form discipline + Narges brand. Scoped to .loginPage / .auth-card.
 */
.loginPage {
    --auth-orange: #f5a623;
    --auth-orange-hover: #e09412;
    --auth-ink: #2f2f2f;
    --auth-muted: #6b6b6b;
    --auth-line: #dedede;
    --auth-field-border: #c8c8c8;
    --auth-radius: 6px;
    --auth-focus: #873e3f;
    --auth-link: #1ca2bd;
    --auth-card-max: 400px;
    --auth-control-h: 42px;
    background: #f5f5f5;
    min-height: 100vh;
    padding-bottom: 96px;
}

.loginPage .main-content {
    text-align: center;
    max-width: calc(var(--auth-card-max) + 2rem);
}

.loginPage .logo {
    display: block;
    margin-top: 2.5rem;
}

.loginPage .logo img {
    width: 160px;
    height: auto;
}

.auth-card {
    background: #fff;
    margin: 1rem auto 2.5rem;
    border: 1px solid var(--auth-line);
    box-shadow: 0 12px 12px 0 hsla(0, 0%, 71%, 0.11);
    max-width: var(--auth-card-max);
    text-align: right;
}

.auth-header {
    font-family: iranyekan, x_IRANSans, sans-serif;
    font-weight: 700;
    padding: 14px 24px;
    color: var(--auth-ink);
    font-size: 1.15rem;
    border-bottom: 1px solid var(--auth-line);
}

.auth-section {
    padding: 8px 24px 20px;
}

.auth-lede {
    margin: 10px 0 4px;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--auth-muted);
}

.auth-field {
    margin-top: 12px;
}

.auth-field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    color: #656565;
    margin-bottom: 6px;
    font-size: 0.875rem;
    line-height: 1.45;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 10px;
    left: auto;
    width: 20px;
    height: 20px;
    color: #929292;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-input-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.auth-input {
    display: block;
    width: 100%;
    height: var(--auth-control-h);
    border-radius: var(--auth-radius);
    background: #fff;
    border: 1px solid var(--auth-field-border);
    color: #555;
    font-size: 0.875rem;
    padding: 8px 40px 8px 12px;
    text-align: right;
    font-family: iranyekan, sans-serif;
    outline: none;
    box-sizing: border-box;
}

.auth-input-wrap:has(.auth-password-toggle) .auth-input {
    padding-left: 40px;
}

.auth-input[dir="ltr"] {
    text-align: left;
}

.auth-input:focus {
    border-color: var(--auth-focus);
    box-shadow: 0 0 0 2px rgba(135, 62, 63, 0.18);
}

.auth-input.is-invalid,
.auth-input[aria-invalid="true"] {
    border-color: #b42318;
}

.auth-input:disabled {
    background: #f3f3f3;
    color: #999;
    cursor: not-allowed;
}

.auth-password-toggle {
    position: absolute;
    left: 8px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: #555;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.auth-password-toggle:focus-visible {
    outline: 2px solid var(--auth-focus);
    outline-offset: 1px;
}

.auth-password-toggle svg {
    width: 18px;
    height: 18px;
}

.auth-helper {
    margin: 6px 0 0;
    font-size: 0.75rem;
    color: var(--auth-muted);
    line-height: 1.6;
}

.auth-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--auth-link);
    font-size: 0.75rem;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.auth-link:hover,
.auth-link:focus-visible {
    text-decoration: underline;
}

.auth-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 14px 0 10px;
    color: #5c5c5c;
    font-size: 0.8125rem;
    line-height: 1.7;
    text-align: right;
}

.auth-checkbox-row input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: checkbox;
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 4px 0 0;
    cursor: pointer;
    accent-color: var(--auth-orange);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
}

.auth-checkbox-row .auth-checkbox-copy,
.auth-checkbox-row .auth-checkbox-copy label {
    flex: 1;
    min-width: 0;
    color: #5c5c5c;
    font-weight: 400;
}

.auth-checkbox-row .auth-checkbox-copy a {
    color: var(--auth-link);
    text-decoration: none;
    font-weight: 600;
}

.auth-checkbox-row .auth-checkbox-copy a:hover {
    text-decoration: underline;
}

.auth-primary-button,
.auth-secondary-button,
.auth-provider-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    border-radius: 8px;
    font-family: iranyekan, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.auth-primary-button {
    background: var(--auth-orange);
    color: #fff;
    border-color: var(--auth-orange);
}

.auth-primary-button:hover:not(:disabled) {
    background: var(--auth-orange-hover);
}

.auth-primary-button:focus-visible,
.auth-secondary-button:focus-visible,
.auth-provider-button:focus-visible {
    outline: 2px solid var(--auth-focus);
    outline-offset: 2px;
}

.auth-primary-button:disabled,
.auth-secondary-button:disabled,
.auth-provider-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-primary-button.is-loading,
.auth-secondary-button.is-loading,
.auth-provider-button.is-loading {
    pointer-events: none;
    opacity: 0.75;
}

.auth-secondary-button {
    background: #fff;
    color: #444;
    border-color: #d0d0d0;
}

.auth-secondary-button:hover:not(:disabled) {
    background: #fafafa;
}

.auth-provider-button {
    background: #fff;
    color: #333;
    border-color: #d5d5d5;
    font-weight: 600;
    font-size: 0.85rem;
}

.auth-provider-button:hover:not(:disabled) {
    background: #f7f7f7;
}

.auth-provider-button + .auth-provider-button,
form.auth-provider-form + form.auth-provider-form {
    margin-top: 8px;
}

.auth-provider-mark {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid #ccc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #555;
    background: #f3f3f3;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    color: #9a9a9a;
    font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-line);
}

.auth-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 12px 0 4px;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    overflow: hidden;
}

.auth-mode-switch a {
    display: block;
    text-align: center;
    padding: 8px 6px;
    font-size: 0.8rem;
    color: #555;
    text-decoration: none;
    background: #fafafa;
}

.auth-mode-switch a.is-active {
    background: #fff;
    color: var(--auth-ink);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--auth-orange);
}

.auth-mode-switch a:focus-visible {
    outline: 2px solid var(--auth-focus);
    outline-offset: -2px;
}

.auth-footer-action {
    border-top: 1px solid #d7e6bb;
    background: rgba(93, 214, 0, 0.06);
    padding: 16px 24px;
    text-align: center;
    font-size: 0.875rem;
    color: #555;
    margin: 0;
}

.auth-footer-action a {
    color: var(--auth-link);
    font-weight: 600;
    text-decoration: none;
    margin-inline-start: 0.35rem;
}

.auth-footer-action a:hover {
    text-decoration: underline;
}

.auth-error {
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: var(--auth-radius);
    background: #fff5f4;
    border: 1px solid #f0c4c0;
    color: #9b1c1c;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.auth-success {
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: var(--auth-radius);
    background: #fffde4;
    border: 1px solid #f6e8a1;
    color: #a37731;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.auth-countdown {
    margin: 8px 0 12px;
    font-size: 0.8rem;
    color: var(--auth-muted);
}

.auth-otp-input {
    letter-spacing: 0.35em;
    font-size: 1.1rem;
    text-align: center;
    padding-inline: 12px;
}

.auth-actions {
    margin-top: 14px;
}

.auth-social {
    margin-top: 4px;
}

.auth-social-caption {
    font-size: 0.75rem;
    color: var(--auth-muted);
    margin: 0 0 8px;
}

@media (max-width: 420px) {
    .auth-card,
    .auth-header,
    .auth-section,
    .auth-footer-action {
        max-width: 100%;
    }

    .auth-header,
    .auth-section,
    .auth-footer-action {
        padding-inline: 16px;
    }
}

html[lang^="en"] .auth-input {
    text-align: left;
    padding: 8px 12px 8px 40px;
}

html[lang^="en"] .auth-input-icon {
    left: 10px;
    right: auto;
}

html[lang^="en"] .auth-password-toggle {
    right: 8px;
    left: auto;
}
