/**
 * Hita Elementor OTP Auth Styles v2.2
 * سازگار با حالت دکمه پاپ‌آپ و فرم مستقیم، با ارث‌بری فونت‌های قالب و المنتور
 */

:root {
    --hita-font-family: var(--e-global-typography-primary-font-family, inherit);
}

.hita-auth-widget-wrapper,
.hita-auth-card,
.hita-auth-trigger-wrapper,
.hita-auth-modal-dialog,
.hita-auth-card * {
    font-family: var(--hita-font-family, inherit);
    box-sizing: border-box;
}

/* ========================================================
   دکمه ورود / حساب کاربری (Trigger Button Mode)
   ======================================================== */
.hita-auth-trigger-wrapper {
    display: block;
    width: 100%;
}

.hita-auth-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0284c7;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2);
}

.hita-auth-trigger-btn:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.32);
    color: #ffffff;
}

/* دکمه اختصاصی کاربر وارد شده */
.hita-auth-btn-loggedin {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.hita-auth-btn-loggedin:hover {
    background: #1e293b;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}

/* ========================================================
   پنجره مودال دیالوگ پاپ‌آپ (تمام‌صفحه سراسری)
   ======================================================== */
.hita-auth-modal-dialog {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.hita-modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: hitaFadeIn 0.25s ease forwards;
}

.hita-modal-window {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    animation: hitaScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hita-modal-close-btn {
    position: absolute;
    top: -14px;
    left: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: all 0.2s;
    z-index: 20;
}

.hita-modal-close-btn:hover {
    background: #dc2626;
    transform: scale(1.08);
}

body.hita-modal-opened {
    overflow: hidden;
}

@keyframes hitaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes hitaScaleUp {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================================
   کارت کاربر وارد شده در حالت فرم مستقیم (Inline Mode)
   ======================================================== */
.hita-user-logged-card {
    text-align: center;
    padding: 32px 24px;
}

.hita-user-logged-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.hita-user-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.hita-btn-logout {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.hita-btn-logout:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* ========================================================
   استایل آیکون‌های دستی درون دکمه‌ها و فیلدها
   ======================================================== */
.hita-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hita-btn-icon svg {
    width: 1.1em;
    height: 1.1em;
    fill: currentColor;
}

.hita-icon-left {
    margin-left: 8px;
}

.hita-icon-right {
    margin-right: 8px;
}

.hita-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.hita-input-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.font-numeric {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* کادر اصلی فرم */
.hita-auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    direction: rtl;
    text-align: right;
}

/* تب‌های ورود / ثبت‌نام */
.hita-tabs-header {
    display: flex;
    align-items: center;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.hita-tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background-color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hita-tab-btn:not(.hita-tab-active):hover {
    opacity: 0.88;
}

.hita-tab-btn.hita-tab-active {
    background-color: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* سربرگ مراحل */
.hita-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.hita-step-header-text {
    margin-bottom: 20px;
    text-align: center;
}

.hita-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.hita-subtitle {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
}

.hita-target-phone {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

/* فیلدها و لیبل‌ها */
.hita-field-group {
    margin-bottom: 18px;
}

.hita-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.hita-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.hita-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14.5px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    text-align: center;
    transition: all 0.2s;
}

.hita-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* دکمه بازگشت */
.hita-back-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
}

.hita-back-btn:hover {
    color: #0284c7;
}

/* شبکه OTP */
.hita-otp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    direction: ltr;
    margin-top: 6px;
}

.hita-otp-box {
    height: 52px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
}

.hita-otp-box:focus {
    background: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* تایمر معکوس */
.hita-timer-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    color: #64748b;
    margin-bottom: 20px;
}

.hita-link-btn {
    background: none;
    border: none;
    color: #0284c7;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* بخش چک‌باکس قوانین و مقررات */
.hita-terms-group {
    margin-top: 14px;
    margin-bottom: 18px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.hita-terms-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 11.5px;
    color: #475569;
    cursor: pointer;
    line-height: 1.6;
    user-select: none;
}

.hita-terms-checkbox {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #0284c7;
    flex-shrink: 0;
}

.hita-terms-text {
    flex: 1;
}

.hita-terms-link {
    color: #0284c7;
    text-decoration: underline;
    font-weight: 600;
}

.hita-terms-link:hover {
    filter: brightness(0.85);
}

.hita-terms-note {
    font-size: 11.5px;
    color: #94a3b8;
    text-align: center;
    margin-top: 14px;
    margin-bottom: 0;
    line-height: 1.6;
}

/* دکمه‌های اقدام */
.hita-btn {
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.hita-btn-primary {
    background: #0284c7;
    color: #ffffff;
}

.hita-btn:hover:not(:disabled),
.hita-btn-primary:hover:not(:disabled) {
    filter: brightness(0.92);
    box-shadow: 0 8px 20px -2px rgba(2, 132, 199, 0.35) !important;
}

.hita-btn:disabled,
.hita-btn[disabled] {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    pointer-events: auto !important;
    filter: grayscale(35%);
}

.hita-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: hitaSpin 0.7s linear infinite;
}

@keyframes hitaSpin {
    to { transform: rotate(360deg); }
}
