/* ===================================================================
   Admin panel styles
   =================================================================== */
:root {
  --navy: #14213d; --ink: #1a1f2e; --slate: #4a5468; --muted: #7a8397;
  --line: #e4e7ee; --bg-soft: #f6f7fb; --bg-alt: #eef0f7; --gold: #c8952f;
  --crimson: #9c2b2e; --green: #2f7a4d; --red: #b23b3b;
  --radius: 12px; --shadow-sm: 0 4px 18px rgba(20,33,61,0.07);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, sans-serif; background: var(--bg-soft); color: var(--ink); line-height: 1.6; }
a { color: var(--crimson); text-decoration: none; }
a:hover { text-decoration: underline; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--navy); color: var(--gold); font-weight: 800; font-size: 0.72rem; }

/* ---------- Login ---------- */
.admin-login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #14213d, #0e1830); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-mark { width: 48px; height: 48px; font-size: 0.85rem; margin-bottom: 14px; }
.login-brand h1 { margin: 0 0 4px; font-size: 1.4rem; color: var(--navy); }
.login-brand p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.login-card label { display: block; margin-bottom: 16px; font-size: 0.88rem; font-weight: 600; color: var(--slate); }
.login-card input { width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; font-size: 1rem; font-family: inherit; }
.login-card input:focus { outline: none; border-color: var(--navy); }
.login-back { display: block; text-align: center; margin-top: 20px; color: var(--muted); font-size: 0.9rem; }
.alert { padding: 12px 16px; border-radius: 9px; margin-bottom: 18px; font-size: 0.9rem; }
.alert-error { background: #fbe9e9; color: var(--red); }

/* ---------- Buttons ---------- */
.btn-admin { display: inline-block; padding: 11px 22px; border-radius: 9px; font-weight: 600; font-size: 0.94rem; cursor: pointer; border: 1px solid transparent; font-family: inherit; }
.btn-admin-primary { background: var(--crimson); color: #fff; }
.btn-admin-primary:hover { background: #85272a; text-decoration: none; }
.btn-block { width: 100%; text-align: center; }
.linklike { background: none; border: none; color: var(--crimson); cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { text-decoration: underline; }
.linklike.danger, .row-actions .danger { color: var(--red); }
.inline { display: inline; }

/* ---------- Topbar ---------- */
.admin-topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.admin-topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.admin-logo { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.admin-logo:hover { text-decoration: none; }
.admin-nav { display: flex; align-items: center; gap: 22px; }
.admin-nav a, .admin-nav button { color: #b7c0dc; font-size: 0.92rem; font-weight: 500; }
.admin-nav a:hover { color: #fff; text-decoration: none; }
.admin-nav a.active { color: #fff; }

/* ---------- Main ---------- */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 34px 24px 80px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 16px; }
.admin-head h1 { margin: 0; font-size: 1.6rem; color: var(--navy); }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ---------- Table ---------- */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-table th { text-align: left; padding: 14px 18px; font-size: 0.78rem; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.admin-table td { padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 0.94rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.post-title-link { font-weight: 600; color: var(--navy); }
.row-actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.row-actions a { font-size: 0.88rem; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; text-transform: capitalize; }
.tag-published { background: #e3f2e8; color: var(--green); }
.tag-draft { background: var(--bg-alt); color: var(--slate); }
.tag-featured { background: #f6ecd6; color: var(--gold); margin-left: 8px; }
.admin-empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 50px; text-align: center; }
.admin-empty p { margin: 0 0 18px; color: var(--muted); }

/* ---------- Post form ---------- */
.post-form { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 20px; }
.field { display: block; }
.field > span { display: block; font-size: 0.86rem; font-weight: 600; color: var(--slate); margin-bottom: 7px; }
.field > span small { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; font-size: 0.98rem; font-family: inherit; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--navy); }
.form-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 80px; }
.side-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.side-box h3 { margin: 0 0 14px; font-size: 0.82rem; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }
.side-box .field { margin-bottom: 14px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 0.92rem; color: var(--slate); cursor: pointer; }
.checkbox input { width: auto; }
.side-actions { margin-top: 6px; }
.cover-preview { margin-bottom: 12px; }
.cover-preview img { border-radius: 8px; border: 1px solid var(--line); }
.upload-status { font-size: 0.84rem; color: var(--muted); margin: 8px 0 0; }
#coverUpload { font-size: 0.86rem; }

/* EasyMDE tweaks */
.EasyMDEContainer .CodeMirror { border-radius: 9px; border-color: var(--line); min-height: 320px; font-size: 0.98rem; }
.editor-toolbar { border-radius: 9px 9px 0 0; border-color: var(--line); }

/* ---------- Settings ---------- */
.settings-form { max-width: 640px; display: flex; flex-direction: column; gap: 20px; }

@media (max-width: 820px) {
  .post-form { grid-template-columns: 1fr; }
  .form-side { position: static; }
  .admin-table { font-size: 0.86rem; display: block; overflow-x: auto; }
}
