/* ============================================================
   SIGNATURE ASSOCIATES — Admin Panel Styles
   Design: gold #c9a84c | ink #0a0a0a | off-white #f8f7f4
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=DM+Sans:wght@400;500;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:       #c9a84c;
  --gold-light: #d4b05c;
  --ink:        #0a0a0a;
  --panel:      #141414;
  --border:     #2a2a2a;
  --surface:    #1e1e1e;
  --surface2:   #242424;
  --text:       #e8e6e0;
  --muted:      #888;
  --white:      #ffffff;
  --danger:     #ef4444;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --info:       #3b82f6;
  --purple:     #8b5cf6;
  --sidebar-w:  240px;
  --top-h:      56px;
  --font:       'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

body {
  font-family: var(--font);
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ── Layout ──────────────────────────────────────────────── */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.sidebar-logo img { height: 32px; }
.sidebar-logo span { font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--gold); line-height: 1.2; }

.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section { padding: 0.5rem 1rem 0.2rem;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted); }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 1.2rem; color: #aaa; font-size: 0.84rem; font-weight: 500;
  transition: all 0.15s;
}
.sidebar-nav a:hover { color: var(--text); background: var(--surface); }
.sidebar-nav a.active { color: var(--gold); background: rgba(201,168,76,0.1);
  border-left: 2px solid var(--gold); }
.sidebar-nav a .icon { width: 16px; text-align: center; opacity: 0.7; }
.sidebar-nav a.active .icon { opacity: 1; }

.sidebar-user {
  padding: 0.9rem 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}
.sidebar-user strong { display: block; color: var(--text); font-size: 0.82rem; }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  height: var(--top-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.8rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar h1 { font-size: 1rem; font-weight: 700; color: var(--text); font-family: var(--font-serif); }
.top-bar .actions { display: flex; gap: 0.7rem; align-items: center; }

.page-body { padding: 1.8rem; flex: 1; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem; border-radius: 4px; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: var(--gold-light); color: #000; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.76rem; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.card-header { padding: 1rem 1.4rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.card-body { padding: 1.4rem; }

/* ── Stats row ───────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.8rem; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 1.2rem 1.4rem; }
.stat-card .num { font-size: 2rem; font-weight: 700; color: var(--gold); line-height: 1; }
.stat-card .lbl { font-size: 0.76rem; color: var(--muted); margin-top: 0.3rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
thead th { padding: 0.65rem 1rem; text-align: left; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 0.8rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tbody tr:hover td { background: var(--surface); }
.td-title { font-weight: 600; color: var(--text); max-width: 280px; }
.td-title small { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.td-actions { white-space: nowrap; display: flex; gap: 0.4rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #fff; }

/* ── SEO Score ───────────────────────────────────────────── */
.seo-score { display: flex; align-items: center; gap: 0.5rem; }
.seo-score .circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: #000;
}
.seo-checklist { list-style: none; }
.seo-checklist li { display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; color: var(--muted); padding: 0.2rem 0; }
.seo-checklist li.pass { color: var(--text); }
.seo-checklist li::before { content: '✗'; color: var(--danger); font-weight: 700; font-size: 0.7rem; }
.seo-checklist li.pass::before { content: '✓'; color: var(--success); }

/* ── Forms ───────────────────────────────────────────────── */
.form-row { display: grid; gap: 1rem; margin-bottom: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); }
.form-group label .hint { font-weight: 400; text-transform: none; letter-spacing: 0;
  margin-left: 0.5rem; color: #555; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=date], input[type=datetime-local], input[type=number],
textarea, select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; }
.char-count { font-size: 0.7rem; color: var(--muted); text-align: right; }
.char-count.ok  { color: var(--success); }
.char-count.warn{ color: var(--warning); }
.char-count.bad { color: var(--danger); }

/* ── Editor layout ───────────────────────────────────────── */
.editor-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.2rem; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 1rem; }
.editor-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(var(--top-h) + 1rem); }

