/* ==========================================================================
   PrivacyCam — gallery screen
   ========================================================================== */

.gallery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.gallery-head h1 { margin: 0; font-size: 26px; letter-spacing: -.3px; }

/* ----------------------------------------------------------------- toolbar */

.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-pills {
    display: inline-flex;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
}

.pill {
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s;
    min-height: 40px;
}

.pill.active { background: var(--accent); color: #fff; }

.toolbar-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-field input,
.toolbar-field select {
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text);
    border-radius: 10px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 14px;
    min-height: 40px;
    color-scheme: dark;
}

/* ------------------------------------------------------------------- grid */

.gallery-group { margin-bottom: 34px; }

.gallery-date {
    font-size: 17px;
    margin: 0 0 12px;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.media-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.media-open {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border: 0;
    padding: 0;
    background: #0a0d12;
    cursor: zoom-in;
}

.media-open img,
.media-open video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, .25);
}

.play-overlay svg {
    background: rgba(0, 0, 0, .55);
    border-radius: 50%;
    padding: 10px;
    width: 46px;
    height: 46px;
}

.media-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
}

.media-when {
    flex: 1;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-delete {
    border: 0;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: inline-flex;
    transition: color .15s, background .15s;
}

.media-delete:hover { color: var(--danger); background: rgba(255, 82, 82, .12); }

/* ---------------------------------------------------------------- lightbox */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, .94);
    display: flex;
    flex-direction: column;
}

.lb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    color: #fff;
    z-index: 2;
}

.lb-caption {
    font-size: 14px;
    color: #cfd6e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-actions { display: flex; gap: 6px; flex-shrink: 0; }

.lb-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lb-photo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform .12s ease-out;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.lb-photo.zoomed { cursor: grab; max-width: none; max-height: none; }

.lb-video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 26px;
    width: 48px;
    height: 64px;
    border-radius: 12px;
    cursor: pointer;
    z-index: 3;
    transition: background .15s;
}

.lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 560px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .gallery-toolbar { flex-direction: column; align-items: stretch; }
    .filter-pills { align-self: center; }
    .toolbar-right { justify-content: center; }
    .gallery-head h1 { font-size: 22px; }
    .lb-nav { width: 40px; height: 54px; font-size: 20px; }
}
