/* ============================================================
   Override total Bootstrap 5 — sesuai desain skripsi
   ============================================================ */

:root {
  --page-bg:       #F4F5F9;
  --indigo:        #4F46E5;
  --indigo-soft:   #6366F1;
  --indigo-light:  #E0E7FF;
  --indigo-text:   #4338CA;
  --sidebar-navy:  #0F172A;
  --sidebar-hover: #1E293B;
  --sidebar-text:  #CBD5E1;
  --sidebar-active:#1E293B;
  --card-radius:   12px;
  --card-shadow:   0 1px 3px rgba(15,23,42,.06);
  --border-soft:   #E5E7EB;
  --text-dark:     #0F172A;
  --text-muted:    #64748B;
  --badge-naik-bg: #DCFCE7; --badge-naik-fg: #15803D;
  --badge-turun-bg:#FEE2E2; --badge-turun-fg:#B91C1C;
  --badge-tahan-bg:#FEF3C7; --badge-tahan-fg:#B45309;
  --badge-promo-bg:#E0E7FF; --badge-promo-fg:#4338CA;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--page-bg);
  color: var(--text-dark);
  margin: 0;
  font-size: 14px;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.app-sidebar {
  width: 225px;
  background: var(--sidebar-navy);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid #1E293B;
}
.sidebar-logo {
  width: 36px; height: 36px;
  background: var(--indigo);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.brand-title { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-sub   { color: #94A3B8; font-size: 11px; }

.sidebar-menu { flex: 1; padding: 12px 0; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.menu-item:hover { background: var(--sidebar-hover); color: #fff; }
.menu-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--indigo);
}
.menu-icon { width: 16px; text-align: center; opacity: .85; }

.sidebar-footer {
  border-top: 1px solid #1E293B;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.user-box { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--indigo);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.user-name { color: #fff; font-size: 12px; font-weight: 500; }
.user-role { color: #94A3B8; font-size: 10px; }
.logout-link { color: #94A3B8; text-decoration: none; font-size: 18px; }
.logout-link:hover { color: #fff; }

/* ---------------- Main ---------------- */
.app-main {
  margin-left: 225px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.app-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 28px 14px 28px;
  background: var(--page-bg);
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.breadcrumb-line { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.breadcrumb-line span { color: var(--text-dark); font-weight: 500; }

.header-right { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.chip-admin { background: var(--indigo-light); color: var(--indigo-text); }

.app-content { padding: 0 28px 28px 28px; }

/* ---------------- Card ---------------- */
.card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-soft);
  padding: 18px;
}
.card-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 12px 0;
}

/* Metric cards */
.metric-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-soft);
  padding: 16px 18px;
  height: 100%;
}
.metric-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 6px;
}
.metric-value {
  font-size: 22px; font-weight: 700; color: var(--indigo);
  line-height: 1.2;
}
.metric-sub { font-size: 11px; color: #94A3B8; margin-top: 3px; }
.metric-icon { font-size: 26px; opacity: .65; line-height: 1; }

/* ---------------- Buttons ---------------- */
.btn {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: #4338CA; color: #fff; }
.btn-outline { background: #fff; color: var(--text-dark); border-color: var(--border-soft); }
.btn-outline:hover { background: #F9FAFB; }

/* ---------------- Table ---------------- */
.table-clean {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table-clean thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}
.table-clean tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #F1F5F9;
  color: var(--text-dark);
}
.table-clean tbody tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover { background: #FAFBFC; }

/* ---------------- Badges ---------------- */
.badge-tren {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-naik  { background: var(--badge-naik-bg);  color: var(--badge-naik-fg); }
.badge-turun { background: var(--badge-turun-bg); color: var(--badge-turun-fg); }
.badge-tahan { background: var(--badge-tahan-bg); color: var(--badge-tahan-fg); }
.badge-promo { background: var(--badge-promo-bg); color: var(--badge-promo-fg); }

/* ---------------- Form ---------------- */
.form-label { font-size: 12px; font-weight: 500; color: var(--text-dark); margin-bottom: 5px; display: block; }
.form-control, .form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text-dark);
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* ---------------- Alert ---------------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-warning { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.alert-success { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }

/* ---------------- Login page ---------------- */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-left {
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  color: #fff;
  padding: 60px 70px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-left .logo-badge {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; margin-bottom: 40px;
}
.login-left h1 { font-size: 36px; font-weight: 700; line-height: 1.15; margin: 0 0 14px 0; }
.login-left .sub { font-size: 13px; opacity: .85; margin-bottom: 32px; line-height: 1.6; }
.login-feature { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 13px; }
.login-feature .check {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 11px;
}
.login-right {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; background: #fff;
}
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px 0; }
.login-card .sub { font-size: 12px; color: var(--text-muted); margin-bottom: 24px; }
.login-footer { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 24px; }

/* Form check */
.form-check { display: flex; align-items: center; gap: 6px; padding-left: 0; }
.form-check-input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--indigo); }
.form-check-label { cursor: pointer; color: var(--text-dark); user-select: none; font-size: 12px; }

/* Row gap */
.row.g-3 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }

/* ============================================================
   Dashboard: donut center, legend, piala
   ============================================================ */

.donut-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-center-value { font-size: 22px; font-weight: 700; color: var(--text-dark); line-height: 1; }
.donut-center-label { font-size: 11px; color: var(--text-muted); }

.distribusi-legend { font-size: 12px; }
.legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-name { flex: 1; color: var(--text-dark); }
.legend-value { font-weight: 600; color: var(--text-dark); }

.trophy-big {
  font-size: 64px;
  line-height: 1;
  margin: 12px 0;
  filter: drop-shadow(0 6px 12px rgba(245,158,11,.35));
}

/* ============================================================
   Input Dataset: upload area, file box, info box
   ============================================================ */

.upload-area {
  display: block;
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: #FAFBFC;
  transition: all .15s;
}
.upload-area:hover,
.upload-area.dragover {
  border-color: var(--indigo);
  background: #EEF2FF;
}
.upload-icon { font-size: 32px; color: var(--indigo); margin-bottom: 8px; }
.upload-title { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.upload-sub   { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.file-info-box-v2 {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}
.file-icon-v2 { font-size: 26px; }
.file-name-v2 { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.file-rows-v2 { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.file-ok-v2   { font-size: 11px; color: #15803D; margin-top: 4px; font-weight: 500; }

.modal-content { border-radius: 12px; border: none; }
.modal-header, .modal-footer { border-color: var(--border-soft); }
.modal-title { font-size: 16px; font-weight: 600; }

/* ============================================================
   Praproses Data: stepper, bar distribusi, split bar
   ============================================================ */

/* Stepper 4 langkah */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.stepper-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.stepper-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #E5E7EB;
  color: #64748B;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.stepper-item.done .stepper-num {
  background: var(--indigo);
  color: #fff;
}
.stepper-title { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.stepper-sub   { font-size: 10px; color: var(--text-muted); }
.stepper-line {
  flex: 1;
  height: 2px;
  background: #E5E7EB;
  border-radius: 2px;
}
.stepper-line.done { background: var(--indigo); }

@media (max-width: 900px) {
  .stepper { flex-wrap: wrap; }
  .stepper-line { display: none; }
  .stepper-item { flex: 1 1 40%; margin-bottom: 8px; }
}

/* Distribusi bar */
.dist-bar-wrap { margin-bottom: 0; }
.dist-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.dist-bar-label strong { color: var(--text-dark); }
.dist-bar-bg {
  height: 10px;
  background: #F1F5F9;
  border-radius: 999px;
  overflow: hidden;
}
.dist-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s;
}

/* Split 80:20 bar */
.split-bar-wrap { margin-bottom: 0; }
.split-bar {
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.split-fill {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .5s;
}
.split-latih { background: var(--indigo); }
.split-uji   { background: #0EA5E9; }

/* ============================================================
   Prediksi GLM: confusion matrix, confidence bar
   ============================================================ */

.cm-wrap {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 6px;
  max-width: 480px;
}
.cm-corner { background: transparent; }
.cm-header {
  background: #F8FAFC;
  text-align: center;
  padding: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  text-transform: uppercase;
}
.cm-row-label {
  background: #F8FAFC;
  padding: 12px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  text-transform: uppercase;
}
.cm-cell {
  padding: 16px 8px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border-radius: 6px;
}
.cm-tp { background: #DCFCE7; color: #15803D; }
.cm-tn { background: #DCFCE7; color: #15803D; }
.cm-fp { background: #FEE2E2; color: #B91C1C; }
.cm-fn { background: #FEF3C7; color: #B45309; }

.conf-bar {
  height: 6px;
  background: #EEF2FF;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.conf-fill {
  height: 100%;
  background: var(--indigo);
  border-radius: 999px;
  transition: width .3s;
}

/* ============================================================
   Prediksi KNN: segmented button, voting box
   ============================================================ */

.segmented {
  display: inline-flex;
  background: #F1F5F9;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.segmented-item {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  margin: 0;
}
.segmented-item input[type="radio"] {
  display: none;
}
.segmented-item.active,
.segmented-item:has(input:checked) {
  background: #fff;
  color: var(--indigo);
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.segmented-item:hover {
  color: var(--indigo);
}

.row-highlight {
  background: #EEF2FF !important;
}

.voting-box {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding: 14px 16px;
  background: #F8FAFC;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}
.voting-item { flex: 1; }
.voting-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ============================================================
   Perbandingan Model: tab skenario
   ============================================================ */

.tabs {
  display: inline-flex;
  background: #F1F5F9;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.tab-item {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all .15s;
}
.tab-item:hover { color: var(--indigo); }
.tab-item.active {
  background: #fff;
  color: var(--indigo);
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}