/* Titan Digital — admin panel styles */
:root {
  --ink: #0d0f12; --paper: #fff; --bg: #f4f5f7; --line: #e2e5ea;
  --muted: #6b7280; --accent: #0f6b4f; --accent-2: #14916a; --danger: #b3261e;
  --sidebar: #14171c;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: #eef0f3; padding: 1px 5px; border-radius: 3px; font-size: 13px; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--sidebar); }
.login-card { background: #fff; padding: 44px 40px; border-radius: 6px; width: 380px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.5); }
.login-brand { font-size: 20px; font-weight: 700; margin-bottom: 24px; }
.brand-mark { color: var(--accent); }
.login-card h1 { font-size: 1.5rem; margin: 0 0 24px; }
.login-card label { display: block; margin-bottom: 16px; font-weight: 600; font-size: 13px; }
.login-card input { width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; font-size: 15px; font-weight: 400; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-error { background: #fdecea; color: var(--danger); padding: 12px 14px; border-radius: 4px; margin-bottom: 18px; font-size: 14px; }

/* ---------- Layout ---------- */
.admin-layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--sidebar); color: #c8ccd2; display: flex; flex-direction: column; padding: 26px 18px; position: sticky; top: 0; height: 100vh; }
.admin-brand { color: #fff; font-weight: 700; font-size: 18px; padding: 0 10px 26px; }
.admin-brand:hover { text-decoration: none; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.admin-sidebar nav a { color: #aab0b8; padding: 11px 12px; border-radius: 5px; font-weight: 500; font-size: 14px; }
.admin-sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.admin-sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 10px; }
.sidebar-foot a { color: #aab0b8; font-size: 13px; padding: 0 10px; }
.sidebar-foot a:hover { color: #fff; }
.logout-form button { background: none; border: 0; color: #aab0b8; cursor: pointer; font: inherit; text-align: left; padding: 0 10px; font-size: 13px; }
.logout-form button:hover { color: #fff; }

.admin-main { padding: 36px 44px; max-width: 1100px; }

/* ---------- Headers / flash ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-head h1 { font-size: 1.8rem; margin: 0; }
.muted { color: var(--muted); }
.flash { background: #e8f3ee; border: 1px solid var(--accent-2); color: var(--accent); padding: 12px 16px; border-radius: 5px; margin-bottom: 22px; font-weight: 500; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 30px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card-num { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.card-num small { font-size: 1.1rem; color: var(--muted); font-weight: 500; }
.card-label { color: var(--muted); font-size: 13px; }

/* ---------- Panels & tables ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 26px; margin-bottom: 24px; }
.panel h2 { font-size: 1.15rem; margin: 0 0 18px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 12px 12px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .muted, .ok-row { color: var(--muted); }
.ok-row { color: var(--accent); padding: 16px 12px; }
.row-actions { white-space: nowrap; }
.messages tr.unread td { background: #f3f8f6; }
.msg-preview { color: var(--muted); font-size: 13px; margin-top: 4px; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; background: #eef0f3; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge.ok { background: #e8f3ee; color: var(--accent); }
.badge.feat { background: #fdf3e3; color: #9a6b16; }
.badge.sys { background: #eae6fb; color: #5a47b0; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-block; font: inherit; font-weight: 600; font-size: 14px;
  padding: 11px 20px; border-radius: 5px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); text-decoration: none; }
.btn-primary.full { width: 100%; text-align: center; }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--accent); text-decoration: none; }
.btn-danger { background: #fff; border-color: #e6bcb8; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- Editor forms ---------- */
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 18px; }
.field { display: block; font-weight: 600; font-size: 13px; }
.field input, .field textarea, .field select {
  width: 100%; margin-top: 7px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 5px; font-family: inherit; font-size: 15px; font-weight: 400; background: #fff;
}
.field textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.6; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.side-panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.side-panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 14px; }
.side-panel .field { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; margin-bottom: 12px; cursor: pointer; }
.check input { width: auto; margin: 0; }
.inline-delete { margin-top: 12px; }
.inline-delete button { width: 100%; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid .field, .editor .field { margin-bottom: 0; }

/* ---------- Message detail ---------- */
.meta-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 0 0 24px; }
.meta-list dt { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.meta-list dd { margin: 4px 0 0; font-weight: 500; }
.message-text { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 20px; margin-bottom: 22px; line-height: 1.7; }

/* ---------- SEO ---------- */
.issue-list { margin: 0; padding-left: 18px; color: var(--danger); font-size: 13px; }
.file-links { display: flex; gap: 12px; flex-wrap: wrap; }
.code-preview { background: #14171c; color: #d5dae0; padding: 18px; border-radius: 6px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; margin-top: 14px; }
.editor .panel textarea { margin-top: 14px; }

/* ---------- WYSIWYG editor ---------- */
.wysiwyg-wrap { margin-top: 7px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.wysiwyg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 8px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.wysiwyg-btn { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); min-width: 32px; }
.wysiwyg-btn:hover { border-color: var(--accent); color: var(--accent); }
.wysiwyg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.wysiwyg-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.wysiwyg-surface { min-height: 280px; padding: 18px 20px; font-size: 16px; line-height: 1.65; outline: none; font-weight: 400; }
.wysiwyg-surface:focus { background: #fff; }
.wysiwyg-surface h2 { font-size: 1.5rem; margin: 1em 0 .4em; }
.wysiwyg-surface h3 { font-size: 1.2rem; margin: 1em 0 .4em; }
.wysiwyg-surface p { margin: 0 0 .9em; }
.wysiwyg-surface img { max-width: 100%; height: auto; border-radius: 4px; }
.wysiwyg-surface blockquote { border-left: 3px solid var(--accent); margin: 0 0 .9em; padding: 4px 0 4px 16px; color: var(--muted); }
.wysiwyg-wrap textarea.source-visible { display: block; width: 100%; border: 0; border-radius: 0; margin: 0; min-height: 320px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; line-height: 1.6; }

/* ---------- Media library ---------- */
.upload-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload-form input[type=file] { font-size: 14px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.media-item { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item img { width: 100%; height: 150px; object-fit: cover; display: block; background: #f0f2f4; }
.media-item figcaption { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.media-url { font-size: 12px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font-family: ui-monospace, Menlo, monospace; width: 100%; }
.media-meta { font-size: 12px; color: var(--muted); }
.btn-danger.small { padding: 5px 10px; font-size: 12px; align-self: flex-start; }

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .editor-grid, .settings-grid, .meta-list { grid-template-columns: 1fr; }
  .admin-main { padding: 24px 18px; }
}
