/*
 * Event Photos (spec 036): the uploader screen in the four consoles, the public gallery and its
 * full-screen viewer. Phone first; canonical Bootstrap 5 breakpoints only; 44px tap targets.
 */

/* ───────────────────────── uploader screen ───────────────────────── */

.ep-screen { max-width: 920px; min-width: 0; }
.ep-screen .admin-edit-section { overflow-wrap: anywhere; }

.ep-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}


.ep-usage { display: flex; align-items: center; gap: 0.6rem; color: var(--brand-cloudgrey-600, #6c757d); font-size: 0.85rem; }
.ep-usage-bar { width: 96px; height: 6px; border-radius: 999px; background: var(--brand-cloudgrey-200, #e5e7eb); overflow: hidden; }
.ep-usage-bar > span { display: block; height: 100%; background: var(--theme-primary, #0078d4); border-radius: inherit; }

.ep-intro { color: var(--brand-cloudgrey-700, #4b5563); margin-bottom: 1rem; max-width: 40rem; }

.ep-choose {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
    font-weight: 600;
    cursor: pointer;
}

.ep-form:has(#epFiles:focus-visible) .ep-choose { outline: 3px solid var(--theme-primary, #0078d4); outline-offset: 3px; }
.ep-limits { margin: 0.75rem 0 0; font-size: 0.85rem; color: var(--brand-cloudgrey-600, #6c757d); }
.ep-upload.ep-drop-over { outline: 2px dashed var(--theme-primary, #0078d4); outline-offset: 6px; border-radius: 0.5rem; }

/* Share sheet */
.ep-picked { display: grid; gap: 0.5rem; margin: 0 0 1.25rem; }
.ep-row-thumb {
    width: 56px;
    height: 56px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--brand-cloudgrey-100, #f3f4f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-primary, #0078d4);
    font-size: 1.25rem;
    flex: 0 0 auto;
}
.ep-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-row-active { border-color: var(--theme-primary, #0078d4); }
.ep-row-done .ep-row-status { color: var(--theme-success, #198754); font-weight: 600; }

.ep-overall { margin-bottom: 1rem; }
.ep-overall[hidden] { display: none; }
.ep-overall-text { font-weight: 600; margin-bottom: 0.4rem; }
.ep-overall-bar { height: 0.75rem; }

.ep-done {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    background: #d1f2df;
    color: #0f5132;
}
.ep-done[hidden] { display: none; }
.ep-done > i { font-size: 1.75rem; }
.ep-done p { margin: 0.25rem 0 0; }
.ep-done-partial { background: #fff3cd; color: #664d03; }
.ep-done-partial > i::before { content: "\f071"; }

.ep-footer-hint { margin-right: auto; font-size: 0.875rem; color: var(--brand-cloudgrey-600, #6c757d); }
.ep-footer-hint[hidden] { display: none; }
#epSheet .modal-footer .btn { min-height: 44px; }
#epSheet .ep-rights .form-check-label { font-weight: 500; }

.ep-card-new { border-color: var(--theme-success, #198754); box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.25); }

.ep-notice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--brand-cloudgrey-100, #f3f4f6);
}

.ep-notice > i { font-size: 1.25rem; color: var(--theme-primary, #0078d4); margin-top: 0.15rem; }
.ep-notice p { margin: 0.25rem 0 0; color: var(--brand-cloudgrey-700, #4b5563); }

.ep-mine-empty { display: flex; gap: 1rem; align-items: flex-start; color: var(--brand-cloudgrey-600, #6c757d); }
.ep-mine-empty[hidden] { display: none; }
.ep-mine-empty i { font-size: 2rem; color: var(--brand-cloudgrey-400, #9ca3af); }
.ep-mine-empty p { margin: 0; }

.ep-queue { margin: 0 0 1rem; display: grid; gap: 0.5rem; }

.ep-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--brand-cloudgrey-200, #e5e7eb);
    border-radius: 0.5rem;
    background: var(--theme-white, #fff);
}

.ep-row-icon { color: var(--theme-primary, #0078d4); font-size: 1.1rem; text-align: center; }
.ep-row-body { display: grid; gap: 0.2rem; min-width: 0; }
.ep-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-row-meta, .ep-row-status { font-size: 0.85rem; color: var(--brand-cloudgrey-600, #6c757d); }
.ep-row-progress { height: 0.5rem; }
.ep-row-actions { display: flex; gap: 0.25rem; align-items: center; }
.ep-row-actions .admin-action-btn, .ep-row-retry { min-width: 44px; min-height: 44px; }
.ep-row-failed { border-color: var(--theme-danger, #dc3545); }
.ep-row-failed .ep-row-status { color: var(--theme-danger, #dc3545); }
.ep-row-failed .progress-bar { background-color: var(--theme-danger, #dc3545); }
.ep-row-done .progress-bar { background-color: var(--theme-success, #198754); }

.ep-rights .form-check-input { width: 1.4em; height: 1.4em; margin-top: 0.1em; }
.ep-rights .form-check-label { padding-left: 0.4rem; }


/* My uploads */
.ep-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.ep-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--brand-cloudgrey-200, #e5e7eb);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--theme-white, #fff);
}

.ep-card-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--brand-cloudgrey-100, #f3f4f6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ep-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-card-placeholder { color: var(--brand-cloudgrey-500, #9ca3af); font-size: 1.75rem; }

.ep-card-play {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.8rem;
}

.ep-card-body { padding: 0.5rem 0.6rem 0; display: grid; gap: 0.2rem; min-width: 0; }
.ep-card-caption { margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.ep-card-date { margin: 0; font-size: 0.8rem; }
.ep-card-actions { display: flex; justify-content: flex-end; gap: 0.25rem; padding: 0.25rem 0.4rem 0.4rem; margin-top: auto; }
.ep-card-actions .admin-action-btn { min-width: 44px; min-height: 44px; }

.ep-status {
    justify-self: start;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.ep-status-pending { background: var(--brand-blue-100, #e0f0ff); color: var(--brand-blue-800, #004578); }
.ep-status-approved { background: #d1f2df; color: #0f5132; }
.ep-status-hidden { background: var(--brand-cloudgrey-200, #e5e7eb); color: var(--brand-cloudgrey-800, #374151); }
.ep-status-processing { background: #fff3cd; color: #664d03; }

@media (min-width: 576px) {
    .ep-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
    .ep-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ───────────────────────── public gallery ───────────────────────── */

.ep-gallery-page { padding-top: 1.5rem; padding-bottom: 3rem; min-width: 0; }
.ep-gallery-header { margin-bottom: 1rem; }
.ep-gallery-header h1 { margin-bottom: 0.25rem; }

.ep-seg {
    display: inline-flex;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
    border-radius: 999px;
    background: var(--brand-cloudgrey-100, #f3f4f6);
    border: 1px solid var(--brand-cloudgrey-200, #e5e7eb);
}

.ep-seg-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 88px;
    padding: 0 1.1rem;
    border-radius: 999px;
    color: var(--theme-dark, #1a2b3c);
    font-weight: 600;
    text-decoration: none;
}

.ep-seg-item:hover { color: var(--theme-primary, #0078d4); }
.ep-seg-item.active { background: var(--theme-white, #fff); color: var(--theme-primary, #0078d4); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.15); }
.ep-seg-item:focus-visible { outline: 3px solid var(--theme-primary, #0078d4); outline-offset: 2px; }

.ep-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ep-tile {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--brand-cloudgrey-100, #f3f4f6);
    cursor: pointer;
}

.ep-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s ease; }
.ep-tile:focus-visible { outline: 3px solid var(--theme-primary, #0078d4); outline-offset: 2px; }
.ep-tile .ep-card-play { width: 2.25rem; height: 2.25rem; }

@media (hover: hover) {
    .ep-tile:hover img { transform: scale(1.03); }
}

.ep-gallery-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--brand-cloudgrey-600, #6c757d);
}

.ep-gallery-empty i { font-size: 2.5rem; margin-bottom: 1rem; color: var(--brand-cloudgrey-400, #9ca3af); }
.ep-gallery-more { display: flex; justify-content: center; margin-top: 1.5rem; }
.ep-gallery-more .btn { min-height: 44px; }

@media (min-width: 576px) {
    .ep-gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
}

@media (min-width: 992px) {
    .ep-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
    .ep-gallery-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ───────────────────────── full-screen viewer ───────────────────────── */

.ep-viewer {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.94);
    color: #fff;
}

.ep-viewer[hidden] { display: none; }

.ep-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    flex: 0 0 auto;
}

.ep-viewer-counter { font-size: 0.9rem; opacity: 0.8; padding-left: 0.5rem; }

.ep-viewer-btn {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ep-viewer-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ep-viewer-btn:disabled { opacity: 0.3; }

.ep-viewer-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
    user-select: none;
    overflow: hidden;
}

.ep-viewer-stage img,
.ep-viewer-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.ep-viewer-prev,
.ep-viewer-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.ep-viewer-prev { left: 0.5rem; }
.ep-viewer-next { right: 0.5rem; }

.ep-viewer-caption {
    flex: 0 0 auto;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    font-size: 0.95rem;
    text-align: center;
    overflow-wrap: anywhere;
    max-height: 30vh;
    overflow-y: auto;
}

.ep-viewer-note { padding: 1.5rem; text-align: center; max-width: 28rem; }

body.ep-viewer-open { overflow: hidden; }

@media (max-width: 575.98px) {
    /* Swiping is the primary control on phones; keep the arrows but out of the image's way. */
    .ep-viewer-prev, .ep-viewer-next { top: auto; bottom: 0.5rem; transform: none; }
}

/* ───────────────────────── admin review ───────────────────────── */

.ep-admin { min-width: 0; }
.ep-empty-hint { font-size: 0.95rem !important; max-width: 34rem; margin: 0.75rem auto 0 !important; }

@media (pointer: coarse) {
    /* Touch: pill filters and tabs become full 44px targets without changing the desktop look. */
    .ep-admin .admin-filter-toggle { min-height: 44px; padding-left: 1rem; padding-right: 1rem; }
}

.ep-bulk[hidden] { display: none !important; }

.ep-admin-thumb {
    position: relative;
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 0.375rem;
    overflow: hidden;
    background: var(--brand-cloudgrey-100, #f3f4f6);
}

.ep-admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-admin-thumb .ep-card-play { width: 1.5rem; height: 1.5rem; right: 0.25rem; bottom: 0.25rem; font-size: 0.6rem; }
.ep-admin-caption { max-width: 22rem; overflow-wrap: anywhere; }
.ep-admin-table .admin-action-btn { min-width: 36px; min-height: 36px; }
.ep-row-busy { opacity: 0.5; pointer-events: none; }

.ep-admin-cards { display: grid; gap: 0.75rem; }
.ep-admin-card { display: grid; gap: 0.5rem; cursor: default; }
.ep-admin-card-top { display: flex; align-items: flex-start; gap: 0.75rem; }
.ep-admin-card-check { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.ep-admin-thumb-lg { width: 100%; height: auto; aspect-ratio: 4 / 3; flex: 1 1 auto; }
.ep-admin-card-body { min-width: 0; overflow-wrap: anywhere; }
.ep-admin-card-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ep-admin-card-actions .admin-action-btn { min-width: 44px; min-height: 44px; }

.ep-history li { padding: 0.5rem 0; border-bottom: 1px solid var(--brand-cloudgrey-200, #e5e7eb); overflow-wrap: anywhere; }
.ep-history li:last-child { border-bottom: 0; }

@media (max-width: 767.98px) {
    /* Phones: the bulk actions stick to the bottom of the screen, within thumb reach (SC-002). */
    .ep-bulk {
        position: sticky;
        bottom: 0;
        z-index: 5;
        flex-wrap: wrap;
        width: 100%;
        padding: 0.5rem 0.75rem;
        background: #fff;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
        border-radius: 0.5rem;
    }
    .ep-bulk .btn { min-height: 44px; }
}

.ep-viewer-media { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-width: 0; min-height: 0; }
