/* ITPN Blog Admin — standalone styling (does not touch the public site CSS). */

:root {
  --orange: #f47f2e;
  --orange-dark: #d96a1c;
  --ink: #2f2f2f;
  --ink-soft: #545454;
  --line: #e5e7eb;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --danger: #e44d4d;
  --success: #2f9e6a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Roboto', Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3 { margin: 0 0 4px; font-weight: 700; color: var(--ink); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

a { color: var(--orange-dark); }

code {
  background: #f3f4f7;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-all;
}

.muted { color: var(--ink-soft); margin: 0; }
.hint { color: #7a7a7a; font-size: 12px; margin: 6px 0 0; }
.req { color: var(--orange); }
.opt { color: #9aa0a6; font-weight: 400; font-size: 12px; }

/* ------------------------------------------------------------------ login */

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .06);
  text-align: center;
}

.login-logo { width: 140px; margin-bottom: 18px; }
.login-card h1 { font-size: 20px; }
.login-card label {
  display: block;
  text-align: left;
  margin: 22px 0 6px;
  font-weight: 500;
}

.hash-tool {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.hash-tool summary { cursor: pointer; font-weight: 500; }
.hash-tool .muted { margin: 10px 0; font-size: 12.5px; }
.hash-row { display: flex; gap: 8px; }
.hash-row input { flex: 1; }
.hash-tool textarea { margin-top: 8px; font-family: monospace; font-size: 12px; }

/* ------------------------------------------------------------------ chrome */

.admin-top {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-top-inner {
  max-width: 940px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 26px; }
.brand span { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; }
.admin-top nav { display: flex; gap: 18px; flex-wrap: wrap; }
.admin-top nav a { color: #d8d8d8; text-decoration: none; font-size: 13px; }
.admin-top nav a:hover { color: var(--orange); }
.admin-top nav a.is-active { color: var(--orange); font-weight: 500; }

.admin-main { max-width: 940px; margin: 0 auto; padding: 24px 20px 64px; }

/* ------------------------------------------------------------------ panel */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-head { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 24px; }
.panel-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ------------------------------------------------------------------ fields */

.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 500; margin-bottom: 6px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { resize: vertical; }

input:focus, select:focus, textarea:focus, .editor:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244, 127, 46, .15);
}

.seo > summary { cursor: pointer; font-weight: 500; margin-bottom: 14px; }

/* --------------------------------------------------------------- dropzone */

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--orange); background: #fff7f0; }
.dropzone input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone-empty { padding: 24px; pointer-events: none; }
.dropzone-empty i { font-size: 28px; color: var(--orange); }
.dropzone-empty p { margin: 8px 0 0; }
.dropzone-preview { display: none; max-width: 100%; max-height: 300px; }
.dropzone.has-image .dropzone-empty { display: none; }
.dropzone.has-image .dropzone-preview { display: block; }

/* ---------------------------------------------------------------- editor */

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #fafbfc;
  padding: 6px 8px;
}
.editor-toolbar button {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.editor-toolbar button:hover { background: #fff; border-color: var(--line); }
.editor-toolbar button.is-active { background: #fff7f0; border-color: var(--orange); color: var(--orange-dark); }
.editor-toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }

.editor {
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  background: #fff;
  min-height: 320px;
  max-height: 620px;
  overflow-y: auto;
  padding: 18px 20px;
}
.editor:empty::before {
  content: attr(data-placeholder);
  color: #9aa0a6;
}
.editor h3 { font-size: 18px; margin: 22px 0 8px; }
.editor h4 { font-size: 15px; margin: 18px 0 6px; }
.editor p { margin: 0 0 12px; }
.editor img { max-width: 100%; height: auto; display: block; margin: 14px auto; border-radius: 4px; }
.editor ul, .editor ol { margin: 0 0 12px; padding-left: 24px; }

.editor-html {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  min-height: 320px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 14px;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: #f3f4f7; }
.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn-primary[disabled] { opacity: .6; cursor: default; }
.btn-block { width: 100%; justify-content: center; margin-top: 24px; }

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 400px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
  animation: toast-in .28s ease-out;
}
.toast.is-out { animation: toast-out .28s ease-in forwards; }
.toast > .fa { font-size: 18px; color: var(--success); margin-top: 2px; }

.toast-error { border-left-color: var(--danger); }
.toast-error > .fa { color: var(--danger); }

.toast-body { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.45; }
.toast-body strong { font-size: 14px; }
.toast-body span { color: var(--ink-soft); word-break: break-word; }
.toast-body a { margin-top: 4px; font-weight: 500; text-decoration: none; }
.toast-body a:hover { text-decoration: underline; }

.toast-close {
  margin-left: auto;
  border: 0;
  background: none;
  color: #9aa0a6;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.toast-close:hover { color: var(--ink); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-10px); }
}

@media (max-width: 640px) {
  .toast { top: auto; bottom: 16px; right: 12px; left: 12px; max-width: none; }
  @keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------------------------------------------------------------- alerts */

.alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: #fff;
}
.alert-error { border-left-color: var(--danger); color: #a12b2b; background: #fdf3f3; }
.alert-draft {
  border-left-color: var(--orange);
  background: #fff7f0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.alert-draft .btn { margin-left: 4px; }
.alert-success { border-left-color: var(--success); background: #f3fbf7; }
.alert-success h2 { color: var(--success); font-size: 16px; }
.login-card .alert { text-align: left; font-size: 13px; margin: 16px 0 0; }

.result-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; }
.result-list li { padding: 3px 0; }
.result-list span {
  display: inline-block;
  min-width: 70px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* ---------------------------------------------------------------- recent */

.recent { width: 100%; border-collapse: collapse; font-size: 13px; }
.recent th, .recent td { text-align: left; padding: 12px 24px; border-bottom: 1px solid var(--line); }
.recent th { background: #fafbfc; font-weight: 500; color: var(--ink-soft); }
.recent tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fff7f0;
  color: var(--orange-dark);
  font-size: 12px;
}

/* ------------------------------------------------------- list / edit views */

.list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.search-form { display: flex; gap: 8px; }
.search-form input { width: 240px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }

.empty-state { padding: 40px 24px; text-align: center; color: var(--ink-soft); }

.recent td { vertical-align: middle; }
.recent .thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #f3f4f7;
  display: block;
}
.recent .path { font-size: 11.5px; color: #8b8f94; word-break: break-all; }
.recent .path:hover { color: var(--orange-dark); }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions form.inline { margin: 0; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; gap: 6px; text-decoration: none; }
.btn-danger { border-color: #f0c4c4; color: #a12b2b; background: #fdf3f3; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; padding: 16px 24px; border-top: 1px solid var(--line); }
.pager a {
  min-width: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
}
.pager a:hover { background: #f3f4f7; }
.pager a.is-active { background: var(--orange); border-color: var(--orange); color: #fff; }

.danger-zone { border-color: #f0c4c4; }
.danger-zone .panel-head h2 { color: #a12b2b; }
.danger-zone .panel-foot { background: #fdf3f3; border-top-color: #f0c4c4; justify-content: flex-start; }

.hint.warn {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  background: #fff7f0;
  color: var(--orange-dark);
  font-size: 12.5px;
}

@media (max-width: 640px) {
  .field-grid { grid-template-columns: 1fr; }
  .panel-body, .panel-head { padding: 18px; }
  .recent th, .recent td { padding: 10px 14px; }
  .recent .thumb, .recent thead { display: none; }
  .row-actions { justify-content: flex-start; }
  .search-form input { width: 100%; }
}
