/* ===========================================================================
   หน้าอัลบั้มรูปภาพ — โหมด 0 ไบต์
   ===========================================================================
   ใช้กริดจัตุรัส 1:1 เท่ากันหมดแบบเดียวกับอัลบั้มในโพสต์ (mes-album-grid)
   รูปถูกครอบด้วย CSS ไม่ได้ตัดไฟล์จริง — ไฟล์ต้นทางไม่เคยถูกแตะเลย
   =========================================================================== */
.album-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 12px 40px;
}

/* ---- แถบแจ้งผล ---- */
.album-flash {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: .86rem;
}
.album-flash.ok {
    background: rgba(52, 211, 153, .1);
    border: 1px solid rgba(52, 211, 153, .35);
    color: #6ee7b7;
}
.album-flash.err {
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .35);
    color: #fca5a5;
}

/* ---- หัวหน้า ---- */
.album-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.album-head h1 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--gold, #d4af37);
}
.album-sub {
    margin: 4px 0 0;
    font-size: .82rem;
    color: var(--text-dim, #a1938c);
}
.album-back {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line, #2a2a2e);
    color: var(--gold, #d4af37);
    text-decoration: none;
    font-size: 1.1rem;
}

/* ---- เครื่องมือจัดการอัลบั้ม ---- */
.album-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 12px;
    background: var(--surface-2, #1c1c20);
    border: 1px solid var(--line, #2a2a2e);
}
.album-rename-form {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 220px;
}
.album-rename-form .input { flex: 1; min-width: 0; }
.album-default-note {
    font-size: .78rem;
    color: var(--text-mute, #6f6360);
}

/* ปุ่มลบ — คลาสนี้ยังไม่มีในระบบ จึงประกาศไว้ที่นี่ให้ครบ
   (blocks.css มีแค่ s-gold กับ s-outline) */
.blk-btn.s-danger {
    border: 1px solid rgba(239, 68, 68, .5);
    background: transparent;
    color: #fca5a5;
}
.blk-btn.s-danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* ---- รายการอัลบั้ม ---- */
.album-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.album-card {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2, #1c1c20);
    border: 1px solid var(--line, #2a2a2e);
    text-decoration: none;
    color: inherit;
}
.album-card:hover { border-color: var(--gold-dim, #8a7128); }
.album-card.is-default { border-color: var(--gold, #d4af37); }

.album-card-cover {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #101013;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* รูปปกจาก LensFx มีกล่องครอบของตัวเอง — บังคับให้เต็มช่องจัตุรัสพอดี */
.album-card-cover img,
.album-card-cover .fx-frame {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.album-card-blank {
    font-size: 2rem;
    opacity: .35;
}

.album-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
}
.album-card-name {
    font-size: .84rem;
    color: var(--text, #ece5e0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.album-card-count {
    font-size: .72rem;
    color: var(--text-mute, #6f6360);
}

/* ---- รูปในอัลบั้ม ---- */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
}
.album-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: #101013;
}
.album-cell img,
.album-cell .fx-frame {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ปุ่มลบรูป / ลิงก์ไปโพสต์ — มุมบนของแต่ละช่อง */
.album-cell-del button,
.album-cell-post {
    position: absolute;
    top: 4px;
    z-index: 2;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: .78rem;
    cursor: pointer;
    text-decoration: none;
}
.album-cell-del button { right: 4px; }
.album-cell-post { left: 4px; }
.album-cell-del button:hover { background: rgba(239, 68, 68, .85); }

/* ---- สถานะว่าง ---- */
.album-empty {
    text-align: center;
    padding: 50px 20px;
    border: 1px dashed rgba(212, 175, 55, .22);
    border-radius: 16px;
}
.album-empty h1 {
    font-size: 1.2rem;
    color: var(--gold, #d4af37);
    margin: 0 0 10px;
}
.album-empty p {
    color: var(--text-dim, #a1938c);
    font-size: .9rem;
    margin: 0 0 8px;
}
.album-empty .blk-btn { margin-top: 14px; }

/* =============================================================================
   🖼️ [24 ก.ย. 2569 — LANE เพจ/กลุ่ม #1 เรื่องที่ 2] แท็บอัลบั้มของเพจ/กลุ่ม (app/partials/entity-album.php)
   ทุกคลาสขึ้นต้น .ea- — ไม่กวาดกว้าง ไม่แตะคลาสเดิมของอัลบั้มผู้ใช้
   ============================================================================= */
.ea-wrap { margin-top: 12px; }
.ea-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.ea-head h3 { margin: 0; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ea-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ea-album-card { display: block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--text); text-decoration: none; cursor: pointer; font-family: inherit; padding: 0; text-align: left; }
.ea-album-card:hover { border-color: var(--gold); }
.ea-album-cover { display: flex; align-items: center; justify-content: center; height: 96px; font-size: 1.8rem; background: var(--bg-soft); overflow: hidden; }
.ea-album-cover img { width: 100%; height: 100%; object-fit: cover; }
.ea-album-info { display: block; padding: 8px 10px; }
.ea-album-info b { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ea-album-info span { font-size: .72rem; color: var(--text-dim); }
.ea-album-card.ea-new { display: flex; align-items: center; justify-content: center; min-height: 140px; border-style: dashed; color: var(--gold-soft); background: transparent; font-size: .9rem; }
.ea-empty { padding: 24px 10px; text-align: center; color: var(--text-dim); font-size: .86rem; line-height: 1.7; border: 1px dashed var(--line); border-radius: 12px; }
.ea-no-upload { font-size: .78rem; color: #d98a1f; background: rgba(217, 138, 31, .08); border: 1px solid #d98a1f; border-radius: 8px; padding: 8px 10px; margin: 10px 0; }
.ea-perm { font-size: .76rem; color: var(--text-dim); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin-top: 12px; line-height: 1.6; }
.ea-panel { background: var(--surface-2); border: 1px solid var(--gold-dim); border-radius: 10px; padding: 10px; margin: 10px 0; font-size: .82rem; }
.ea-ss-fx { margin: 8px 0; }
.ea-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ea-spread { justify-content: space-between; }
.ea-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ea-cell { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--bg-soft); padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--gold-soft); }
.ea-cell img { width: 100%; height: 100%; object-fit: cover; }
.ea-cell:hover { border-color: var(--gold); }
.ea-cell.is-picking { opacity: .55; }
.ea-cell.is-picked { opacity: 1; border-color: var(--gold); }
.ea-cell .ea-no { position: absolute; top: 4px; left: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: #1a1a1a; font-size: .72rem; font-weight: 800; display: none; align-items: center; justify-content: center; }
.ea-cell.is-picked .ea-no { display: flex; }
.ea-cell .ea-cov { position: absolute; bottom: 4px; left: 4px; font-size: .62rem; background: rgba(0, 0, 0, .7); color: var(--gold-soft); padding: 1px 5px; border-radius: 5px; }
.ea-cell.ea-add { border: 1px dashed var(--gold-dim); }
.ea-cell[hidden] { display: none; }
.ea-ss-list { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.ea-ss-card { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: .84rem; }
.ea-ss-thumb { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--bg-soft); flex-shrink: 0; }
.ea-ss-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ea-ss-meta { flex: 1; min-width: 0; }
.ea-ss-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ea-ss-meta span { font-size: .72rem; color: var(--text-dim); }
.ea-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .62); display: flex; align-items: flex-end; justify-content: center; z-index: 500; }
.ea-overlay[hidden] { display: none; }
.ea-sheet { width: 100%; max-width: 520px; max-height: 84vh; overflow-y: auto; background: var(--bg-soft); border: 1px solid var(--line); border-bottom: none; border-radius: 16px 16px 0 0; padding: 14px; }
.ea-sheet h4 { margin: 0 0 10px; color: var(--gold); display: flex; justify-content: space-between; align-items: center; }
.ea-x { background: transparent; border: 1px solid var(--line); color: var(--text-dim); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; }
.ea-input { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-family: inherit; font-size: .9rem; box-sizing: border-box; }
.ea-err { color: var(--red-soft); font-size: .8rem; margin: 6px 0; }
.ea-err[hidden] { display: none; }
.ea-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; font-family: inherit; font-size: .9rem; text-align: left; }
.ea-opt:hover { border-color: var(--gold); }
.ea-opt small { display: block; color: var(--text-dim); font-size: .74rem; }
.ea-opt.ea-danger { color: var(--red-soft); }
.ea-ico { font-size: 1.3rem; }
.ea-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; padding: 8px 0; }
.ea-pick-grid[hidden] { display: none; }
.ea-pick { position: relative; aspect-ratio: 1 / 1; border: 2px solid transparent; border-radius: 8px; overflow: hidden; padding: 0; cursor: pointer; background: var(--surface); }
.ea-pick img { width: 100%; height: 100%; object-fit: cover; }
.ea-pick.sel { border-color: var(--gold); }
.ea-pick.sel::after { content: "✓"; position: absolute; top: 3px; right: 6px; color: var(--gold); font-weight: 800; }
.ea-viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ea-viewer[hidden] { display: none; }
.ea-viewer-img { max-width: min(92vw, 720px); max-height: 72vh; border-radius: 10px; object-fit: contain; }
.ea-viewer-bar { margin-top: 12px; justify-content: center; }
.ea-viewer-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold-dim); background: rgba(0, 0, 0, .6); color: var(--gold-soft); cursor: pointer; }
.ea-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold-dim); background: rgba(0, 0, 0, .6); color: var(--gold-soft); cursor: pointer; }
.ea-nav-l { left: 10px; }
.ea-nav-r { right: 10px; }
