/* Store loading — AI-minimal progress, skeleton, micro loaders */

.store-loading-progress {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 10050;
    height: 2px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.store-loading-progress.is-active {
    opacity: 1;
}

.store-loading-progress__bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 0 2px 2px 0;
    background: linear-gradient(90deg, var(--cs-navy, #0f172a), var(--cs-accent, #f97316));
    box-shadow: 0 0 12px var(--cs-accent-glow, rgba(249, 115, 22, 0.35));
    transition: width 0.2s ease;
}

.store-page-skeleton {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: none;
    padding: 1rem;
    background: var(--cs-body-bg, #f8fafc);
    overflow: auto;
}

html.store-loading-active .store-page-skeleton {
    display: block;
}

html.store-loading-active .main-body,
html.store-loading-active #main-body,
html.store-loading-active #main-body-one-col,
html.store-loading-active #main-body-two-col {
    visibility: hidden;
}

.store-page-skeleton__status {
    max-width: 720px;
    margin: 0 auto 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--cs-text-muted, #64748b);
    text-align: center;
}

.store-page-skeleton__panel {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
}

.store-page-skeleton__panel.is-visible {
    display: block;
}

.store-skeleton-shimmer {
    background: linear-gradient(
        90deg,
        rgba(148, 163, 184, 0.12) 0%,
        rgba(255, 255, 255, 0.55) 45%,
        rgba(148, 163, 184, 0.12) 100%
    );
    background-size: 200% 100%;
    animation: storeSkeletonShimmer 1.35s ease-in-out infinite;
    border-radius: 0.65rem;
}

@keyframes storeSkeletonShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.store-skeleton--catalog .store-skeleton__toolbar {
    height: 3.5rem;
    margin-bottom: 1rem;
}

.store-skeleton--catalog .store-skeleton__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .store-skeleton--catalog .store-skeleton__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.store-skeleton__card {
    height: 14rem;
}

.store-skeleton--product .store-skeleton__hero {
    height: 16rem;
    margin-bottom: 1rem;
}

.store-skeleton--product .store-skeleton__line {
    height: 1rem;
    margin-bottom: 0.55rem;
}

.store-skeleton--product .store-skeleton__line--lg {
    height: 1.35rem;
    width: 72%;
}

.store-skeleton--product .store-skeleton__line--md {
    width: 48%;
}

.store-skeleton--product .store-skeleton__cta {
    height: 2.75rem;
    width: 10rem;
    margin-top: 1rem;
}

.store-skeleton--profile .store-skeleton__head {
    height: 4.5rem;
    margin-bottom: 1rem;
}

.store-skeleton--profile .store-skeleton__rows {
    display: grid;
    gap: 0.65rem;
}

.store-skeleton--profile .store-skeleton__row {
    height: 5.5rem;
}

.store-skeleton--search .store-skeleton__hero {
    height: 5rem;
    margin-bottom: 1rem;
}

.store-skeleton--search .store-skeleton__row {
    height: 3.25rem;
    margin-bottom: 0.55rem;
}

.store-skeleton--generic .store-skeleton__block {
    height: 12rem;
    margin-bottom: 0.75rem;
}

.store-first-splash {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    background: var(--cs-body-bg, #f8fafc);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.store-first-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.store-first-splash__logo {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    object-fit: contain;
}

.store-first-splash__pulse {
    width: 4.5rem;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--cs-navy, #0f172a), var(--cs-accent, #f97316));
    animation: storeSplashPulse 0.9s ease-in-out infinite alternate;
}

@keyframes storeSplashPulse {
    from { transform: scaleX(0.45); opacity: 0.55; }
    to { transform: scaleX(1); opacity: 1; }
}

.store-page-reveal {
    animation: storePageReveal 0.38s ease-out;
}

@keyframes storePageReveal {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Micro loaders */
.store-btn-loading {
    position: relative;
    pointer-events: none;
}

.store-btn-loading > .store-btn-loading__label {
    visibility: hidden;
}

.store-btn-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: storeBtnSpin 0.65s linear infinite;
}

.store-btn-loading.store-btn-loading--dark::after {
    border-color: rgba(15, 23, 42, 0.15);
    border-top-color: var(--cs-navy, #0f172a);
}

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

.store-ai-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-inline-start: 0.35rem;
}

.store-ai-dots span {
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: storeAiDot 1.1s ease-in-out infinite;
}

.store-ai-dots span:nth-child(2) { animation-delay: 0.15s; }
.store-ai-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes storeAiDot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

#search-suggest.is-loading::before {
    content: "در حال جستجو";
    display: block;
    padding: 0.65rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--cs-text-muted, #64748b);
}

#search-suggest.is-loading .search-result-item,
#search-suggest.is-loading .search-result-title,
#search-suggest.is-loading .search-result-footer {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .store-skeleton-shimmer,
    .store-first-splash__pulse,
    .store-page-reveal,
    .store-btn-loading::after,
    .store-ai-dots span {
        animation: none !important;
    }

    .store-loading-progress__bar {
        transition: none;
    }
}
