/* ============================================
   Bitstech UI Plus — Scroll progress, skeleton loaders,
   mobile bottom nav, accessibility enhancements
   ============================================ */

/* ── Scroll progress bar ── */
.bt-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--bt-primary, #753beb), var(--bt-accent, #00e0f0));
    z-index: 99999;
    width: 0;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(117, 59, 235, 0.4);
}

/* ── Skeleton loaders ── */
.bt-skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 0%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.03) 100%);
    background-size: 200% 100%;
    animation: btSkeletonShimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}

html[data-theme="light"] .bt-skeleton {
    background: linear-gradient(90deg,
        rgba(0,0,0,0.04) 0%,
        rgba(0,0,0,0.08) 50%,
        rgba(0,0,0,0.04) 100%);
    background-size: 200% 100%;
}

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

.bt-skeleton-text { height: 0.9rem; margin: 6px 0; }
.bt-skeleton-text:last-child { width: 70%; }
.bt-skeleton-img  { aspect-ratio: 1; width: 100%; }
.bt-skeleton-card { padding: 14px; border-radius: 12px; }

/* ── Mobile bottom navigation ── */
.bt-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(13, 17, 23, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

html[data-theme="light"] .bt-bottom-nav {
    background: rgba(255, 255, 255, 0.94);
    border-top-color: rgba(0, 0, 0, 0.06);
}

.bt-bottom-nav-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
}

.bt-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    gap: 3px;
    text-decoration: none;
    color: var(--bt-text-muted, #a0a8bf);
    font-size: 0.62rem;
    font-weight: 500;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
}

.bt-bottom-nav a svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: transform 0.2s ease;
}

.bt-bottom-nav a.active {
    color: var(--bt-primary, #753beb);
    background: rgba(117, 59, 235, 0.08);
}

.bt-bottom-nav a.active svg {
    transform: scale(1.1);
}

.bt-bottom-nav a:hover {
    color: var(--bt-primary, #753beb);
}

/* Cart badge */
.bt-bottom-nav .bt-bnav-badge {
    position: absolute;
    top: 2px;
    right: 22%;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Show on mobile only.
   NOTE: Body padding + chat-widget / back-to-top positioning is handled
   centrally by the "Bitstech — Responsive Shop Polish" mu-plugin so the
   floating buttons stack correctly above the bottom nav and respect the
   iOS safe-area inset. Don't duplicate those rules here. */
@media (max-width: 768px) {
    .bt-bottom-nav { display: block; }
}

/* ── Accessibility: focus indicators ── */
*:focus-visible {
    outline: 2px solid var(--bt-primary, #753beb);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--bt-primary, #753beb);
    outline-offset: 2px;
}

/* Skip to content link */
.bt-skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--bt-primary, #753beb);
    color: #fff;
    padding: 10px 20px;
    z-index: 999999;
    border-radius: 0 0 8px 0;
    font-weight: 600;
    transition: top 0.2s ease;
}

.bt-skip-link:focus {
    top: 0;
}

/* Screen reader only */
.bt-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bt-sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast focus for keyboard users */
.bt-kbd-focus a:focus,
.bt-kbd-focus button:focus,
.bt-kbd-focus input:focus {
    outline: 3px solid var(--bt-accent, #00e0f0);
    outline-offset: 3px;
}
