/* Tool đăng bài anphat.org — giao diện tối giản, chữ to, dễ đọc */

:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #2b2721;
  --ink-soft: #6b6459;
  --line: #ddd6c9;
  --accent: #8a6d3b;
  --accent-dark: #6d5530;
  --ok: #3d7a4e;
  --err: #a63d3d;
  --warn: #b8860b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ---------- Thanh trên ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; }
.lotus { color: var(--accent); font-size: 22px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.tab-btn {
  background: transparent; border: 1px solid var(--line);
  padding: 8px 16px; border-radius: var(--radius);
  cursor: pointer; font-size: 15px; color: var(--ink-soft);
}
.tab-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-btn {
  background: transparent; border: 1px solid var(--line);
  width: 38px; height: 38px; border-radius: var(--radius);
  cursor: pointer; font-size: 18px;
}

/* ---------- Khối ---------- */
.panel {
  max-width: 860px; margin: 20px auto; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.panel h2 { margin: 0 0 16px; font-size: 20px; }

.settings label { display: block; margin-bottom: 14px; }
.settings input { width: 100%; }

.banner {
  background: #fdf6e3; border: 1px solid #e8d9a8;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px;
}
.banner a { margin-left: 10px; color: var(--accent-dark); }

/* ---------- Trường nhập ---------- */
.field { display: block; margin-bottom: 22px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 260px; }

.label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.req { color: var(--err); font-weight: 700; }

input[type=text], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 16px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
select:disabled { background: #f1eee7; color: #999; }
textarea { resize: vertical; }

.hint { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--err); }
.hint.warn { color: var(--warn); }

/* ---------- Nút ---------- */
.btn {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 10px 18px; border-radius: var(--radius);
  cursor: pointer; font-size: 15px; font-family: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #b9ada0; border-color: #b9ada0; cursor: not-allowed; }
.btn-small { padding: 6px 12px; font-size: 14px; }
.btn-big { padding: 14px 28px; font-size: 17px; font-weight: 600; }
.row-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Tác giả ---------- */
.author-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.author-row select { flex: 1 1 200px; }
.author-row .btn-remove {
  background: transparent; border: 1px solid var(--line);
  width: 36px; height: 36px; border-radius: var(--radius);
  cursor: pointer; color: var(--err); font-size: 18px; line-height: 1;
}

/* ---------- Ảnh ---------- */
.image-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.preview { margin-top: 12px; }
.preview img {
  max-width: 280px; max-height: 200px;
  border: 1px solid var(--line); border-radius: var(--radius); display: block;
}

/* ---------- Soạn thảo ---------- */
.editor-toolbar {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px; background: #faf8f4;
}
.editor-toolbar button {
  background: #fff; border: 1px solid var(--line); border-radius: 5px;
  padding: 6px 10px; cursor: pointer; font-size: 14px; font-family: inherit; color: var(--ink);
}
.editor-toolbar button:hover { border-color: var(--accent); }
.editor-toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.editor {
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  min-height: 320px; padding: 16px; background: #fff;
  font-size: 16px; line-height: 1.75; overflow-y: auto; max-height: 60vh;
}
.editor:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.editor:empty::before {
  content: attr(data-placeholder); color: #a99f92; pointer-events: none;
}
.editor img { max-width: 100%; height: auto; }
.editor p { margin: 0 0 1em; }
.editor h2, .editor h3 { margin: 1.2em 0 0.5em; }
.editor blockquote {
  margin: 1em 0; padding-left: 16px;
  border-left: 3px solid var(--line); color: var(--ink-soft);
}

/* ---------- Gửi ---------- */
.submit-bar {
  display: flex; gap: 12px; align-items: center;
  padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap;
}

.load-row { display: flex; gap: 10px; flex-wrap: wrap; }
.load-row input { flex: 1 1 380px; }

/* ---------- Hộp thoại kiểm tra ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(43, 39, 33, .55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-box {
  background: var(--panel); border-radius: var(--radius);
  padding: 24px; max-width: 560px; width: 100%;
  max-height: 85vh; overflow-y: auto;
}
.modal-box h2 { margin: 0 0 16px; font-size: 19px; }

.check-list { list-style: none; padding: 0; margin: 0 0 16px; }
.check-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f0ece4;
}
.check-list .mark { font-size: 17px; line-height: 1.4; flex-shrink: 0; }
.check-list .mark.ok { color: var(--ok); }
.check-list .mark.bad { color: var(--err); }
.check-list .msg { font-size: 14px; color: var(--err); }
.check-list .name { font-weight: 500; }

.progress {
  background: #fdf6e3; border: 1px solid #e8d9a8;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px;
}
.result { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 14px; }
.result.ok { background: #edf6ef; border: 1px solid #c2ddc9; }
.result.err { background: #fbeeee; border: 1px solid #e5c4c4; }
.result a { color: var(--accent-dark); font-weight: 600; }

@media (max-width: 640px) {
  .panel { margin: 12px; padding: 16px; }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 16px; }
}
