/* ============================================================
   DMCEU · หลังบ้านทีมงาน (admin.html)
   ต่อยอดจาก styles.css — ใช้โทเคนสี/ปุ่ม/โมดัลชุดเดียวกัน
   ============================================================ */

body.admin-page { padding-bottom: calc(var(--sat-bottom) + 40px); }
.admin-main { padding-top: 18px; }

.brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand-text span { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.brand { text-decoration: none; }

.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn .ic-moon, [data-theme="dark"] .icon-btn .ic-sun { display: none; }
[data-theme="dark"] .icon-btn .ic-moon { display: block; }

/* ─── ล็อกอิน ─── */
.auth-card {
    max-width: 420px; margin: 8vh auto 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-xl); box-shadow: var(--shadow-md);
    padding: 30px 22px 22px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    animation: rise .45s var(--ease) both;
}
.auth-icon {
    width: 58px; height: 58px; border-radius: 18px;
    display: grid; place-items: center;
    background: linear-gradient(150deg, var(--navy-3), var(--navy));
    color: var(--gold-light); font-size: 26px; margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}
.auth-title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.auth-sub { font-size: 13px; color: var(--text-mute); }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.auth-form .btn-primary { width: 100%; margin-top: 4px; }
.auth-note { font-size: 11.5px; color: var(--text-mute); margin-top: 14px; text-align: center; }
.btn-primary.busy, .btn-ghost.busy, .icon-btn.busy { opacity: .6; pointer-events: none; }

/* ─── หัวหน้า ─── */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.admin-title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.admin-title .ic { width: 20px; height: 20px; color: var(--gold-dim); }
[data-theme="dark"] .admin-title .ic { color: var(--gold-light); }
.admin-sub { font-size: 12.5px; color: var(--text-mute); }
.btn-sm { flex: none; min-height: 38px; padding: 0 13px; font-size: 13px; text-decoration: none; }
.btn-sm .ic { width: 14px; height: 14px; }

