/* ข้างกัน สตูดิโอ — Admin Panel */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink:    #141414;
  --paper:  #ffffff;
  --muted:  #8a8a85;
  --line:   #e6e5e0;
  --bg:     #f5f4f0;
  --danger: #b83232;
  --font:   "IBM Plex Sans Thai", "Noto Sans Thai", sans-serif;
  --mono:   "IBM Plex Mono", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---- Login ---- */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--paper); border: 1px solid var(--line); padding: 48px 44px; width: 340px; }
.login-brand { font-weight: 600; font-size: 1.15rem; margin-bottom: 32px; display: flex; align-items: baseline; gap: 8px; }
.login-brand small { font-family: var(--mono); font-weight: 400; font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.err-msg { font-family: var(--mono); font-size: .72rem; color: var(--danger); margin-top: 10px; }

/* ---- Admin layout ---- */
#admin-screen { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--ink); color: #fff; padding: 28px 20px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { font-weight: 600; font-size: 1rem; margin-bottom: 28px; display: flex; align-items: baseline; gap: 8px; }
.sb-brand small { font-family: var(--mono); font-weight: 400; font-size: .56rem; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.42); }
.sb-link { display: block; padding: 9px 12px; color: rgba(255,255,255,.55); border-radius: 4px; font-size: .88rem; background: none; border: none; text-align: left; width: 100%; }
.sb-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sb-link.active { background: rgba(255,255,255,.14); color: #fff; }
.sb-logout { margin-top: auto; }

.a-main { flex: 1; padding: 36px 44px 60px; max-width: 960px; }

/* ---- View header ---- */
.a-view-head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.a-view-head h1 { font-size: 1.25rem; font-weight: 600; flex: 1; }
.a-btn-group { display: flex; gap: 8px; }

/* ---- Buttons ---- */
.a-btn-primary { background: var(--ink); color: #fff; border: none; padding: 10px 20px; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.a-btn-primary:hover { background: #333; }
.a-btn-ghost { background: none; border: none; padding: 10px 0; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.a-btn-ghost:hover { color: var(--ink); }
.a-btn-danger { background: none; border: 1px solid var(--line); color: var(--danger); padding: 10px 16px; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.a-btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.a-btn-edit { background: none; border: 1px solid var(--line); padding: 7px 14px; font-size: .78rem; font-family: var(--mono); }
.a-btn-edit:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- Project list ---- */
#proj-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pc { display: grid; grid-template-columns: 72px 1fr auto; background: var(--paper); align-items: center; }
.pc:hover { background: #fafaf8; }
.pc-thumb { width: 72px; height: 54px; overflow: hidden; flex-shrink: 0; }
.pc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pc-ph { width: 100%; height: 100%; }
.pc-info { padding: 12px 16px; }
.pc-code { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; color: var(--muted); }
.pc-name { font-size: .95rem; font-weight: 600; line-height: 1.3; }
.pc-meta { font-size: .78rem; color: var(--muted); }
.pc-actions { padding-right: 16px; }
.empty-state { padding: 48px; text-align: center; background: var(--paper); border: 1px solid var(--line); font-family: var(--mono); font-size: .8rem; color: var(--muted); }

/* thumbnail tones (ใช้เหมือนเว็บหลัก) */
.t1 { background: linear-gradient(150deg,#7d8a6f,#3d4a38); }
.t2 { background: linear-gradient(150deg,#b6a07d,#8a7350); }
.t3 { background: linear-gradient(150deg,#9aa6ad,#5d6b72); }
.t4 { background: linear-gradient(150deg,#c2bcae,#8f897a); }
.t5 { background: linear-gradient(150deg,#a7b59a,#6b7860); }
.t6 { background: linear-gradient(150deg,#cbb9a0,#9a845f); }

/* ---- Editor ---- */
.editor-body { display: flex; flex-direction: column; gap: 24px; }
.a-section { background: var(--paper); border: 1px solid var(--line); padding: 28px; }
.a-section h2 { font-size: .95rem; font-weight: 600; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.a-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.a-field { display: flex; flex-direction: column; gap: 6px; }
.a-field-full { margin-top: 8px; }
.a-field label { font-family: var(--mono); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.a-field input, .a-field select, .a-field textarea { border: none; border-bottom: 1px solid var(--line); padding: 8px 0; font-family: var(--font); font-size: .93rem; background: transparent; color: var(--ink); width: 100%; }
.a-field input:focus, .a-field select:focus, .a-field textarea:focus { outline: none; border-color: var(--ink); }
.a-field textarea { resize: vertical; line-height: 1.7; }
.a-hint { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-bottom: 14px; }

/* ---- Drop zone ---- */
.drop-zone { border: 2px dashed var(--line); padding: 36px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.drop-zone:hover, .drop-zone.dz-over { border-color: var(--ink); background: var(--bg); }
.dz-icon { font-size: 1.8rem; margin-bottom: 10px; }
.dz-text { font-size: .92rem; }
.dz-link { color: #3d6b50; text-decoration: underline; }
.dz-hint { font-family: var(--mono); font-size: .68rem; color: var(--muted); margin-top: 6px; }

/* ---- Image list ---- */
.img-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; min-height: 0; }
.img-item { position: relative; width: 130px; height: 97px; overflow: hidden; border: 1px solid var(--line); }
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-cover { position: absolute; top: 6px; left: 6px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: .58rem; letter-spacing: .06em; padding: 2px 7px; text-transform: uppercase; pointer-events: none; }
.img-del { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; display: flex; align-items: center; justify-content: center; }
.img-del:hover { background: var(--danger); }
.img-empty { font-family: var(--mono); font-size: .72rem; color: var(--muted); padding: 8px 0; }

/* ---- Storage warning bar ---- */
.storage-bar { font-family: var(--mono); font-size: .68rem; color: var(--muted); padding: 6px 0; }
.storage-bar.warn { color: #b87a00; }
.storage-bar.danger { color: var(--danger); }
