/* ================================================================
   FriendsByChance — components/epa-editor.css
   Editable Photo Album — editor component
   ================================================================ */

/* ── Overlay backdrop ────────────────────────────────────────────── */
.epa-editor-overlay {
    position:        fixed;
    inset:           0;
    z-index:         600;
    background:      rgba(0, 0, 0, 0.50);
    display:         flex;
    align-items:     center;
    justify-content: center;
}

/* ── Modal panel ─────────────────────────────────────────────────── */
.epa-editor-panel {
    width:          100%;
    max-width:      720px;
    max-height:     calc(100vh - 48px);
    background:     var(--color-bg);
    border-radius:  12px;
    display:        flex;
    flex-direction: column;
    overflow:       hidden;
    box-shadow:     0 8px 32px rgba(0, 0, 0, 0.25);
}

/* Full-screen on small screens */
@media (max-width: 640px) {
    .epa-editor-overlay {
        background:      var(--color-bg);
        align-items:     stretch;
        justify-content: stretch;
    }
    .epa-editor-panel {
        max-width:     none;
        max-height:    none;
        height:        100%;
        border-radius: 0;
        box-shadow:    none;
    }
}

/* ── Header (name + description + action side col) ───────────────── */
.epa-editor-header {
    flex-shrink:   0;
    display:       flex;
    gap:           8px;
    align-items:   flex-start;
    padding:       14px 14px 12px;
    border-bottom: 1px solid var(--color-divider);
}

.epa-editor-header-body {
    flex:      1;
    min-width: 0;
}

