/* ============================================================
   استایل لودینگ سراسری فروشگاه دیجی آنی
   - overlay کامل صفحه برای فرم‌های بزرگ
   - overlay روی خود دکمه برای فرم‌های کوچک
   - نوار پیشرفت با درصد برای آپلود فایل
   ============================================================ */

/* ===== ۱. Overlay کامل صفحه ===== */
.dg-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    font-family: Vazir, sans-serif;
}

.dg-loading-overlay.is-active {
    opacity: 1;
    pointer-events: all;
}

/* اسپینر */
.dg-loading-overlay__spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: dg-spin 0.9s linear infinite;
}

@keyframes dg-spin {
    to { transform: rotate(360deg); }
}

/* متن وضعیت */
.dg-loading-overlay__text {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 500;
    text-align: center;
    line-height: 1.6;
    max-width: 400px;
    padding: 0 16px;
}

.dg-loading-overlay__subtext {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: -8px;
}

/* نوار پیشرفت (برای آپلود) */
.dg-loading-overlay__progress-wrap {
    width: 320px;
    max-width: 90vw;
    margin-top: 8px;
}

.dg-loading-overlay__progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dg-loading-overlay__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #818cf8 50%, #6366f1 100%);
    background-size: 200% 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 0.3s ease;
    animation: dg-progress-shimmer 1.5s linear infinite;
}

@keyframes dg-progress-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dg-loading-overlay__progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ===== ۲. Overlay روی دکمه (سبک‌تر) ===== */
.dg-btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.dg-btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dg-spin 0.8s linear infinite;
}

.dg-btn-loading--dark::after {
    border-color: rgba(15, 23, 42, 0.2);
    border-top-color: #0f172a;
}

/* ===== ۳. overlay داخل یک کارت/سکشن (محدودتر از کل صفحه) ===== */
.dg-loading-inline {
    position: relative;
    min-height: 80px;
}

.dg-loading-inline::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 50;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='48' height='48' fill='none' stroke='%236366f1' stroke-width='2.5'><circle cx='12' cy='12' r='9' stroke-opacity='0.25'/><path d='M21 12a9 9 0 0 0-9-9' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    animation: dg-spin 1s linear infinite;
}

/* ===== ۴. اسپینر کوچک درون‌خطی ===== */
.dg-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: dg-spin 0.7s linear infinite;
    vertical-align: middle;
}

/* ===== ۵. غیرفعال کردن scroll وقتی overlay فعاله ===== */
body.dg-loading-lock {
    overflow: hidden;
}

/* ===== ۶. حالت موبایل ===== */
@media (max-width: 576px) {
    .dg-loading-overlay__spinner {
        width: 48px;
        height: 48px;
    }
    .dg-loading-overlay__text {
        font-size: 0.88rem;
    }
    .dg-loading-overlay__progress-wrap {
        width: 90vw;
    }
}
