/* === VigyanLLM CMS Admin Styles === */
:root {
  --bg-page: #0B0F1A;
  --bg-card: #111827;
  --bg-elevated: #1A1F2E;
  --bg-hover: #1F2937;
  --border: #2D3548;
  --text: #F1F5F9;
  --text2: #94A3B8;
  --text3: #64748B;
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-h: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

input, textarea, select {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
}
textarea { resize: vertical; }
button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.sidebar-nav { flex: 1; padding: 12px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-nav a.active { background: rgba(59,130,246,0.12); color: var(--primary); }
.sidebar-nav .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.header-bar h2 { font-size: 18px; font-weight: 600; }
.header-user { display: flex; align-items: center; gap: 16px; }
.header-user .user-email { color: var(--text2); font-size: 13px; }
.header-user .logout-btn { font-size: 13px; cursor: pointer; color: var(--text3); }
.header-user .logout-btn:hover { color: var(--danger); }
.notif-bell {
  position: relative;
  cursor: pointer;
  font-size: 20px;
  color: var(--text2);
  padding: 4px;
}
.notif-bell .notif-count {
  position: absolute;
  top: -2px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}
.notif-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1000;
  display: none;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item .notif-dot { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.notif-item .notif-text { flex: 1; color: var(--text); line-height: 1.4; }
.notif-item .notif-time { color: var(--text3); font-size: 12px; white-space: nowrap; }

.content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-page);
}
.login-card {
  width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}
.login-card h1 {
  font-family: var(--font-h);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.login-card p { color: var(--text2); font-size: 14px; margin-bottom: 28px; }
.login-card .form-group { margin-bottom: 18px; }
.login-card .form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text2); }
.login-card .form-group input { width: 100%; }
.login-card .login-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; display: none; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table .actions { display: flex; gap: 6px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.draft { background: #6B7280; }
.status-dot.pending_review { background: #F59E0B; }
.status-dot.published { background: #10B981; }
.status-dot.rejected { background: #EF4444; }
.status-dot.archived { background: #4B5563; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text2); }
.empty-state p { margin-bottom: 20px; }

/* Editor */
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.editor-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.editor-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-fields {
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.editor-fields input {
  width: 100%;
  font-size: 14px;
}
.editor-fields .title-input {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-h);
  border: none;
  background: transparent;
  color: var(--text);
  padding: 4px 0;
}
.editor-fields .title-input::placeholder { color: var(--text3); }
.editor-fields .slug-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-fields .slug-row input { flex: 1; font-size: 14px; font-family: monospace; }
.editor-fields .slug-row .slug-lock { cursor: pointer; font-size: 16px; color: var(--text3); padding: 4px; }
.slug-row .slug-lock:hover { color: var(--text); }
.editor-fields .meta-input {
  font-size: 13px;
  color: var(--text2);
}
.editor-fields .char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.editor-rejection-callout {
  margin: 0 24px;
  padding: 12px 16px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  color: #FCA5A5;
  font-size: 13px;
}
.editor-review-banner {
  margin: 0 24px;
  padding: 10px 16px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  color: #FCD34D;
  font-size: 13px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.editor-toolbar .tb-group { display: flex; gap: 2px; padding: 0 6px; border-right: 1px solid var(--border); }
.editor-toolbar .tb-group:last-child { border-right: none; }
.tb-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.1s;
  position: relative;
}
.tb-btn:hover { background: var(--bg-hover); color: var(--text); }
.tb-btn.active { background: rgba(59,130,246,0.15); color: var(--primary); }
.tb-btn .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}
.tb-btn:hover .tooltip { display: block; }

.editor-content {
  flex: 1;
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.editor-statusbar {
  padding: 8px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text3);
  display: flex;
  justify-content: space-between;
}

/* TipTap Styles */
.ProseMirror { outline: none; min-height: 400px; }
.ProseMirror p { margin-bottom: 1rem; line-height: 1.8; font-size: 16px; color: var(--text); }
.ProseMirror h1 { font-size: 2rem; font-weight: 700; margin: 2rem 0 1rem; font-family: var(--font-h); color: #F9FAFB; }
.ProseMirror h2 { font-size: 1.65rem; font-weight: 700; margin: 2rem 0 0.75rem; font-family: var(--font-h); }
.ProseMirror h3 { font-size: 1.35rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.ProseMirror ul, .ProseMirror ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.ProseMirror li { margin-bottom: 0.35rem; line-height: 1.7; }
.ProseMirror blockquote { border-left: 3px solid var(--primary); padding-left: 1rem; margin: 1rem 0; color: var(--text2); font-style: italic; }
.ProseMirror pre { background: #1A1F2E; border-radius: 8px; padding: 16px; margin: 1rem 0; overflow-x: auto; }
.ProseMirror pre code { background: none; padding: 0; font-size: 14px; line-height: 1.6; color: #E2E8F0; }
.ProseMirror code { background: rgba(59,130,246,0.1); padding: 2px 6px; border-radius: 4px; font-size: 14px; color: #93C5FD; }
.ProseMirror img { max-width: 100%; height: auto; border-radius: 8px; margin: 1.5rem 0; }
.ProseMirror hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.ProseMirror a { color: var(--primary); text-decoration: underline; }
.ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--text3); pointer-events: none; float: left; height: 0; }

/* Image Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 480px;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-close { float: right; background: none; border: none; font-size: 20px; color: var(--text3); cursor: pointer; padding: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.dropzone:hover { border-color: var(--primary); background: rgba(59,130,246,0.04); }
.dropzone p { color: var(--text2); font-size: 14px; }
.dropzone .dz-icon { font-size: 32px; margin-bottom: 8px; }

/* Review Queue */
.queue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.queue-card:hover { border-color: var(--text3); }
.queue-card.stale { border-left: 3px solid var(--warning); }
.queue-card h4 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.queue-card .meta { color: var(--text3); font-size: 13px; margin-bottom: 12px; }
.queue-card .actions { display: flex; gap: 8px; }

/* Review Detail */
.review-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.review-tabs button {
  padding: 10px 20px;
  background: transparent;
  color: var(--text2);
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.review-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.review-tab-content { display: none; }
.review-tab-content.active { display: block; }

.review-note {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.review-note .note-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}
.review-note .note-body { flex: 1; }
.review-note .note-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.review-note .note-header strong { color: var(--text); }
.review-note .note-header span { color: var(--text3); }
.review-note .note-text { font-size: 14px; color: var(--text2); line-height: 1.5; }

.review-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Reject Modal */
.reject-modal textarea { width: 100%; min-height: 120px; margin-top: 8px; }
.reject-modal .char-count { text-align: right; font-size: 12px; color: var(--text3); margin-top: 4px; }
.reject-modal .hint { font-size: 13px; color: var(--text3); margin-top: 8px; }

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  min-width: 280px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Revision Timeline */
.revision-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.revision-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text3);
  margin-top: 5px;
  flex-shrink: 0;
}
.revision-item .rev-body { flex: 1; }
.revision-item .rev-header { display: flex; justify-content: space-between; font-size: 13px; }
.revision-item .rev-note { font-size: 14px; color: var(--text2); margin-top: 2px; }

/* Notification dropdown */
.notif-container { position: relative; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header span, .sidebar-nav a span, .sidebar-footer { display: none; }
  .sidebar-nav { padding: 8px; }
  .sidebar-nav a { justify-content: center; padding: 10px; }
  .content-area { padding: 16px; }
  .editor-toolbar { padding: 8px 12px; }
  .editor-content { padding: 16px; }
  .queue-card .actions { flex-wrap: wrap; }
}
