/* ============================================================
   GALLERY-EDITOR.CSS — dùng chung cho Kho Ảnh Trang Chủ, Album lớp,
   và Trang Phục khi Admin/Thành viên bật "Chế độ sửa ảnh".
   ============================================================ */

.outfit-card-item { position: relative; }

.gallery-edit-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

.gallery-edit-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--gold, #B84A2B);
    background: rgba(255, 255, 255, 0.8);
    color: var(--gold, #B84A2B);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: 0.2s ease;
}
.gallery-edit-btn:hover { background: var(--gold, #B84A2B); color: #ffffff; }

.gallery-edit-btn-danger { border-color: #dc2626; color: #dc2626; }
.gallery-edit-btn-danger:hover { background: #dc2626; color: #ffffff; }

.gallery-add-tile {
    cursor: pointer;
    border: 2px dashed rgba(184,74,43,0.5);
    background: rgba(184,74,43,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
}
.gallery-add-tile:hover {
    border-color: var(--gold, #B84A2B);
    background: rgba(184,74,43,0.12);
}
.gallery-add-tile-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gold, #B84A2B);
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
    padding: 10px;
}
.gallery-add-tile-inner i { font-size: 1.6rem; }

/* ===== MODAL CHỌN KHUNG ẢNH (ngang / dọc / vuông / lớn) ===== */
.gallery-size-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(245,239,226,0.85);
    backdrop-filter: blur(3px);
    z-index: 4000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.gallery-size-picker-overlay.show { display: flex; }

.gallery-size-picker-box {
    background: var(--bg-card, #FFFDF7);
    border: 1px solid var(--gold, #B84A2B);
    border-radius: 12px;
    padding: 25px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.gallery-size-picker-box h4 {
    color: var(--gold, #B84A2B);
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}
.gallery-size-picker-hint {
    color: var(--text-muted, #4A3429);
    font-size: 0.85rem;
    margin: 0 0 18px 0;
    line-height: 1.5;
}
.gallery-size-picker-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.gallery-size-option {
    background: transparent;
    border: 1px solid var(--border-color, #E6D7BC);
    color: var(--text-main);
    padding: 12px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: 0.2s ease;
}
.gallery-size-option.active,
.gallery-size-option:hover {
    border-color: var(--gold, #B84A2B);
    background: rgba(184,74,43,0.15);
    color: var(--gold, #B84A2B);
}
.gallery-size-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.gallery-size-picker-cancel,
.gallery-size-picker-confirm {
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
}
.gallery-size-picker-cancel {
    background: transparent;
    color: var(--text-muted, #4A3429);
    border: 1px solid var(--border-color, #E6D7BC);
}
.gallery-size-picker-confirm { background: var(--gold, #B84A2B); color: #ffffff; }
/* ---------- Tải nhiều ảnh / cả thư mục ---------- */
.gallery-bulk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px 12px; background: rgba(184,74,43,0.06); border: 1px dashed rgba(184,74,43,0.5); border-radius: 10px; }
.gallery-bulk-toolbar button { background: var(--gold, #B84A2B); color: #FFFDF7; border: none; padding: 8px 14px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; cursor: pointer; font-family: inherit; }
.gallery-bulk-toolbar button[data-act="layout"] { background: transparent; color: var(--gold, #B84A2B); border: 1px solid var(--gold, #B84A2B); }
.gallery-bulk-toolbar button:hover { filter: brightness(1.08); }
.gallery-bulk-hint { font-size: 0.78rem; color: var(--text-muted, #4A3429); font-style: italic; }

.gallery-batch-overlay { position: fixed; inset: 0; z-index: 100002; background: rgba(23,21,19,0.6); display: none; align-items: center; justify-content: center; padding: 20px; }
.gallery-batch-overlay.show { display: flex; }
.gallery-batch-box { background: #FFFDF7; border-radius: 12px; padding: 24px; width: min(420px, 100%); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.gallery-batch-box h4 { margin: 0 0 10px; color: var(--gold, #B84A2B); }
.gallery-batch-text { margin: 0 0 12px; font-weight: 700; color: #171513; }
.gallery-batch-bar { height: 10px; background: #E6D7BC; border-radius: 6px; overflow: hidden; }
.gallery-batch-fill { height: 100%; width: 0; background: var(--gold, #B84A2B); transition: width 0.3s ease; }
.gallery-batch-hint { margin: 12px 0 0; font-size: 0.8rem; color: var(--text-muted, #4A3429); }

/* Ảnh lỗi (file mất) — chỉ hiện khi đang bật Chế độ chỉnh sửa, khách không thấy */
.gallery-broken { min-height: 140px; border: 2px dashed #681F1B !important; background: rgba(104,31,27,0.06); }
.gallery-broken img { display: none !important; }
.gallery-broken::before { content: "Ảnh lỗi — bấm 🗑 để xoá hoặc dùng \"Dọn ảnh lỗi\""; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; font-size: 0.85rem; font-weight: 700; color: #681F1B; }

/* ---------- Vùng kéo thả thư mục / ảnh ---------- */
.gallery-drop-zone { position: relative; }
.gallery-drop-zone.drag-over { outline: 3px dashed var(--gold, #B84A2B); outline-offset: 6px; border-radius: 12px; }
.gallery-drop-zone.drag-over::after {
    content: attr(data-drop-label);
    position: absolute; inset: 0; z-index: 50;
    display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px;
    background: rgba(184,74,43,0.14); backdrop-filter: blur(2px);
    color: var(--gold, #B84A2B); font-size: 1.3rem; font-weight: 800; border-radius: 12px; pointer-events: none;
}

/* ---------- Hộp chọn ảnh (ảnh bìa album...) ---------- */
.image-picker-overlay { position: fixed; inset: 0; z-index: 100003; background: rgba(23,21,19,0.65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.image-picker-box { background: #FFFDF7; border-radius: 12px; width: min(900px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.35); }
.image-picker-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #E6D7BC; }
.image-picker-head h4 { margin: 0; color: var(--gold, #B84A2B); }
.image-picker-head button { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #4A3429; }
.image-picker-grid { padding: 14px 18px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.image-picker-cell { position: relative; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: #E6D7BC; }
.image-picker-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-picker-cell:hover { border-color: var(--gold, #B84A2B); }
.image-picker-cell.current { border-color: #686B4D; }
.image-picker-cell span { position: absolute; left: 6px; bottom: 6px; background: #686B4D; color: #FFFDF7; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.image-picker-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid #E6D7BC; font-size: 0.85rem; color: #4A3429; }
.image-picker-foot button { background: var(--gold, #B84A2B); color: #FFFDF7; border: none; padding: 9px 16px; border-radius: 20px; font-weight: 700; cursor: pointer; font-family: inherit; }
