/* Admin CMS Melek Digital - Dark Theme */
:root {
  --primary: #1e3a8a;
  --primary-dark: #172554;
  --accent: #3b82f6;
  --accent-light: #93c5fd;
  --bg: #020617;
  --bg-card: #0f172a;
  --bg-input: #0f172a;
  --border: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --red: #e74c3c;
  --green: #2ecc71;
  --yellow: #f39c12;
  --blue: #3498db;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b1b3a, #020617);
}
.login-box {
  width: 380px;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.login-box h1 { text-align: center; margin-bottom: 0.5rem; color: var(--accent); font-size: 1.5rem; }
.login-box p { text-align: center; color: var(--text-muted); margin-bottom: 2rem; font-size: 0.85rem; }

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

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  padding-bottom: 6rem;
  position: fixed;
  top: 0; left: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { font-size: 1.1rem; font-weight: 800; color: var(--accent); margin-bottom: 2rem; }
.sidebar .brand span { color: var(--text); }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  border-radius: 8px;
  margin-bottom: 0.25rem;
  transition: all 0.2s;
  font-size: 0.85rem;
}
/* Menu aktif dan tersorot */
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(59,130,246,0.18);
  border-left: 3px solid #3b82f6;
  color: #ffffff;
  font-weight: 600;
}
.sidebar nav a.active {
  background: rgba(59,130,246,0.30);
  color: #ffffff;
}
.sidebar .user-info { 
  margin-top: 1.5rem; 
  padding-top: 1rem; 
  border-top: 1px solid var(--border); 
  font-size: 0.8rem; 
  color: var(--text-muted); 
  position: static;
}
.sidebar .user-info .name { color: var(--text); font-weight: 600; }

/* Main content */
.main-content {
  margin-left: 240px;
  padding: 2rem;
  flex: 1;
  width: calc(100% - 240px);
}

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h2 { font-size: 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  background: var(--bg-card);
  color: var(--text);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(231,76,60,0.1); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.78rem; }

/* Form */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group select { cursor: pointer; }

/* Upload preview image */
#upload-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}
#upload-preview img:hover { opacity: 0.8; }

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat-card .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 0.75rem 0.5rem; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 0.5rem; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-published { background: rgba(46,204,113,0.15); color: var(--green); }
.badge-draft { background: rgba(153,153,153,0.15); color: var(--text-muted); }
.badge-scheduled { background: rgba(243,156,18,0.15); color: var(--yellow); }

.actions { display: flex; gap: 0.5rem; }

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 9999;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Quill editor override */
.ql-toolbar { background: var(--bg-input) !important; border: 1px solid var(--border) !important; border-radius: 8px 8px 0 0 !important; }
.ql-container { background: var(--bg-input) !important; border: 1px solid var(--border) !important; border-top: none !important; border-radius: 0 0 8px 8px !important; min-height: 400px; font-size: 1rem !important; font-family: 'Inter', sans-serif !important; }
.ql-editor { color: var(--text) !important; min-height: 400px; }
.ql-editor.ql-blank::before { color: var(--text-muted) !important; }
.ql-picker-label { color: var(--text) !important; }
.ql-stroke { stroke: var(--text) !important; }
.ql-fill { fill: var(--text) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--accent) !important; }
.ql-picker-options { background: var(--bg-card) !important; border-color: var(--border) !important; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}
.filter-bar select, .filter-bar input {
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
}

/* Search */
.search-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.search-box input { flex: 1; }

/* Article editor layout */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

/* Responsive admin */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; width: 100%; padding: 1rem; }
  .editor-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Generate Konten Spinner ===== */
.gen-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent, #d4af37);
  border-top-color: transparent;
  border-radius: 50%;
  animation: gen-spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 0.5rem;
}
@keyframes gen-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Hit Issue Hari Ini (Drone Emprit) */
.mk-meta { font-size: 0.8rem; color: var(--text-muted); padding: 0.5rem 0; }
.mk-table td { vertical-align: middle; }
.mk-rank { font-weight: 800; color: var(--accent); font-size: 1rem; width: 3rem; }
.mk-issue { color: var(--text); font-weight: 600; text-decoration: none; }
.mk-issue:hover { color: var(--accent); text-decoration: underline; }
.mk-trend { text-align: center; font-size: 1rem; }
.hitbar { background: rgba(255,255,255,0.06); border-radius: 50px; height: 8px; width: 100%; overflow: hidden; }
.hitbar div { background: linear-gradient(90deg, var(--accent), var(--green)); height: 100%; border-radius: 50px; }
.error-box { background: rgba(231,76,60,0.1); border: 1px solid var(--red); color: var(--red); padding: 1rem; border-radius: 8px; }

/* Report Drone Emprit (isian markdown) */
.mk-report-body h1, .mk-report-body h2, .mk-report-body h3, .mk-report-body h4 { color: var(--accent); margin: 1.25rem 0 0.5rem; line-height: 1.4; }
.mk-report-body h1 { font-size: 1.3rem; }
.mk-report-body h2 { font-size: 1.15rem; }
.mk-report-body h3 { font-size: 1.05rem; }
.mk-report-body h4 { font-size: 0.98rem; }
.mk-report-body p { margin: 0.5rem 0; }
.mk-report-body ul, .mk-report-body ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.mk-report-body li { margin: 0.3rem 0; }
.mk-report-body strong { color: #fbbf24; }
.mk-report-body blockquote { border-left: 3px solid var(--accent); padding: 0.25rem 1rem; margin: 0.75rem 0; background: rgba(255,255,255,0.04); border-radius: 0 8px 8px 0; }
.mk-report-body code { background: rgba(255,255,255,0.08); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
.mk-report-body pre { background: #0f172a; padding: 1rem; border-radius: 8px; overflow-x: auto; }
.mk-report-body pre code { background: transparent; padding: 0; }
.mk-report-body table { border-collapse: collapse; width: 100%; margin: 0.75rem 0; font-size: 0.85rem; }
.mk-report-body th, .mk-report-body td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; }
.mk-report-body th { background: rgba(255,255,255,0.06); color: var(--accent); }
.mk-report-body hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.filter-tabs { display: flex; gap: 0.5rem; margin: 0.75rem 0; flex-wrap: wrap; }
#md-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.5; }
.emprit-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.75rem 0; }
.emprit-body h4 { text-transform: capitalize; }
.muted { color: var(--text-muted); }

/* Kartu statistik yang dapat diklik diberi tanda agar jelas bisa ditekan */
.kartu-klik { cursor: pointer; transition: border-color 0.2s, transform 0.12s, background 0.2s; }
.kartu-klik:hover { border-color: var(--green); background: rgba(16,185,129,0.08); transform: translateY(-2px); }
.kartu-klik:active { transform: translateY(0); }
