/**
 * Enhanced Loading UX for StashLM Free Tools
 *
 * Overrides the tiny default progress sections with a centered,
 * animated loading state that's impossible to miss.
 *
 * Supports both naming conventions:
 *   - .progress-section.show  (most tools)
 *   - .progress.show          (video-chat, etc.)
 */

/* ── Container ─────────────────────────────────────────── */
.progress-section.show,
.progress.show {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 48px 24px !important;
    min-height: 180px !important;
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.06),
        rgba(139, 92, 246, 0.04)
    ) !important;
    border: 1px solid rgba(99, 102, 241, 0.12) !important;
    border-radius: 16px !important;
    margin-top: 24px !important;
}

.dark-mode .progress-section.show,
.dark-mode .progress.show {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.10),
        rgba(139, 92, 246, 0.06)
    ) !important;
    border-color: rgba(99, 102, 241, 0.18) !important;
}

/* ── Spinner (::before pseudo-element) ─────────────────── */
.progress-section.show::before,
.progress.show::before {
    content: '' !important;
    display: block !important;
    width: 40px !important;
    height: 40px !important;
    border: 3px solid rgba(99, 102, 241, 0.15) !important;
    border-top-color: #6366f1 !important;
    border-radius: 50% !important;
    animation: stashSpin 0.8s linear infinite !important;
    margin-bottom: 24px !important;
    flex-shrink: 0 !important;
}

.dark-mode .progress-section.show::before,
.dark-mode .progress.show::before {
    border-color: rgba(99, 102, 241, 0.2) !important;
    border-top-color: #818cf8 !important;
}

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

/* ── Progress bar ──────────────────────────────────────── */
.progress-section.show .progress-bar,
.progress-section.show .progress-bar-outer,
.progress.show .bar-bg {
    width: 100% !important;
    max-width: 300px !important;
    height: 6px !important;
    border-radius: 999px !important;
    margin-bottom: 16px !important;
    overflow: hidden !important;
    background: rgba(99, 102, 241, 0.1) !important;
}

.dark-mode .progress-section.show .progress-bar,
.dark-mode .progress-section.show .progress-bar-outer,
.dark-mode .progress.show .bar-bg {
    background: rgba(99, 102, 241, 0.15) !important;
}

/* ── Progress fill (shimmer animation) ─────────────────── */
.progress-section.show .progress-fill,
.progress-section.show .progress-bar-inner,
.progress.show .bar {
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #6366f1) !important;
    background-size: 200% 100% !important;
    animation: stashShimmer 2s ease-in-out infinite !important;
    border-radius: 999px !important;
    transition: width 0.4s ease !important;
}

@keyframes stashShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ── Status text ───────────────────────────────────────── */
.progress-section.show .progress-text,
.progress-section.show .progress-status,
.progress.show .msg {
    font-size: 15px !important;
    color: var(--text-muted, #6b7280) !important;
    font-weight: 500 !important;
    text-align: center !important;
    line-height: 1.5 !important;
}

/* ── Error box enhancement ─────────────────────────────── */
.error-box.show,
.error.show {
    margin-top: 16px !important;
    padding: 14px 20px !important;
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: 12px !important;
    color: #ef4444 !important;
    font-size: 14px !important;
    text-align: center !important;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
    .progress-section.show,
    .progress.show {
        padding: 36px 16px !important;
        min-height: 150px !important;
    }

    .progress-section.show::before,
    .progress.show::before {
        width: 36px !important;
        height: 36px !important;
        margin-bottom: 20px !important;
    }
}

/* ── Loading message fade animation ──────────────────── */
.stash-loading-fade {
    transition: opacity 0.25s ease-in-out !important;
}
