/* /home/siisi/vertex/gallery_app/static/css/gallery.css */

/* =========================================
   gallery.css - Core styles for all gallery pages
   ========================================= */

/* ---------- 2. Horizontal scroll (public gallery) ---------- */
:root {
    --gallery-min: 280px;
    --gallery-prefer: 36vw;
    --gallery-max: 640px;
}

.horizontal-scroll-wrapper {
    position: relative;
    overflow: visible !important;
    width: 100%;
}

.horizontal-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.5rem;
    padding: 10px 5px 25px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f0f2f5;
    scroll-snap-type: x mandatory;
}

.horizontal-grid .gallery-col {
    flex: 0 0 auto;
    width: clamp(var(--gallery-min), var(--gallery-prefer), var(--gallery-max));
    height: auto;
    scroll-snap-align: center;
}

/* Scroll buttons */
.scroll-btn {
    position: absolute;
    z-index: 3;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
    color: #4a5568;
    font-size: 1rem;
}

.scroll-btn:hover {
    background: #f8f9fa;
    transform: translateY(-50%) scale(1.05);
}

.scroll-left {
    left: -15px;
}

.scroll-right {
    right: -15px;
}

.scroll-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ---------- 3. Vertical layout (profile / archived) - square thumbnails ---------- */
.vertical-grid {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.vertical-grid .col {
    display: flex;
}

.vertical-grid .gallery-card {
    width: 100%;
}

.vertical-grid .image-wrapper {
    aspect-ratio: 1 / 1;
    min-height: auto;
}

/* Show full image without cropping (but keep square container) */
.vertical-grid .image-wrapper img,
.vertical-grid .image-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---------- Vertical action rail (Reels/TikTok pattern) ----------
   Cards render as fixed 1:1 boxes here (.vertical-grid above, and the
   superadmin/archived grids via archived.css), so there's always headroom
   to stack like/comment/share/download/report on the right edge instead
   of sharing the bottom bar's width with the stat counts. The narrow
   horizontal-scroll carousel below (cards capped ~480px wide on mobile)
   keeps the original horizontal row — a stacked icon column has too
   little room to stay comfortably tappable there. */
.social-actions {
    position: absolute;
    /* Logical property, not `right` — .social-stats (the counts) stays in
       normal flex flow with justify-content-between, which already mirrors
       correctly per dir; this rail was pulled out of flow with a fixed
       physical `right`, so in RTL both ended up stacked on the same side
       instead of mirroring apart like they do in LTR. */
    inset-inline-end: 0.6rem;
    bottom: 0.6rem;
    flex-direction: column-reverse !important;
    gap: 0.4rem !important;
}

.horizontal-grid .social-actions {
    position: static;
    flex-direction: row !important;
    gap: 0.25rem !important;
}

/* Cards here go as narrow as --gallery-min (280px); stats (likes/
   comments/views/shares) + actions (like/comment/share/save) share one
   row with no wrap, so once counts hit multiple digits the combined
   width can exceed the card and the last action button (Save) gets
   silently clipped by .image-wrapper's overflow:hidden. Let the row
   wrap to a second line instead of overflowing. */
.horizontal-grid .social-overlay-row {
    flex-wrap: wrap;
    row-gap: 0.35rem;
}

/* Give each icon its own translucent dark backdrop so it stays visible
   regardless of what's behind it (a light thumbnail, light mode, a
   bright patch of a busy photo) instead of relying only on the overlay's
   own dark gradient, which doesn't reach every button once stacked.
   Bootstrap's outline-light color (#f8f9fa) reads as muted against a dark
   chip, so force pure white + the same text-shadow the stat counts use. */
.social-actions .btn {
    background: rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.55) !important;
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.social-actions .btn:hover,
.social-actions .btn:focus,
.social-actions .btn:active {
    background: rgba(0, 0, 0, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    color: #fff !important;
}

/* ---------- 6. Accordion styling (public gallery) - restored ---------- */
.accordion-gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    color: white;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.accordion-gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.accordion-gradient-bg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.accordion__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accordion__header--icon::before {
    margin-right: 10px;
    font-size: 1.2rem;
}

.accordion__header--text {
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    z-index: 2;
}

.accordion__header--indicator {
    margin-left: auto;
    position: relative;
    z-index: 2;
}

/* Same flush-right chevron header pattern as media_detail.html's accordion
   headers — plain flex row, chevron as the last child, no absolute-
   positioned Fasto indicator span (that's what pushed the earlier +/-
   glyph 1.5625rem in from the edge instead of flush against it). */
.card-header.accordion-header {
    cursor: pointer;
}

.accordion-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.card-header.accordion-header.collapsed .accordion-chevron {
    transform: rotate(-90deg);
}

/* =========================================
   Dark mode overrides
   ========================================= */



[data-bs-theme="dark"] .scroll-btn {
    background: var(--bs-secondary-bg, #2d2d2d);
    border-color: var(--bs-border-color, rgba(255, 255, 255, 0.15));
    color: var(--bs-body-color, #e2e8f0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .scroll-btn:hover {
    background: var(--bs-tertiary-bg, #3a3a3a);
}

/* ---------- Public media grid: internal scroll ----------
   The grid scrolls inside its own window, so the stories bar, search and
   explorer sections above/below always stay reachable no matter how deep
   the visitor has scrolled (infinite scroll extends the inner container). */
#public-media-grid {
    display: block;
    max-height: calc(100dvh - 240px);
    min-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: #43DC80 rgba(0, 0, 0, 0.05);
}

#public-media-grid::-webkit-scrollbar { width: 6px; }
#public-media-grid::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); border-radius: 10px; }
#public-media-grid::-webkit-scrollbar-thumb { background: #43DC80; border-radius: 10px; border: 2px solid rgba(0, 0, 0, 0.03); }

@media (max-width: 768px) {
    #public-media-grid {
        max-height: calc(100dvh - 170px);
    }
}


/* ---------- Swipe FAB: gradient + bubbles, same family as the
   accordion headers ---------- */
/* Pulsing glow (box-shadow cousin of .live-glow's text pulse) so the
   button reads as tappable, not decoration */
@keyframes swipe-glow {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, .5);
    }

    50% {
        box-shadow: 0 8px 30px rgba(102, 126, 234, .95), 0 0 18px rgba(118, 75, 162, .55);
    }
}

.swipe-fab {
    position: fixed;
    right: 1.1rem;
    bottom: 5.5rem;
    z-index: 1040;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* !important: its own gradient background never changes with the site
       theme, so its text must always stay white — without this, base.html's
       theme-scoped link-color rules (higher specificity than a bare class)
       would tint it dark green in light mode. */
    color: #fff !important;
    padding: .75rem 1.15rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(102, 126, 234, .5);
    overflow: hidden;
    transition: transform .2s ease;
}
.swipe-fab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}
.swipe-fab:hover {
    color: #fff !important;
    transform: translateY(-2px);
}
.swipe-fab i, .swipe-fab span { position: relative; z-index: 1; }

