/* ==== Custom Styles untuk Aplikasi (Override Dashboard CSS) ==== */

/* Halaman Pre-Processing */
.hero-pre {
  background: linear-gradient(135deg, #f3f6ff 0%, #eef8ff 60%, #eafaf1 100%);
  border: 1px solid #e8eef7;
  border-radius: 16px;
  padding: 22px 24px;
}
.hero-pre h2 { font-weight: 700; letter-spacing: .2px; margin: 0; }
.hero-pre .subtitle { color: #6b7280; margin-top: 6px; font-size: .96rem; }

.badge-soft {
  background: #eef2ff; color: #3949ab; border: 1px solid #e0e7ff;
  padding: .35rem .55rem; border-radius: 999px; font-weight: 600;
}

.btn-proses   { min-width: 190px;  font-weight: 600; }
.btn-download { min-width: 260px;  font-weight: 600; }
.card-soft    { border: 1px solid #edf1f7; border-radius: 14px; }

/* Stat Cards */
.card.stat {
  border-left: 6px solid #4B49AC;
}
.stat-title {
  font-size: 0.9rem;
  color: #6c757d;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

/* Sidebar adjustments */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  height: 100vh !important;
  z-index: 11 !important;
}

.sidebar .brand-wrapper {
  flex-shrink: 0;
}

.sidebar .nav {
  flex: 1;
  overflow-y: auto;
}

/* Fix untuk layout Dashboard - Override CSS Dashboard */
html, body {
  height: 100% !important;
  overflow-x: hidden !important;
}

body {
  margin: 0 !important;
  padding: 0 !important;
}

.container-scroller {
  display: flex !important;
  flex-direction: row !important;
  height: 100vh !important;
  overflow: hidden !important;
}

.page-body-wrapper {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  margin-left: 235px !important;
  width: calc(100% - 235px) !important;
  min-height: 100vh !important;
  padding-top: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100vh !important;
  -webkit-overflow-scrolling: touch !important;
}

.main-panel {
  width: 100% !important;
  flex: 1 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: fit-content !important;
}

.content-wrapper {
  overflow: visible !important;
  flex: 1 0 auto !important;
  min-height: fit-content !important;
  padding-bottom: 2rem !important;
}

@media (max-width: 991px) {
  .page-body-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
}

/* Icon styling - Material Design Icons sudah dimuat */
.menu-icon {
  font-size: 1rem;
  line-height: 1;
  margin-right: 1rem;
}

/* Menu Arrow styling - Override Dashboard CSS */
.sidebar .nav .nav-item .nav-link i.menu-arrow {
  margin-left: auto !important;
  margin-right: 0 !important;
  font-size: 1.5rem !important;
  line-height: 1 !important;
  transition: transform 0.3s ease !important;
  color: inherit !important;
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  vertical-align: middle !important;
  font-family: "Material Design Icons" !important;
  font-style: normal !important;
  font-weight: normal !important;
}

/* Override Dashboard CSS yang menggunakan themify font */
.sidebar .nav .nav-item .nav-link i.menu-arrow:before {
  content: "" !important;
  display: none !important;
  font-family: "Material Design Icons" !important;
}

.sidebar .nav .nav-item .nav-link[aria-expanded="true"] i.menu-arrow {
  transform: rotate(180deg) !important;
}

.sidebar .nav .nav-item .nav-link i.menu-arrow.mdi {
  font-size: 1.5rem !important;
  line-height: 1 !important;
  width: auto !important;
  height: auto !important;
  display: inline-block !important;
  font-family: "Material Design Icons" !important;
}

/* Pre code formatting */
pre {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 10px;
  border-radius: 8px;
}

/* Card adjustments */
.card h5 {
  font-weight: 700;
}

/* Page Header & Breadcrumb */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header .page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #212529;
}

.breadcrumb {
  background-color: transparent;
  padding: 0;
  margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: ">";
  padding: 0 0.5rem;
  color: #6c757d;
}

.breadcrumb-item a {
  color: #4B49AC;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #6c757d;
}

/* Grid Margin untuk spacing konsisten */
.grid-margin {
  margin-bottom: 1.5rem;
}

.stretch-card {
  display: flex;
  align-items: stretch;
  flex-direction: column;
}

.stretch-card > .card {
  width: 100%;
  flex: 1 1 auto;
}

/* Form Group spacing */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #212529;
}

/* Form Switch spacing */
.form-check.form-switch {
  margin: 0;
  padding-left: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: fit-content;
}

.form-check.form-switch .form-check-input {
  margin: 0 !important;
  margin-right: 0.5rem !important;
  flex-shrink: 0;
}

.form-check.form-switch .form-check-label {
  white-space: nowrap;
  margin-bottom: 0;
  padding-left: 0;
}

/* Button spacing improvements */
.d-flex.gap-3 {
  gap: 1rem !important;
}

.d-flex[style*="gap"] {
  gap: 1rem !important;
}

/* Table styling improvements */
.table {
  font-size: 0.95rem;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  color: #495057;
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-top: 1px solid #dee2e6;
}

.table tbody tr:hover {
  background-color: #f8f9fa;
  transition: background-color 0.15s ease-in-out;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: rgba(0, 0, 0, 0.02);
}

.table-striped > tbody > tr:nth-of-type(odd):hover > td {
  background-color: #f1f3f5;
}

.table-bordered {
  border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
  border: 1px solid #dee2e6;
}

.table-bordered thead th {
  border-bottom-width: 2px;
}

/* Table responsive wrapper */
.table-responsive {
  border-radius: 0.375rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive .table {
  margin-bottom: 0;
  border-radius: 0.375rem;
  overflow: hidden;
}

/* Preview table styling */
.preview-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  margin-bottom: 0;
}

.preview-table thead th {
  background-color: #f8f9fa !important;
  border-bottom: 2px solid #dee2e6 !important;
  font-weight: 600 !important;
  color: #495057 !important;
  padding: 0.75rem 1rem !important;
  vertical-align: middle !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

.preview-table tbody td {
  padding: 0.75rem 1rem !important;
  vertical-align: top !important;
  border-top: 1px solid #e9ecef !important;
  border-bottom: 1px solid #e9ecef !important;
  line-height: 1.6;
}

.preview-table tbody tr {
  transition: background-color 0.15s ease-in-out;
}

.preview-table tbody tr:hover {
  background-color: #f8f9fa !important;
}

.preview-table tbody tr:nth-of-type(even) {
  background-color: rgba(0, 0, 0, 0.02) !important;
}

.preview-table tbody tr:nth-of-type(even):hover {
  background-color: #f1f3f5 !important;
}

/* Text wrapping for long content */
.table td {
  word-wrap: break-word;
  max-width: 500px;
}

.preview-table td.text-mono {
  word-wrap: break-word;
  max-width: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Confusion matrix table */
.table.table-sm th,
.table.table-sm td {
  padding: 0.5rem 0.75rem;
  text-align: center;
}

.table.table-sm thead th {
  text-align: center;
  font-weight: 600;
}

/* Badge in table */
.table .badge {
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
}

/* Styling untuk tabel yang di-generate dari pandas (preview_html) */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  width: 100% !important;
  margin-bottom: 0 !important;
  font-size: 0.9rem;
}

.table-responsive table thead th {
  background-color: #f8f9fa !important;
  border-bottom: 2px solid #dee2e6 !important;
  font-weight: 600 !important;
  color: #495057 !important;
  padding: 0.75rem 1rem !important;
  vertical-align: middle !important;
  white-space: nowrap;
}

.table-responsive table tbody td {
  padding: 0.75rem 1rem !important;
  vertical-align: middle !important;
  border-top: 1px solid #dee2e6 !important;
  word-wrap: break-word;
  white-space: normal;
}

.table-responsive table tbody tr {
  transition: background-color 0.15s ease-in-out;
}

.table-responsive table tbody tr:hover {
  background-color: #f8f9fa !important;
}

.table-responsive table.table-striped tbody tr:nth-of-type(odd) > td {
  background-color: rgba(0, 0, 0, 0.02) !important;
}

.table-responsive table.table-striped tbody tr:nth-of-type(odd):hover > td {
  background-color: #f1f3f5 !important;
}

.table-responsive table.table-bordered {
  border: 1px solid #dee2e6 !important;
}

.table-responsive table.table-bordered th,
.table-responsive table.table-bordered td {
  border: 1px solid #dee2e6 !important;
}

.table-responsive table.table-bordered thead th {
  border-bottom-width: 2px !important;
}

/* Styling khusus untuk kolom prediksi dan label */
.table-responsive table th:last-child,
.table-responsive table td:last-child {
  text-align: center;
}

/* Text wrapping untuk kolom teks panjang */
.table-responsive table td {
  max-width: 600px;
  word-wrap: break-word;
  white-space: normal;
  line-height: 1.5;
}

/* Kolom dengan teks panjang */
.table-responsive table td:nth-child(2),
.table-responsive table td:nth-child(3) {
  max-width: 400px;
}

/* Sticky header untuk tabel dalam scrollable container */
.table-responsive[style*="max-height"] table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f8f9fa !important;
}
