/* gallery-instagram.css
   Instagram-style photo gallery: album FOLDER tiles in the All view + a tight
   3-column SQUARE thumbnail grid inside an album. Loads after social-profile.css
   so it overrides the legacy 5-col .igal-grid and the big captioned .igal-thumb.
   Theme: navy #0a1628 / #0f1a2e / #16223c + gold #c8a03c + white. SVG icons only. */

:root {
    --igal-navy: #0a1628;
    --igal-navy-2: #0f1a2e;
    --igal-navy-3: #16223c;
    --igal-gold: #c8a03c;
}

/* ---- Grid container becomes a scrolling block (was a 5-col grid) ----
   Scoped to the photo-gallery overlay (the only place .igal-grid renders, see
   app.js openPhotoGallery → #photo-gallery-overlay) so this !important grid/overflow
   override can never restyle a .igal-grid elsewhere. Specificity (overlay class +
   element) still beats the legacy styles.css `.igal-grid` inside the overlay, so the
   gallery looks identical — this is containment, not a visual change. */
.photo-gallery-overlay .igal-grid {
    display: block !important;
    grid-template-columns: none !important;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--igal-navy);
    padding: 0 0 1.5rem;
    -webkit-overflow-scrolling: touch;
}

/* ---- Context bar (replaces the album chip scroller) ---- */
.igal-album-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem !important;
    background: var(--igal-navy-2);
    border-bottom: 1px solid rgba(200,160,60,0.16);
    flex-shrink: 0;
    overflow: visible !important;
}
.igal-bar-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
}
.igal-bar-new {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;        /* no bubble — plain gold action */
    color: var(--igal-gold);
    border: none;
    padding: 0.34rem 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.igal-bar-new:hover { opacity: 0.8; }
.igal-bar-new svg { display: block; }

/* Album view: back affordance + album name */
.igal-bar-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--igal-gold);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.1rem;
    flex-shrink: 0;
}
.igal-bar-back:hover { color: #e6c45e; }
.igal-bar-back svg { display: block; }
.igal-bar-album {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
}
.igal-bar-album .igal-bar-count {
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.4px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
}

/* Album bar: rename + delete buttons */
.igal-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: auto;
}
.igal-bar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--igal-gold);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.igal-bar-btn:hover { color: #e6c45e; background: rgba(200,160,60,0.14); }
.igal-bar-delete-album:hover { color: #f87171; background: rgba(220,38,38,0.1); }

/* ---- Section labels (Albums / Unfiled / All photos) ---- */
.igal-section-label {
    padding: 0.85rem 0.9rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}

/* ---- Album FOLDER tiles (cover image, name + count UNDERNEATH) ---- */
.igal-folders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem;
    padding: 0 0.9rem;
}
.igal-folder {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.igal-folder-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--igal-navy-3);
    border: 1px solid rgba(200,160,60,0.18);
    /* stacked-folder hint: a faint offset card behind the cover */
    box-shadow: 0 0 0 1px rgba(255,255,255,0.02),
                6px -6px 0 -2px var(--igal-navy-3),
                6px -6px 0 -1px rgba(200,160,60,0.18);
    transition: transform 0.16s ease, border-color 0.16s ease;
}
.igal-folder:hover .igal-folder-cover {
    transform: translateY(-2px);
    border-color: rgba(200,160,60,0.55);
}
.igal-folder:active .igal-folder-cover { transform: translateY(0); }
.igal-folder-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.igal-folder-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(200,160,60,0.5);
    background: linear-gradient(160deg, var(--igal-navy-3), var(--igal-navy));
}
.igal-folder-meta {
    display: block;
    padding: 0.5rem 0.15rem 0;
}
.igal-folder-name {
    display: block;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.igal-folder-count {
    display: block;
    margin-top: 1px;
    color: rgba(255,255,255,0.42);
    font-size: 0.72rem;
}

/* ---- Tight 3-column SQUARE photo grid ---- */
.igal-sqgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    gap: 3px;
    padding: 0 2px;
}
.igal-sq {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--igal-navy-3);
    border: none;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.igal-sq-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.15s ease;
}
.igal-sq:hover .igal-sq-img { opacity: 0.82; }

