/* ============================================================
   ADMIN CSS — Sidebar Layout
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');

:root {
  --primary:       #1a6e3c;
  --primary-light: #2d9e5a;
  --primary-dark:  #0f4726;
  --accent:        #e8a020;
  --accent-light:  #ffc84a;
  --sidebar-bg:    #0f4726;
  --sidebar-width: 250px;
  --bg:            #f4f7f4;
  --bg-card:       #ffffff;
  --text:          #1c2b1c;
  --text-muted:    #5a7a5a;
  --border:        #d4e6d4;
  --shadow-sm:     0 2px 8px rgba(26,110,60,.08);
  --shadow-md:     0 6px 24px rgba(26,110,60,.12);
  --radius-sm:     8px;
  --radius-md:     16px;
  --transition:    all .25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo .logo-icon {
  width: 40px; height: 40px; background: rgba(255,255,255,.15);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 10px;
}

.sidebar-logo span {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px; font-weight: 800; color: #fff; display: block;
}

.sidebar-logo small { font-size: 11px; color: rgba(255,255,255,.5); }

.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-nav-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: rgba(255,255,255,.35); padding: 6px 8px; margin-top: 12px; text-transform: uppercase; }

.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255,255,255,.65);
  font-size: 14px; font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav a .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.sidebar-nav a.active::before { content: ''; position: absolute; left: 0; width: 3px; height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; }
.sidebar-nav a { position: relative; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.5);
  font-size: 13px; text-decoration: none;
  transition: var(--transition);
}
.sidebar-footer a:hover { color: #fff; }

/* ── MAIN CONTENT ── */
.admin-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.admin-topbar h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.admin-topbar .topbar-actions { display: flex; align-items: center; gap: 12px; }
.admin-topbar .admin-badge {
  background: var(--primary-dark); color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 8px;
}

.admin-main { padding: 32px; flex: 1; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}

.stat-card.card-green::after  { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.card-amber::after  { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card.card-blue::after   { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
.stat-card.card-red::after    { background: linear-gradient(90deg, #dc2626, #f87171); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 16px;
}

.stat-icon.green  { background: rgba(26,110,60,.1); }
.stat-icon.amber  { background: rgba(232,160,32,.1); }
.stat-icon.blue   { background: rgba(29,78,216,.1); }
.stat-icon.red    { background: rgba(220,38,38,.1); }

.stat-value { font-size: 28px; font-weight: 800; color: var(--primary-dark); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-trend {
  position: absolute; top: 20px; right: 20px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.stat-trend.up   { background: #d1fae5; color: #065f46; }
.stat-trend.down { background: #fee2e2; color: #991b1b; }

/* ── CHART CARD ── */
.chart-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.chart-card-title {
  font-size: 16px; font-weight: 700; color: var(--primary-dark);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}

/* ── AI PANEL ── */
.ai-panel {
  background: linear-gradient(135deg, #0f4726 0%, #1a6e3c 100%);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.ai-panel::before {
  content: '🤖';
  position: absolute; right: 24px; top: 24px;
  font-size: 80px; opacity: .1;
}

.ai-panel h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.ai-panel p  { font-size: 14px; opacity: .8; margin-bottom: 20px; line-height: 1.7; }
.ai-panel .ai-insight-text { font-size: 15px; opacity: .9; line-height: 1.8; }

.ai-metric {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  padding: 8px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  margin-right: 10px; margin-top: 10px;
}

/* ── DATA TABLE ── */
.data-card { background: #fff; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 24px; }
.data-card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.data-card-header h3 { font-size: 15px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }

table { width: 100%; border-collapse: collapse; }
table th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; background: var(--bg); border-bottom: 1px solid var(--border); }
table td { padding: 14px 16px; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #f8fdf8; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: var(--transition); font-family: 'Inter', sans-serif; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26,110,60,.3); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:hover { background: #fecaca; }

/* Sentiment badges */
.badge-positif  { background: #d1fae5; color: #065f46; }
.badge-netral   { background: #f3f4f6; color: #6b7280; }
.badge-negatif  { background: #fee2e2; color: #991b1b; }

/* Form */
.form-group { margin-bottom: 18px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; display: block; }
.form-control { width: 100%; padding: 10px 13px; border: 2px solid var(--border); border-radius: 9px; font-size: 14px; font-family: 'Inter', sans-serif; color: var(--text); background: var(--bg); outline: none; transition: var(--transition); }
.form-control:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(26,110,60,.08); }
select.form-control { cursor: pointer; }

/* Loading spinner */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-content { margin-left: 0; }
}
