/* ============================================================
   Study Buddy Bites — Frontend Styles
   Stories/Reels-style showcase row + full-screen lightbox
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
    --sbb-accent:        #4f46e5;
    --sbb-accent-2:      #7c3aed;
    --sbb-accent-grad:   linear-gradient(135deg, #f97316, #ec4899, #8b5cf6);
    --sbb-pinned-grad:   linear-gradient(135deg, #f59e0b, #ef4444);
    --sbb-white:         #ffffff;
    --sbb-black:         #000000;
    --sbb-overlay:       rgba(0, 0, 0, 0.92);
    --sbb-radius:        12px;
    --sbb-transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sbb-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sbb-z-lightbox:    99999;
}

/* ============================================================
   SHOWCASE ROW
   ============================================================ */

.sbb-showcase {
    width: 100%;
    overflow: hidden;
    padding: 12px 0 16px;
    position: relative;
}

.sbb-showcase__track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px 16px 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.sbb-showcase__track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ── Individual Bite Item ── */
.sbb-showcase__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    scroll-snap-align: start;
    cursor: pointer;
}

/* ── Circle Button ── */
.sbb-circle-btn {
    position: relative;
    width: var(--sbb-size, 80px);
    height: var(--sbb-size, 80px);
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--sbb-transition);
}

.sbb-circle-btn:hover,
.sbb-circle-btn:focus-visible {
    transform: scale(1.06);
}

.sbb-circle-btn:focus-visible {
    box-shadow: 0 0 0 3px var(--sbb-accent);
    border-radius: 50%;
}

/* ── Gradient Ring ── */
.sbb-circle-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--sbb-accent-grad);
    z-index: 1;
    transition: opacity var(--sbb-transition);
}

.sbb-circle-ring--pinned {
    background: var(--sbb-pinned-grad);
    animation: sbb-ring-pulse 2s ease-in-out infinite;
}

/* Seen state — ring fades to grey */
.sbb-showcase__item--seen .sbb-circle-ring {
    background: #d1d5db;
}

@keyframes sbb-ring-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

/* ── Circle Image ── */
.sbb-circle-img {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    overflow: hidden;
    background: #f3f4f6;
    z-index: 2;
    border: 2px solid var(--sbb-white);
}

.sbb-circle-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sbb-circle-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
}

.sbb-circle-placeholder svg {
    width: 40%;
    height: 40%;
}

/* ── Media Type Badge ── */
.sbb-circle-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    border: 1.5px solid var(--sbb-white);
}

.sbb-circle-badge--video {
    background: #ef4444;
    color: var(--sbb-white);
}

.sbb-circle-badge--slideshow {
    background: #3b82f6;
    color: var(--sbb-white);
}

.sbb-circle-badge svg {
    width: 10px;
    height: 10px;
}

/* ── Short Caption ── */
.sbb-circle-caption {
    font-family: var(--sbb-font);
    font-size: 11px;
    font-weight: 500;
    color: #374151;
    text-align: center;
    line-height: 1.2;
    max-width: calc(var(--sbb-size, 80px) + 10px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.sbb-lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--sbb-z-lightbox);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--sbb-transition);
}

.sbb-lightbox.is-open {
    pointer-events: all;
    opacity: 1;
}

/* ── Backdrop ── */
.sbb-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: var(--sbb-overlay);
    cursor: pointer;
}

/* ── Container ── */
.sbb-lightbox__container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--sbb-black);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform var(--sbb-transition);
}

.sbb-lightbox.is-open .sbb-lightbox__container {
    transform: scale(1);
}

@media (min-width: 480px) {
    .sbb-lightbox__container {
        height: min(750px, 95dvh);
        border-radius: var(--sbb-radius);
        box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    }
}

/* ── Header ── */
.sbb-lightbox__header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 10px 12px 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

/* ── Progress Bars ── */
.sbb-progress-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.sbb-progress-bar {
    flex: 1;
    height: 2.5px;
    background: rgba(255,255,255,0.35);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.sbb-progress-bar__fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--sbb-white);
    width: 0%;
    border-radius: 2px;
    transition: width linear;
}

.sbb-progress-bar--complete .sbb-progress-bar__fill {
    width: 100%;
    transition: none;
}

/* ── Identity Row ── */
.sbb-lightbox__identity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.sbb-lightbox__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #374151;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.6);
}

.sbb-lightbox__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sbb-lightbox__meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sbb-lightbox__bite-title {
    font-family: var(--sbb-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--sbb-white);
    line-height: 1.2;
}

.sbb-lightbox__site-name {
    font-family: var(--sbb-font);
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}

/* ── Hardened Button Reset (overrides Elementor kit and theme global button styles) ── */
#sbb-lightbox button,
#sbb-lightbox button:hover,
#sbb-lightbox button:focus,
#sbb-lightbox button:active {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
    font-family: inherit !important;
    font-size: inherit !important;
    letter-spacing: inherit !important;
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
    text-transform: none !important;
    width: auto !important;
    height: auto !important;
    outline: none !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* ── Header Controls ── */
.sbb-lightbox__controls {
    position: absolute;
    top: 18px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 11;
}

.sbb-lightbox__controls button {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(0,0,0,0.4) !important;
    background-color: rgba(0,0,0,0.4) !important;
    color: var(--sbb-white) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: background var(--sbb-transition);
    -webkit-tap-highlight-color: transparent;
}

