/* ============================================
   AUTOBLOG — Dark Dashboard CSS
   Mobile-first
   ============================================ */

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #21262d;
  --border:      #30363d;
  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --primary:     #388bfd;
  --primary-h:   #58a6ff;
  --success:     #3fb950;
  --warning:     #d29922;
  --danger:      #f85149;
  --info:        #58a6ff;
  --purple:      #bc8cff;
  --orange:      #f0883e;
  --radius:      6px;
  --radius-lg:   12px;
  --shadow:      0 1px 3px rgba(0,0,0,.4);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.5);
  --nav-h:       56px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }
img, svg { display: block; max-width: 100%; }
input, select, textarea, button { font: inherit; }

/* ── Nav ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.navbar::-webkit-scrollbar { display: none; }
.navbar-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.navbar-brand img {
  display: block;
  border-radius: 7px;
  flex-shrink: 0;
}
.navbar-brand span { color: var(--text); }
.navbar-links { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.navbar-links a {
  color: var(--text-muted);
  font-size: .875rem;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.navbar-links a:hover,
.navbar-links a.active { background: var(--surface-2); color: var(--text); }
.navbar-links .nav-signout {
  color: var(--danger);
  margin-left: 8px;
}
.navbar-links .nav-signout:hover { background: rgba(248,81,73,.12); }

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}
@media (min-width: 768px) { .container { padding: 32px 24px; } }

/* ── Flash ── */
.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.flash-notice {
  background: rgba(63,185,80,.12);
  border-color: rgba(63,185,80,.3);
  color: #3fb950;
}
.flash-alert {
  background: rgba(248,81,73,.12);
  border-color: rgba(248,81,73,.3);
  color: #f85149;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
}
@media (min-width: 768px) { .page-title { font-size: 1.625rem; } }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); color: #fff; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { opacity: .85; color: #fff; }

.btn-danger {
  background: rgba(248,81,73,.1);
  color: var(--danger);
  border-color: rgba(248,81,73,.3);
}
.btn-danger:hover { background: rgba(248,81,73,.2); color: var(--danger); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: .8125rem; }
.btn-lg { padding: 10px 22px; font-size: 1rem; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.card-body { padding: 20px; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (min-width: 640px)  { .stats-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-card.pending   .stat-value { color: var(--warning); }
.stat-card.generated .stat-value { color: var(--info); }
.stat-card.approved  .stat-value { color: #bc8cff; }
.stat-card.published .stat-value { color: var(--success); }
.stat-card.failed    .stat-value { color: var(--danger); }

/* ── Calendar ── */
.calendar-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
}
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-nav-title {
  font-size: 1rem;
  font-weight: 600;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  min-width: 630px;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.calendar-dow {
  background: var(--surface-2);
  padding: 8px 4px;
  text-align: center;
  font-size: .6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.calendar-day {
  background: var(--surface);
  min-height: 80px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}
@media (min-width: 768px) { .calendar-day { min-height: 100px; padding: 8px; } }

.calendar-day.outside { background: var(--bg); opacity: .5; }
.calendar-day.today { background: rgba(56,139,253,.07); }
.calendar-day.today .day-num { color: var(--primary); font-weight: 700; }

.day-num {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 2px;
}
.calendar-post {
  display: block;
  padding: 3px 5px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: opacity .1s;
  max-width: 100%;
}
.calendar-post:hover { opacity: .8; }
.cp-blog {
  display: block;
  font-size: .6rem;
  font-weight: 600;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cp-topic {
  display: block;
  font-size: .6875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* status colours for calendar posts */
.cp-pending   { background: rgba(210,153,34,.18); color: #d29922; border: 1px solid rgba(210,153,34,.3); }
.cp-generated { background: rgba(88,166,255,.15); color: #58a6ff; border: 1px solid rgba(88,166,255,.3); }
.cp-approved  { background: rgba(188,140,255,.15); color: #bc8cff; border: 1px solid rgba(188,140,255,.3); }
.cp-published { background: rgba(63,185,80,.15);  color: #3fb950; border: 1px solid rgba(63,185,80,.3); }
.cp-failed    { background: rgba(248,81,73,.15);  color: #f85149; border: 1px solid rgba(248,81,73,.3); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .6875rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .03em;
}
.badge-pending   { background: rgba(210,153,34,.15); color: #d29922; }
.badge-generated { background: rgba(88,166,255,.15);  color: #58a6ff; }
.badge-approved  { background: rgba(188,140,255,.15); color: #bc8cff; }
.badge-published { background: rgba(63,185,80,.15);   color: #3fb950; }
.badge-failed    { background: rgba(248,81,73,.15);   color: #f85149; }
.badge-default   { background: rgba(63,185,80,.15);   color: #3fb950; }
.badge-info      { background: rgba(88,166,255,.15);  color: #58a6ff; }
.badge-neutral   { background: var(--surface-2); color: var(--text-muted); }

/* ── Forms ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 640px;
}
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56,139,253,.2);
}
.form-control::placeholder { color: var(--text-muted); opacity: .7; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-check-label { font-size: .875rem; cursor: pointer; }

.form-errors {
  background: rgba(248,81,73,.1);
  border: 1px solid rgba(248,81,73,.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: .875rem;
  color: var(--danger);
}
.form-errors ul { padding-left: 18px; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ── Post show ── */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: .875rem;
  color: var(--text-muted);
}
.post-meta .sep { opacity: .4; }
.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.content-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  line-height: 1.8;
}
.content-preview h1,
.content-preview h2,
.content-preview h3 { color: var(--text); margin: 1.2em 0 .5em; }
.content-preview p  { margin-bottom: 1em; color: var(--text); }
.content-preview pre,
.content-preview code { background: var(--surface-2); border-radius: var(--radius); padding: 2px 6px; font-size: .85em; }
.content-preview pre { padding: 16px; overflow-x: auto; }
.content-preview ul, .content-preview ol { padding-left: 1.5em; margin-bottom: 1em; }

/* ── Published URL ── */
.published-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(63,185,80,.1);
  border: 1px solid rgba(63,185,80,.25);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .875rem;
}
.published-banner a { color: var(--success); font-weight: 500; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .5; }
.empty-state-text { font-size: .9375rem; margin-bottom: 16px; }

/* ── Utility ── */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .8125rem; }
.text-xs     { font-size: .75rem; }
.font-mono   { font-family: "SF Mono", "Fira Code", monospace; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-8       { gap: 8px; }
.mt-4        { margin-top: 4px; }
.mb-0        { margin-bottom: 0; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.flex-wrap   { flex-wrap: wrap; }
.w-full      { width: 100%; }

/* ── Hamburger button ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.hamburger:hover { background: var(--surface-2); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background .15s;
}
.hamburger:hover span { background: var(--text); }

/* ── Side drawer ── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius);
  line-height: 1;
}
.drawer-close:hover { background: var(--surface-2); color: var(--text); }

.drawer-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  overflow-y: auto;
}
.drawer-link {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .9375rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.drawer-link:hover { background: var(--surface-2); color: var(--text); }
.drawer-link.active { background: var(--surface-2); color: var(--text); }

.drawer-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .navbar-links { display: none; }
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 1.375rem; }
  .navbar-brand span { font-size: .9375rem; }
}
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
}