/* ── Album name input ────────────────────────────────────────────── */
.epa-name-input {
    display:       block;
    width:         100%;
    box-sizing:    border-box;
    margin-bottom: 8px;
    padding:       6px 10px;
    border:        1px solid var(--color-divider);
    border-radius: 6px;
    background:    var(--color-input-bg, #fff);
    color:         var(--color-text);
    font-size:     0.95em;
}
.epa-name-input:focus        { outline: none; border-color: var(--color-primary); }
.epa-name-input::placeholder { color: var(--color-text-muted); }

/* ── Album description textarea ──────────────────────────────────── */
.epa-desc-input {
    display:      block;
    width:        100%;
    box-sizing:   border-box;
    padding:      6px 10px;
    border:       1px solid var(--color-divider);
    border-radius: 6px;
    background:   var(--color-input-bg, #fff);
    color:        var(--color-text);
    font-size:    0.88em;
    resize:       vertical;
    min-height:   56px;
    max-height:   120px;
    line-height:  1.5;
}
.epa-desc-input:focus        { outline: none; border-color: var(--color-primary); }
.epa-desc-input::placeholder { color: var(--color-text-muted); }

/* ── Inline error ────────────────────────────────────────────────── */
.epa-editor-error {
    color:      var(--color-danger, #c0392b);
    font-size:  0.85em;
    margin-top: 6px;
}

/* ── Header side column (back / save / discard) ──────────────────── */
.epa-editor-header-side {
    display:        flex;
    flex-direction: column;
    gap:            6px;
    flex-shrink:    0;
    padding-top:    2px;
}

/* ── Photo list area ─────────────────────────────────────────────── */
.epa-editor-list-wrap {
    flex:     1;
    overflow: hidden;
    position: relative;
    display:  flex;
}

/* Scrollable list; leave room for global bar when selection is active */
.epa-editor-list {
    flex:       1;
    overflow-y: auto;
    padding:    4px 0;
}
.epa-editor-list-wrap.sel-active .epa-editor-list {
    padding-right: 44px;
}

/* Pictures dragged in from the desktop are over the list (FBC.ui.dragReorder) */
.epa-editor-list.drag-into {
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
    outline:    2px dashed var(--color-primary);
    outline-offset: -2px;
}

/* ── "Add photo" button (appears at top and bottom of list) ──────── */
.epa-add-photo-row {
    display:       flex;
    align-items:   center;
    gap:           6px;
    width:         100%;
    box-sizing:    border-box;
    padding:       7px 12px;
    background:    none;
    border:        none;
    border-radius: 6px;
    color:         var(--color-primary);
    font-size:     0.88em;
    cursor:        pointer;
    text-align:    left;
}
.epa-add-photo-row:hover    { background: var(--color-hover, rgba(0,0,0,0.04)); }
.epa-add-photo-row:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

/* ── Photo row ───────────────────────────────────────────────────── */
.epa-photo-row {
    display:     flex;
    align-items: center;
    gap:         8px;
    padding:     4px 8px;
    border-radius: 6px;
    border-top:   2px solid transparent;
    border-bottom: 2px solid transparent;
    transition:  background 0.1s;
}
.epa-photo-row:hover              { background: var(--color-hover, rgba(0,0,0,0.03)); }
.epa-photo-row.selected           { background: rgba(0,0,0,0.05); }
.epa-photo-row.dragging           { opacity: 0.35; }
.epa-photo-row.drag-before        { border-top-color: var(--color-primary); }
.epa-photo-row.drag-after         { border-bottom-color: var(--color-primary); }

/* ── Its grip (.fbc-drag-handle): the row's height ───────────────── */
.epa-drag-handle { align-self: stretch; }

/* ── Photo checkbox ──────────────────────────────────────────────── */
.epa-photo-cb {
    flex-shrink:  0;
    width:        16px;
    height:       16px;
    cursor:       pointer;
    accent-color: var(--color-primary);
}

/* ── xs thumbnail shown in the editor list ───────────────────────── */
.epa-editor-thumb {
    height:        96px;
    width:         auto;
    max-width:     200px;
    object-fit:    cover;
    border-radius: 4px;
    cursor:        zoom-in;
    display:       block;
}
.epa-editor-thumb:hover { opacity: 0.85; }

/* ── Spacer (reserved for future per-photo metadata) ─────────────── */
.epa-photo-spacer { flex: 1; }

/* ── Per-row side column (delete button) ─────────────────────────── */
.epa-photo-row-side {
    flex-shrink:    0;
    display:        flex;
    flex-direction: column;
    gap:            6px;
}
/* Hidden while multi-select is active */
.epa-editor-list-wrap.sel-active .epa-photo-row-side { display: none; }

/* ── Global selection sidebar ────────────────────────────────────── */
.epa-global-sel-bar {
    position:        absolute;
    right:           0;
    top:             0;
    bottom:          0;
    width:           40px;
    display:         none;   /* shown via .sel-active */
    flex-direction:  column;
    align-items:     center;
    justify-content: flex-start;
    padding-top:     8px;
    gap:             6px;
    background:      var(--color-bg);
    border-left:     1px solid var(--color-divider);
}
.epa-editor-list-wrap.sel-active .epa-global-sel-bar { display: flex; }

/* ── Upload loading state ────────────────────────────────────────── */
.epa-photo-row.pending { opacity: 0.60; }

.epa-thumb-wrap {
    position:   relative;
    flex-shrink: 0;
}

.epa-upload-spinner {
    position:        absolute;
    inset:           0;
    display:         flex;
    align-items:     center;
    justify-content: center;
    background:      rgba(0, 0, 0, 0.28);
    border-radius:   4px;
}

.epa-spinner {
    width:        20px;
    height:       20px;
    border:       3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation:    epa-spin 0.8s linear infinite;
}

@keyframes epa-spin { to { transform: rotate(360deg); } }

/* ── Full-screen photo preview (on top of editor) ────────────────── */
.epa-photo-preview-overlay {
    position:        fixed;
    inset:           0;
    z-index:         700;
    background:      rgba(0, 0, 0, 0.90);
    display:         flex;
    align-items:     center;
    justify-content: center;
    cursor:          zoom-out;
}
.epa-photo-preview-img {
    max-width:   100%;
    max-height:  100%;
    object-fit:  contain;
    display:     block;
    user-select: none;
}