.sbb-lightbox__controls button:hover {
    background: rgba(0,0,0,0.7) !important;
    background-color: rgba(0,0,0,0.7) !important;
}

.sbb-lightbox__controls button svg {
    width: 16px;
    height: 16px;
}

/* ── Media Stage ── */
.sbb-lightbox__stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #111;
}

.sbb-lightbox__tap-prev,
.sbb-lightbox__tap-next {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 5;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.sbb-lightbox__tap-prev {
    left: 0;
    width: 25%;
}

.sbb-lightbox__tap-next {
    right: 0;
    width: 75%;
}

/* ── Media Wrap ── */
.sbb-lightbox__media-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sbb-lightbox__media-wrap img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.sbb-lightbox__media-wrap video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    background: #000;
}

/* Video play overlay (shown when autoplay is blocked by browser) */
.sbb-video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: var(--sbb-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background var(--sbb-transition), transform var(--sbb-transition);
    padding: 0;
}

.sbb-video-play-overlay:hover,
.sbb-video-play-overlay:focus {
    background: rgba(0, 0, 0, 0.85);
    transform: translate(-50%, -50%) scale(1.1);
    outline: 2px solid var(--sbb-white);
    outline-offset: 2px;
}

.sbb-video-play-overlay svg {
    width: 32px;
    height: 32px;
    margin-left: 4px; /* optical centre for play triangle */
}

/* Slide transition */
.sbb-slide-enter {
    animation: sbb-slide-in var(--sbb-transition) forwards;
}

.sbb-slide-exit {
    animation: sbb-slide-out var(--sbb-transition) forwards;
}

@keyframes sbb-slide-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes sbb-slide-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-30px); }
}

/* ── Default CTA Slide ── */
.sbb-default-cta-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 32px;
    text-align: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
}

.sbb-default-cta-slide__logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 2px solid rgba(255,255,255,0.2);
}

.sbb-default-cta-slide__logo svg {
    width: 40px;
    height: 40px;
    color: var(--sbb-white);
}

.sbb-default-cta-slide__heading {
    font-family: var(--sbb-font);
    font-size: 22px;
    font-weight: 700;
    color: var(--sbb-white);
    margin: 0 0 10px;
    line-height: 1.2;
}

.sbb-default-cta-slide__sub {
    font-family: var(--sbb-font);
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    margin: 0;
    line-height: 1.5;
}

/* ── Bite Navigation Arrows ── */
.sbb-lightbox__bite-prev,
.sbb-lightbox__bite-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 8;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: var(--sbb-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--sbb-transition), opacity var(--sbb-transition);
    backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
}

.sbb-lightbox__bite-prev {
    left: 8px;
}

.sbb-lightbox__bite-next {
    right: 8px;
}

.sbb-lightbox__bite-prev:hover,
.sbb-lightbox__bite-next:hover {
    background: rgba(255,255,255,0.3);
}

.sbb-lightbox__bite-prev svg,
.sbb-lightbox__bite-next svg {
    width: 18px;
    height: 18px;
}

.sbb-lightbox__bite-prev.is-hidden,
.sbb-lightbox__bite-next.is-hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── Footer ── */
.sbb-lightbox__footer {
    padding: 14px 16px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.sbb-lightbox__description {
    font-family: var(--sbb-font);
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    margin: 0 0 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sbb-lightbox__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.sbb-lightbox__tag {
    font-family: var(--sbb-font);
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 3px 10px;
    text-decoration: none;
    transition: background var(--sbb-transition), color var(--sbb-transition);
}

.sbb-lightbox__tag:hover {
    background: rgba(255,255,255,0.2);
    color: var(--sbb-white);
}

.sbb-lightbox__cta-btn {
    display: inline-block;
    background: var(--sbb-white);
    color: #1e1b4b;
    font-family: var(--sbb-font);
    font-size: 14px;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 50px;
    text-decoration: none;
    text-align: center;
    transition: transform var(--sbb-transition), box-shadow var(--sbb-transition);
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    letter-spacing: 0.01em;
}

.sbb-lightbox__cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    color: #1e1b4b;
    text-decoration: none;
}

/* ── Swipe Hint Animation (first open) ── */
.sbb-lightbox__swipe-hint {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    animation: sbb-hint-fade 2.5s ease-in-out forwards;
}

.sbb-lightbox__swipe-hint span {
    font-family: var(--sbb-font);
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.sbb-lightbox__swipe-hint svg {
    width: 28px;
    height: 28px;
    color: rgba(255,255,255,0.8);
    animation: sbb-swipe-anim 1s ease-in-out infinite;
}

@keyframes sbb-hint-fade {
    0%   { opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes sbb-swipe-anim {
    0%   { transform: translateX(0); }
    50%  { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* ── Accessibility: reduce motion ── */
@media (prefers-reduced-motion: reduce) {
    .sbb-circle-ring--pinned,
    .sbb-slide-enter,
    .sbb-slide-exit,
    .sbb-lightbox__swipe-hint svg {
        animation: none;
    }
    .sbb-lightbox,
    .sbb-lightbox__container,
    .sbb-circle-btn {
        transition: none;
    }
}

/* ── Body lock when lightbox open ── */
body.sbb-lightbox-open {
    overflow: hidden;
    touch-action: none;
}
