/* =========================================
   GK SMS Login - Modern Style (Responsive)
   ========================================= */

:root {
    /* رنگ‌های اصلی - قابل تغییر مطابق برند */
    --gk-primary: #ef394e;       /* رنگ دکمه و فوکوس */
    --gk-primary-hover: #d62f42; /* هاور دکمه */
    --gk-text: #3f4064;          /* رنگ متن اصلی */
    --gk-text-light: #717171;    /* رنگ متن توضیحات */
    --gk-border: #e0e0e2;        /* رنگ بردر اینپوت‌ها */
    --gk-bg: #ffffff;            /* پس‌زمینه کارت */
    --gk-radius: 12px;           /* گردی گوشه‌ها */
    --gk-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); /* سایه کارت */
    --gk-error: #ff4d4f;         /* رنگ خطا */
    --gk-success: #52c41a;       /* رنگ موفقیت */
}

/* --- Container & Layout --- */
.gk-login-container {
    font-family: inherit;
    direction: rtl;
    width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.gk-login-container * {
    box-sizing: border-box;
}

.gk-login-card {
    background: var(--gk-bg);
    width: 100%;
    max-width: 400px;
    border-radius: var(--gk-radius);
    padding: 32px 28px;
    box-shadow: var(--gk-shadow);
    border: 1px solid rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden; /* برای انیمیشن اسلاید */
}

/* --- Logged In View --- */
.gk-sms-login-loggedin {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--gk-radius);
    text-align: center;
    border: 1px solid var(--gk-border);
}
.gk-user-avatar img {
    border-radius: 50%;
    border: 2px solid var(--gk-primary);
    padding: 2px;
    margin-bottom: 10px;
}
.gk-welcome-text {
    font-size: 14px;
    color: var(--gk-text);
    margin: 0 0 15px;
}
.gk-btn-logout {
    display: inline-block;
    padding: 6px 15px;
    font-size: 12px;
    color: var(--gk-error);
    border: 1px solid var(--gk-error);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}
.gk-btn-logout:hover {
    background: var(--gk-error);
    color: #fff;
}

/* --- Header & Logo --- */
.gk-login-header {
    text-align: center;
    margin-bottom: 24px;
}
.gk-brand-logo img {
    max-height: 50px;
    width: auto;
    margin-bottom: 12px;
}
.gk-site-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--gk-text);
    display: block;
    margin-bottom: 5px;
}
.gk-form-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gk-text);
    margin: 10px 0 0;
}