/* Empty state keeps working inside the block container */
.igal-grid > .igal-empty,
.igal-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ---- Header spacer (replaces the removed top-right '+' button; keeps title centred) ---- */
.igal-header-spacer { width: 32px; height: 32px; flex: 0 0 auto; }

/* ---- In-album "Add photo or video" button (gold, prominent, inside the album bar) ---- */
.igal-bar-addmedia {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--igal-gold);
    color: var(--igal-navy);
    border: none;
    border-radius: 7px;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}
.igal-bar-addmedia:hover { background: #e6c45e; }
.igal-bar-addmedia:disabled { opacity: 0.6; cursor: default; }
.igal-bar-addmedia svg { display: block; }

/* ---- Video tiles in the grid: small play badge, object-fit handled by .igal-sq-img ---- */
.igal-sq-vidbadge {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(10,22,40,0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.igal-detail-img-wrap video.igal-detail-img { width: 100%; max-height: 60vh; object-fit: contain; background: #000; display: block; }

/* ---- Header spacer (replaces the removed top-right '+' button; keeps title centred) ---- */
.igal-header-spacer { width: 32px; height: 32px; flex: 0 0 auto; }

/* ---- In-album "Add photo or video" button (gold, prominent, inside the album bar) ---- */
.igal-bar-addmedia {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--igal-gold);
    color: var(--igal-navy);
    border: none;
    border-radius: 7px;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}
.igal-bar-addmedia:hover { background: #e6c45e; }
.igal-bar-addmedia:disabled { opacity: 0.6; cursor: default; }
.igal-bar-addmedia svg { display: block; }

/* ---- Video tiles in the grid: small play badge, object-fit handled by .igal-sq-img ---- */
.igal-sq-vidbadge {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(10,22,40,0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.igal-detail-img-wrap video.igal-detail-img { width: 100%; max-height: 60vh; object-fit: contain; background: #000; display: block; }

/* ---- Header spacer (replaces the removed top-right '+' button; keeps title centred) ---- */
.igal-header-spacer { width: 32px; height: 32px; flex: 0 0 auto; }

/* ---- In-album "Add photo or video" button (gold, prominent, inside the album bar) ---- */
.igal-bar-addmedia {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--igal-gold);
    color: var(--igal-navy);
    border: none;
    border-radius: 7px;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}
.igal-bar-addmedia:hover { background: #e6c45e; }
.igal-bar-addmedia:disabled { opacity: 0.6; cursor: default; }
.igal-bar-addmedia svg { display: block; }

/* ---- Video tiles in the grid: small play badge, object-fit handled by .igal-sq-img ---- */
.igal-sq-vidbadge {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(10,22,40,0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.igal-detail-img-wrap video.igal-detail-img { width: 100%; max-height: 60vh; object-fit: contain; background: #000; display: block; }

/* Prev/next arrows overlaid on the photo so you can step through an album
   without leaving the viewer. */
.igal-detail-img-wrap { position: relative; }
.igal-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    z-index: 3;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(2px);
}
.igal-nav-arrow:hover { background: rgba(0, 0, 0, 0.7); }
.igal-nav-arrow:active { transform: translateY(-50%) scale(0.94); }
.igal-nav-prev { left: 10px; }
.igal-nav-next { right: 10px; }

/* Photo-viewer action buttons — tidy, consistent layout (was cramped on mobile).
   Share is the primary action; remove/delete are quieter secondary buttons. */
.igal-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.igal-detail-actions > button {
    flex: 1 1 140px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.igal-detail-actions .igal-share-btn {
    flex-basis: 100%;
    background: var(--gold, #c8a03c);
    color: #0a1628;
    border: none;
}
.igal-detail-actions .igal-delete-photo-btn { color: #e8a0a0; }
.igal-detail-actions > button:active { transform: scale(0.98); }

/* auto-fill handles all widths: ~6+ folders / ~8+ photos per row on web, 2-3 on mobile */

/* Photos-section header with an inline "+ Photo" add action (gold, no bubble). */
.igal-section-label.igal-section-photos {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.igal-add-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: none;
    color: var(--igal-gold);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    padding: 0.1rem 0.2rem;
    transition: opacity 0.15s;
}
.igal-add-photo-btn:hover { opacity: 0.8; }
.igal-add-photo-btn svg { display: block; }