.swipe-fab,
.swipe-glow {
    animation: swipe-glow 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {

    .swipe-fab,
    .swipe-glow {
        animation: none;
    }
}

/* ---------- Dark mode: scroll track in the media grids. Card border is
   Bootstrap's own default dark-theme card border (unset here on purpose)
   — matches the thin white border already visible on /superadmin/view-all/,
   which has no border override at all. ---------- */
[data-theme-version="dark"] #public-media-grid,
[data-bs-theme="dark"] #public-media-grid,
[data-theme-version="dark"] #profile-media-grid,
[data-bs-theme="dark"] #profile-media-grid {
    scrollbar-color: #43DC80 rgba(255, 255, 255, 0.06);
}

[data-theme-version="dark"] #public-media-grid::-webkit-scrollbar-track,
[data-bs-theme="dark"] #public-media-grid::-webkit-scrollbar-track,
[data-theme-version="dark"] #profile-media-grid::-webkit-scrollbar-track,
[data-bs-theme="dark"] #profile-media-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
}

/* ---------- Privacy toggle: unchecked (Private) — red border only,
   white knob (same elegant knob treatment as the checked/Public track),
   matching the text-danger label ---------- */
.privacy-toggle-off {
    border-color: #FF4C41 !important;
    border-width: 4px !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}