/* --- Steps Animation Wrapper --- */
.gk-steps-wrapper {
    position: relative;
    /* ارتفاع مینیمم برای جلوگیری از پرش هنگام تغییر تب */
    min-height: 220px;
}
.gk-step {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.gk-step.active {
    position: relative;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.gk-step-desc {
    font-size: 13px;
    color: var(--gk-text-light);
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: center;
}

.gk-mobile-display {
    font-weight: 700;
    color: var(--gk-text);
    margin: 0 4px;
    display: inline-block;
}
.gk-edit-number {
    color: var(--gk-primary);
    text-decoration: none;
    font-size: 12px;
    margin-right: 5px;
    cursor: pointer;
}
.gk-edit-number:hover {
    text-decoration: underline;
}

/* --- Inputs (Mobile) --- */
.gk-input-group {
    position: relative;
    margin-bottom: 20px;
}
.gk-input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9e9e9e;
    display: flex;
    pointer-events: none;
}
.gk-input-field {
    width: 100%;
    height: 48px;
    padding: 0 40px 0 12px; /* فاصله از راست برای آیکن */
    border: 1px solid var(--gk-border);
    border-radius: 8px;
    font-size: 16px;
    color: var(--gk-text);
    background: #fdfdfd;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}
.gk-input-field:focus {
    border-color: var(--gk-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(239, 57, 78, 0.1);
}
.dir-ltr {
    direction: ltr;
    text-align: left;
}

/* --- OTP Inputs (Dynamic & Responsive) --- */
.gk-otp-fields {
    display: flex;
    gap: 8px; /* فاصله پیش‌فرض بین خانه‌ها */
    justify-content: center;
    margin-bottom: 24px;
    width: 100%;
}

.gk-otp-input {
    /* عرض منعطف برای جا شدن ۴ تا ۸ رقم */
    flex: 1;
    max-width: 50px;
    height: 50px;

    border: 1px solid var(--gk-border);
    border-radius: 8px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--gk-text);
    outline: none;
    transition: all 0.2s;
    padding: 0;
    background: #fafafa;

    /* جلوگیری از کوچک شدن بیش از حد در تعداد بالا */
    min-width: 0;
}

.gk-otp-input:focus {
    border-color: var(--gk-primary);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 2; /* بردر فوکوس روی بقیه بیفتد */
}

/* ریسپانسیو برای موبایل‌های کوچک (زیر 360px) و تعداد ارقام بالا */
@media (max-width: 360px) {
    .gk-otp-fields {
        gap: 4px; /* فاصله کمتر */
    }
    .gk-otp-input {
        height: 42px; /* ارتفاع کمتر */
        font-size: 16px; /* فونت کوچکتر */
        border-radius: 6px;
    }
}

/* --- Buttons --- */
.gk-btn-primary {
    width: 100%;
    height: 48px;
    background: var(--gk-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gk-btn-primary:hover {
    background: var(--gk-primary-hover);
}
.gk-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* استایل متن دکمه برای مدیریت لودر */
.gk-btn-text {
    background: none;
    border: none;
    color: var(--gk-text-light);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}
.gk-btn-text:hover:not(:disabled) {
    color: var(--gk-primary);
}
.gk-btn-text:disabled {
    opacity: 0.5;
    cursor: default;
}

/* --- Timer Row --- */
.gk-otp-timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--gk-text-light);
}

/* --- Alerts & Messages --- */
.gk-alert-box {
    margin-bottom: 16px;
    font-size: 13px;
    text-align: center;
    min-height: 24px; /* فضا نگه دارد تا لی‌اوت نپرد */
}
.gk-error-msg {
    color: var(--gk-error);
    animation: gk-shake 0.4s;
    background: #fff2f0;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-block;
}
.gk-success-msg {
    color: var(--gk-success);
    background: #f6ffed;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-block;
}

@keyframes gk-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* --- Loading Spinner --- */
.btn-loader {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    align-items: center;
    justify-content: center;
    background: inherit;
}
.loading .btn-text { visibility: hidden; }
.loading .btn-loader { display: flex; }

.btn-loader svg {
    width: 24px;
    height: 24px;
    animation: gk-spin 1s linear infinite;
    stroke: #fff;
}

@keyframes gk-spin {
    100% { transform: rotate(360deg); }
}

/* --- Modal Styles --- */
.gk-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);

    /* تنظیمات مخفی‌سازی کامل */
    opacity: 0;
    visibility: hidden;       /* دیده نشود */
    pointer-events: none;     /* کلیک‌ها از آن رد شوند */
    z-index: -1;              /* برود زیر تمام المان‌ها */

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    /* انیمیشن نرم */
    transition: opacity 0.3s ease, visibility 0.3s ease, z-index 0s linear 0.3s;
    /* z-index با تاخیر عوض شود تا انیمیشن بسته شدن کامل شود */
}

.gk-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;     /* کلیک‌ها فعال شوند */
    z-index: 99999;           /* بیاید روی تمام المان‌ها */

    /* حذف تاخیر z-index هنگام باز شدن */
    transition: opacity 0.3s ease, visibility 0.3s ease, z-index 0s linear 0s;
}

.gk-mode-modal .gk-login-card {
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.gk-modal-overlay.is-open .gk-login-card {
    transform: scale(1);
}

/* ناحیه‌ای که با کلیک روی آن مودال بسته شود */
.gk-modal-close-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
}

/* جلوگیری از اسکرول صفحه اصلی وقتی مودال باز است */
body.gk-sms-login-modal-open {
    overflow: hidden !important;
    padding-right: 0 !important; /* جلوگیری از پرش اسکرول بار در برخی مرورگرها */
}
/* Login Trigger Notice in Checkout */
.woocommerce-form-login-toggle .woocommerce-info {
    background-color: var(--gk-surface);
    border: var(--gk-border-width) solid var(--gk-primary); /* بردر رنگی برای جلب توجه */
    color: var(--gk-text);
    border-radius: var(--gk-radius-md);
    padding: 15px 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(239, 57, 78, 0.05); /* سایه ملایم رنگ برند */
}

.woocommerce-form-login-toggle .woocommerce-info::before {
    content: '\f342'; /* آیکون قفل یا یوزر Dashicons */
    font-family: dashicons;
    color: var(--gk-primary);
    font-size: 20px;
}

.woocommerce-form-login-toggle a.showlogin {
    color: var(--gk-primary);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed var(--gk-primary);
    margin-right: 5px;
}

.woocommerce-form-login-toggle a.showlogin:hover {
    color: var(--gk-primary-hover);
    border-bottom-style: solid;
}