.title-input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.9rem 1.1rem;
  width: 100%;
  font-family: var(--font-serif);
}
.title-input:focus { outline: none; border-color: var(--gold); }
.title-input::placeholder { color: #444; }

.subtitle-input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #aaa;
  font-size: 1rem;
  padding: 0.6rem 1.1rem;
  width: 100%;
  font-style: italic;
}
.subtitle-input:focus { outline: none; border-color: var(--gold); }

/* ── Tabs ────────────────────────────────────────────────── */
.tab-strip { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab-btn { padding: 0.65rem 1.2rem; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border: none; background: transparent; color: var(--muted);
  border-bottom: 2px solid transparent; transition: all 0.15s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Quill editor override ───────────────────────────────── */
.ql-toolbar { background: var(--surface2); border: 1px solid var(--border) !important;
  border-bottom: none !important; border-radius: 4px 4px 0 0; }
.ql-container { background: var(--surface); border: 1px solid var(--border) !important;
  border-radius: 0 0 4px 4px; min-height: 360px; font-size: 0.94rem; color: var(--text); }
.ql-editor { min-height: 360px; padding: 1.2rem; line-height: 1.8; }
.ql-toolbar .ql-stroke { stroke: var(--muted); }
.ql-toolbar .ql-fill { fill: var(--muted); }
.ql-toolbar .ql-picker { color: var(--muted); }
.ql-toolbar button:hover .ql-stroke, .ql-toolbar .ql-active .ql-stroke { stroke: var(--gold) !important; }
.ql-toolbar button:hover .ql-fill, .ql-toolbar .ql-active .ql-fill { fill: var(--gold) !important; }
.ql-toolbar .ql-picker-label:hover, .ql-toolbar .ql-picker-label.ql-active { color: var(--gold) !important; }
.ql-toolbar .ql-picker-options { background: var(--surface2); border-color: var(--border) !important; }
.ql-snow.ql-toolbar button:hover, .ql-snow .ql-toolbar button:hover { color: var(--gold); }

/* ── Sidebar panels ──────────────────────────────────────── */
.sidebar-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.sidebar-panel-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.sidebar-panel-body { padding: 1rem; }

/* ── Publish panel ───────────────────────────────────────── */
.publish-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.status-select { font-size: 0.82rem; }

/* ── Featured image ──────────────────────────────────────── */
.feat-img-preview { width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 4px; margin-bottom: 0.6rem; display: block; }
.feat-img-placeholder { width: 100%; aspect-ratio: 16/9; background: var(--surface);
  border: 2px dashed var(--border); border-radius: 4px; display: flex;
  align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem;
  cursor: pointer; margin-bottom: 0.6rem; }
.feat-img-placeholder:hover { border-color: var(--gold); color: var(--gold); }

/* ── Tags input ──────────────────────────────────────────── */
.tags-input-wrap { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.4rem 0.6rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; min-height: 40px; }
.tags-input-wrap:focus-within { border-color: var(--gold); }
.tag-pill { background: rgba(201,168,76,0.15); color: var(--gold); border-radius: 20px;
  padding: 0.1rem 0.6rem; font-size: 0.74rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.3rem; }
.tag-pill button { background: none; border: none; color: inherit; cursor: pointer;
  font-size: 0.8rem; padding: 0; line-height: 1; }
.tags-input-wrap input { background: none; border: none; outline: none; color: var(--text);
  font-size: 0.82rem; min-width: 80px; flex: 1; }

/* ── FAQ builder ─────────────────────────────────────────── */
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 0.8rem; margin-bottom: 0.6rem; }
.faq-item input, .faq-item textarea { margin-bottom: 0.4rem; }
.faq-item .faq-actions { display: flex; justify-content: flex-end; }

/* ── Sources builder ─────────────────────────────────────── */
.source-item { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem;
  align-items: center; margin-bottom: 0.5rem; }

/* ── Media grid ──────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.8rem; }
.media-item { position: relative; border-radius: 4px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; aspect-ratio: 4/3; }
.media-item:hover { border-color: var(--gold); }
.media-item.selected { border-color: var(--gold); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item .media-info { position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.75); padding: 0.3rem 0.4rem; font-size: 0.62rem;
  color: #fff; transform: translateY(100%); transition: transform 0.15s; }
.media-item:hover .media-info { transform: translateY(0); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 0.8rem 1rem; border-radius: 4px; font-size: 0.84rem; margin-bottom: 1rem; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--success); }
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: var(--danger); }
.alert-info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: var(--info); }

/* ── Filters bar ─────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar input, .filter-bar select { width: auto; min-width: 120px; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; gap: 0.3rem; margin-top: 1.2rem; }
.page-link { padding: 0.4rem 0.7rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; color: var(--muted); font-size: 0.8rem; }
.page-link:hover { border-color: var(--gold); color: var(--gold); }
.page-link.active { background: var(--gold); border-color: var(--gold); color: #000; font-weight: 700; }

/* ── Login page ──────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--ink); }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 2.5rem; width: 100%; max-width: 420px; }
.login-card .logo { display: block; height: 40px; margin: 0 auto 1.5rem; }
.login-card h1 { text-align: center; font-size: 1.2rem; font-weight: 700; color: var(--gold);
  margin-bottom: 0.3rem; font-family: var(--font-serif); }
.login-card p { text-align: center; font-size: 0.8rem; color: var(--muted); margin-bottom: 1.8rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ── Light mode ─────────────────────────────────────────── */
body.light {
  --ink:     #f8f7f4;
  --panel:   #ffffff;
  --border:  #e3e0d8;
  --surface: #f2f0ea;
  --surface2: #eae7df;
  --text:    #1a1a1a;
  --muted:   #6b6b6b;
}
body.light tbody td { border-bottom-color: rgba(0,0,0,0.06); }
body.light .sidebar-nav a { color: #555; }
body.light .sidebar-nav a.active { background: rgba(201,168,76,0.14); }
body.light .title-input::placeholder { color: #999; }
body.light .subtitle-input { color: #666; }
body.light .form-group label .hint { color: #777; }
body.light .btn-ghost:hover { color: var(--text); }
body.light .tag-pill { color: #8a6d1f; background: rgba(201,168,76,0.18); }
body.light .ql-toolbar .ql-stroke { stroke: #666; }
body.light .ql-toolbar .ql-fill { fill: #666; }
body.light .ql-toolbar .ql-picker { color: #666; }
body.light .ql-toolbar .ql-picker-options { color: var(--text); }

/* ── Theme toggle ───────────────────────────────────────── */
.theme-toggle {
  display: flex; align-items: center; gap: 0.4rem;
  width: 100%; margin-top: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
  font-family: var(--font); font-size: 0.74rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--gold); }

/* ── Content plan calendar ──────────────────────────────── */
.cal-legend { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-bottom: .9rem; font-size: .74rem; color: var(--muted); }
.cal-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.cal-dot.cal-scheduled { background: var(--gold); }
.cal-dot.cal-planned   { background: #6b7280; }
.cal-dot.cal-published { background: #22c55e; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.cal-dow { padding: .45rem .5rem; background: var(--surface); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 92px; padding: .4rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--panel, transparent); }
.cal-cell:nth-child(7n + 8) { border-right: none; }
.cal-blank { background: var(--surface); opacity: .5; min-height: 0; }
.cal-today { background: rgba(201, 168, 76, .08); box-shadow: inset 0 0 0 1px var(--gold); }
.cal-daynum { font-size: .72rem; font-weight: 700; color: var(--muted); margin-bottom: .3rem; }
.cal-today .cal-daynum { color: var(--gold); }
.cal-item { display: block; padding: .25rem .35rem; margin-bottom: .25rem; border-radius: 3px; font-size: .7rem; line-height: 1.25; text-decoration: none; color: var(--text); border: 1px solid transparent; overflow: hidden; }
.cal-item:hover { border-color: var(--gold); background: var(--surface); }
.cal-item.cal-scheduled { border-left: 2px solid var(--gold); }
.cal-item.cal-planned   { border-left: 2px solid #6b7280; color: var(--muted); }
.cal-item.cal-published { border-left: 2px solid #22c55e; color: var(--muted); }

@media (max-width: 860px) {
  .cal-grid { grid-template-columns: repeat(7, minmax(74px, 1fr)); overflow-x: auto; }
  .cal-cell { min-width: 74px; }
}