/* ปุ่มเพิ่ม */
.add-btn {
    width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
    padding: 14px 16px;
    background: var(--surface); border: 1.5px dashed var(--border-2);
    border-radius: var(--r-lg); color: var(--text);
    transition: transform .15s var(--ease), border-color .2s, background-color .2s;
}
.add-btn:hover { border-color: var(--blue); background: var(--blue-soft); }
.add-btn:active { transform: scale(.985); }
.add-btn-ic {
    width: 44px; height: 44px; flex: none; border-radius: 14px;
    display: grid; place-items: center;
    background: var(--navy); color: #fff; font-size: 20px;
}
[data-theme="dark"] .add-btn-ic { background: var(--gold); color: #16110a; }
.add-btn-text { display: flex; flex-direction: column; line-height: 1.3; }
.add-btn-text strong { font-weight: 500; font-size: 15px; }
.add-btn-text span { font-size: 12px; color: var(--text-mute); }

/* ─── รายการ ─── */
.admin-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.ev-row {
    display: grid; grid-template-columns: 84px 1fr; gap: 0 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
    padding: 12px; animation: rise .35s var(--ease) both;
}
.ev-row.hidden-row { opacity: .72; }
.ev-thumb {
    grid-row: span 2;
    width: 84px; aspect-ratio: 3/4; border-radius: var(--r-sm);
    overflow: hidden; background: var(--surface-3); position: relative;
}
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ev-thumb .ev-count {
    position: absolute; top: 4px; right: 4px; padding: 2px 7px; border-radius: var(--r-pill);
    background: rgba(20,26,51,.8); color: #fff; font-size: 10.5px;
}
.ev-thumb .ev-hidden-badge {
    position: absolute; inset: auto 0 0; padding: 3px 0; text-align: center;
    background: rgba(20,26,51,.8); color: #fff; font-size: 10.5px;
}
.ev-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ev-title { font-size: 15px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev-desc { font-size: 12.5px; color: var(--text-sec); line-height: 1.45; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev-meta { font-size: 11.5px; color: var(--text-mute); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ev-actions { display: flex; gap: 6px; align-items: center; margin-top: 8px; grid-column: 2; }
.ev-actions .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.ev-actions .icon-btn.danger { color: var(--red); }
.ev-actions .spacer { flex: 1; }
.ev-actions .icon-btn:disabled { opacity: .35; pointer-events: none; }

.admin-empty {
    text-align: center; padding: 40px 16px; color: var(--text-mute); font-size: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.admin-empty .ic { width: 32px; height: 32px; }
.admin-foot { margin-top: 22px; font-size: 12px; color: var(--text-mute); text-align: center; line-height: 1.5; }

/* ─── ฟอร์ม ─── */
.edit-card { max-height: calc(100dvh - 24px); overflow: auto; -webkit-overflow-scrolling: touch; }
.edit-card > * { flex-shrink: 0; }   /* กันรูปตัวอย่างโดนบีบตอนฟอร์มยาวกว่าจอ */
.field-textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }

.drop {
    position: relative; border: 1.5px dashed var(--border-2); border-radius: var(--r-lg);
    background: var(--surface-2); cursor: pointer; overflow: hidden; outline: none;
    transition: border-color .2s, background-color .2s;
}
.drop:focus-visible, .drop.over { border-color: var(--blue); background: var(--blue-soft); }
.drop-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 30px 16px; text-align: center; color: var(--text-sec);
}
.drop-empty .ic { width: 30px; height: 30px; color: var(--text-mute); margin-bottom: 4px; }
.drop-empty strong { font-weight: 500; color: var(--text); }
.drop-empty span { font-size: 12px; color: var(--text-mute); }
/* รูปในโพสต์ */
.shots {
    display: grid; gap: 8px; padding: 10px;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}
.shot {
    position: relative; aspect-ratio: 3/4; border-radius: var(--r-sm);
    overflow: hidden; background: var(--navy);
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-cover, .shot-new {
    position: absolute; top: 5px; left: 5px; padding: 2px 8px; border-radius: var(--r-pill);
    font-size: 10.5px; color: #fff; background: rgba(8,11,22,.72);
}
.shot-new { background: var(--green); }
.shot-x {
    position: absolute; top: 4px; right: 4px;
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: 14px;
    background: rgba(8,11,22,.72); color: #fff;
}
.shot-x:active { transform: scale(.9); }
.shot-move {
    position: absolute; inset: auto 0 0; display: flex;
    background: linear-gradient(rgba(8,11,22,0), rgba(8,11,22,.72));
}
.shot-move button {
    flex: 1; height: 30px; display: grid; place-items: center;
    color: #fff; font-size: 15px;
}
.shot-move button:disabled { opacity: .3; pointer-events: none; }
.shot-move button:active { transform: scale(.9); }
.shot .ic { width: 15px; height: 15px; }
.shot-add {
    aspect-ratio: 3/4; border-radius: var(--r-sm);
    border: 1.5px dashed var(--border-2); background: var(--surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    color: var(--text-sec); font-size: 12px;
    transition: border-color .2s, background-color .2s, transform .15s var(--ease);
}
.shot-add .ic { width: 20px; height: 20px; }
.shot-add:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.shot-add:active { transform: scale(.95); }
.shots-hint { font-size: 11.5px; color: var(--text-mute); margin-top: -6px; }

.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
    cursor: pointer;
}
.switch-text { display: flex; flex-direction: column; line-height: 1.3; }
.switch-text strong { font-weight: 500; font-size: 14px; }
.switch-text span { font-size: 12px; color: var(--text-mute); }
.switch {
    appearance: none; -webkit-appearance: none; flex: none;
    width: 50px; height: 30px; border-radius: var(--r-pill);
    background: var(--border-2); position: relative; cursor: pointer; margin: 0;
    transition: background-color .2s var(--ease);
}
.switch::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
    transition: transform .2s var(--ease);
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

.upload-progress { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-sec); }
.upload-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.upload-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--gold)); transition: width .3s var(--ease); }

.btn-danger { background: var(--red) !important; color: #fff !important; }
.confirm-text { font-size: 14px; color: var(--text-sec); line-height: 1.5; }
.btn-primary .ic, .btn-ghost .ic { width: 16px; height: 16px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (min-width: 620px) {
    .admin-main { padding-top: 26px; max-width: 760px; }
    .ev-row { grid-template-columns: 110px 1fr; padding: 14px; }
    .ev-thumb { width: 110px; }
}
