/* ==============================
   FONT & BASE STYLING
============================== */
@font-face {
  font-family: 'PoppinsLocal';
  src: local('Poppins'), local('Poppins-Regular');
}

body {
  font-family: 'PoppinsLocal', sans-serif;
  background: #f8f9fa;
  margin: 0;
  padding: 0;
}

#wrapper { 
  display: flex;
  min-height: 100vh;
  width: 100%;
  transition: all 0.3s ease;
  overflow-x: hidden;
}

/* ==============================
   SIDEBAR
============================== */
#sidebar-wrapper {
  --sidebar-width: 250px;
  width: var(--sidebar-width);
  background: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  border-radius: 0 12px 12px 0;
  transition: all 0.3s ease;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden; /* prevent horizontal scrollbar */
  box-sizing: border-box;
}

/* Saat sidebar kecil */
#wrapper.toggled #sidebar-wrapper {
  width: 60px;
}

/* keep the width variable in sync when toggled */
#wrapper.toggled #sidebar-wrapper {
  --sidebar-width: 60px;
}

/* When sidebar is toggled (collapsed), shift page content left */
#wrapper.toggled #page-content-wrapper {
  margin-left: 60px;
}

/* base content offset to make room for fixed sidebar */
#page-content-wrapper {
  margin-left: 250px;
  transition: margin-left 0.3s ease;
}

/* Heading sidebar */
.sidebar-heading {
  font-weight: 600;
  font-size: 1.1rem;
  padding: 15px;
  text-align: center;
  transition: opacity 0.3s ease;
}

/* Note: do not hide the entire heading when toggled — keep the toggle button visible. */

/* ==============================
   NAVIGATION LINKS
============================== */
#sidebar-wrapper .list-group-item {
  border: none;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  white-space: nowrap;
  background: transparent;
}


#sidebar-wrapper .list-group-item:hover {
  background: #f1f3f5;
  border-radius: 8px;
  transition: background 0.2s ease;
}

/* Icon */
#sidebar-wrapper .list-group-item i {
  font-size: 1.2rem;
  min-width: 25px;
  text-align: center;
}

/* Toggle placed as a list item */
/* place toggle beside heading title */

.sidebar-heading { display: flex; align-items: center; justify-content: space-between; position: relative; }
.sidebar-heading .toggle-btn { border-radius: 8px; width: 36px; height: 36px; position: relative; }
.sidebar-heading .toggle-btn i { transition: transform 0.25s ease; }

/* compute movement distance to center based on current sidebar width */
.sidebar-heading { --toggle-move: calc((var(--sidebar-width) - 36px) / 2); }
.sidebar-heading .toggle-btn { transition: transform 0.28s cubic-bezier(.2,.8,.2,1); }

/* slide the button left when collapsed (use variable so movement adapts to width) */
#wrapper.toggled .sidebar-heading .toggle-btn { transform: translateX(calc(-1 * var(--toggle-move))); }
/* rotate chevron when collapsed */
#wrapper.toggled .sidebar-heading .toggle-btn i { transform: rotate(180deg); }

/* keep the toggle button visible when collapsed: hide heading text and center button */
.sidebar-heading strong { flex: 1; margin-right: 0.5rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#wrapper.toggled .sidebar-heading { justify-content: center; }
#wrapper.toggled .sidebar-heading strong { display: none; }

/* Text */
#sidebar-wrapper .nav-text {
  display: inline-block;
  transition: opacity 0.3s ease, transform 0.3s ease;
  color: #330;
}

/* Hide text saat kecil */
#wrapper.toggled #sidebar-wrapper .nav-text {
  opacity: 0;
  transform: translateX(-10px);
  pointer-events: none;
}

/* Collapse menu */
#sidebar-wrapper .collapse {
  position: relative;
}

/* Active nav styling */
#sidebar-wrapper .list-group-item.active {
  background: linear-gradient(90deg, rgba(7,85,158,0.06), rgba(255,255,255,0));
  color: #074c85;
  position: relative;
}

#sidebar-wrapper .list-group-item.active::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  background: #074c85;
  border-radius: 4px;
}

#sidebar-wrapper .list-group-item.active i,
#sidebar-wrapper .list-group-item.active .nav-text {
  color: #074c85;
  font-weight: 600;
}

/* When collapsed, only show indicator and icon color */
#wrapper.toggled #sidebar-wrapper .list-group-item.active::before {
  left: 12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
}

/* ==============================
   PAGE CONTENT
============================== */
#page-content-wrapper {
  flex: 1;
  width: 100%;
  transition: all 0.3s ease;
  position: relative;
  z-index: auto; /* allow modals to escape this stacking context */
}


/* ==============================
   NAVBAR
============================== */
.navbar {
  transition: all 0.3s ease;
  z-index: 900;
}

#menu-toggle {
  border-radius: 8px;
  padding: 6px 12px;
  transition: all 0.2s ease;
}

#menu-toggle:hover {
  background: #f1f3f5;
}

/* ==============================
   COMPONENTS
============================== */
.card { border-radius: 12px; }
.table td, .table th { vertical-align: middle; }

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 768px) {
  #sidebar-wrapper {
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
  }

  #wrapper.toggled #sidebar-wrapper {
    left: -190px;
  }

  #page-content-wrapper {
    margin-left: 0;
  }

  #wrapper.toggled #page-content-wrapper {
    margin-left: 0;
  }
}

/* ==========================
   NON-ANIMATED LOAD FIX
========================== */
body.preload * {
  transition: none !important;
}



/* ==========================
   CUSTOM TABLE STYLES
========================== */
/* --- General Table Styles --- */
.table {
    width: 100%;
    border-collapse: separate; /* Penting untuk border-radius */
    border-spacing: 0;
    margin-top: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Font modern */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Bayangan lembut untuk kesan modern */
    border-radius: 12px; /* Rounded rectangle utama */
    overflow: hidden; /* Memastikan border-radius terlihat */
}

/* --- Table Header Styles (Rounded) --- */
.table {
    width: 100%;
    border-collapse: separate; /* Penting untuk border-radius */
    border-spacing: 0;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Bayangan lembut */
    border-radius: 12px; /* Rounded rectangle utama */
    overflow: hidden; /* Memastikan border-radius terlihat */
    background-color: #ffffff; /* Latar belakang tabel putih */
}

/* --- Table Header Styles (Monokrom) --- */
.table thead th {
    background-color: #e3e3e3; /* Hitam gelap */
    color: #393939; /* Teks putih */
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: none;
}

/* Rounded corners untuk header */
.table thead tr:first-child th:first-child {
    border-top-left-radius: 12px;
}
.table thead tr:first-child th:last-child {
    border-top-right-radius: 12px;
}

/* --- Table Body (Tanpa Border Pemisah Row) --- */
.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr td {
    padding: 12px 20px;
    border: none; /* MENGHAPUS BORDER PEMISAH ANTAR ROW */
    background-color: #ffffff;
    color: #333333;
}

/* Hover effect (Minimalis) */
.table tbody tr:hover {
    background-color: #f5f5f5; /* Abu-abu sangat terang */
}

/* --- Action Buttons (Monokrom & Minimalis) --- */
.table .btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    margin-right: 5px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid; /* Tambahkan border tipis untuk definisi */
}

/* Tombol Lihat (Monokrom Primer) */
.table .btn-info {
    background-color: #ffffff; /* Putih */
    color: #333333; /* Teks Hitam */
    border-color: #dfdfdfe3; /* Border abu-abu terang */
}

/* Tombol Hapus (Monokrom Sekunder/Negatif) */
.table .btn-danger {
    background-color: #ff0000af; /* Hitam */
    color: #ffffff; /* Teks Putih */
    border-color: #e61a1a;
}

/* Hover effect pada tombol */
.table .btn-info:hover {
    background-color: #e0e0e0;
    border-color: #a0a0a0;
}

.table .btn-danger:hover {
    background-color: #740000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table td:last-child { /* Kolom 'Aksi' */
    white-space: nowrap;
}

.table-striped>tbody>tr:nth-of-type(odd)>*{
--bs-table-bg-type: #ffffff !important; /* Baris ganjil dengan latar abu-abu sangat terang */
}
.table-striped>tbody>tr:nth-of-type(even)>*{
--bs-table-bg-type: #f8f8f8 !important; /* Baris ganjil dengan latar abu-abu sangat terang */
}

.btn-primary {
    background-color: #474747 !important;
    border-color: #d7d7d7 !important;
    color: #ffffff !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.btn-primary:hover {
    background-color: #000000 !important;
    border-color: #a0a0a0 !important;
    color: #ffffff !important;
}

/* Tambahkan di global stylesheet kamu */
.select-dropdown {
  z-index: 9999 !important;
  position: relative;
}

.ts-control{
   border:none !important;
}

.ts-wrapper{
  padding: 0% !important;
  padding-right: 2.75rem !important;
  padding-left: 0.5rem !important;
}

.ts-control>*{
  font-size: 15px !important;
}

.ts-control-input{
  font-size: 15px;
}

.ts-dropdown{
  font-size: 14px !important;
  margin:auto;
}

.badge-soft {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
}

/* UNPAID - merah soft */
.badge-unpaid {
  color: #991b1b;
  background-color: rgba(239, 68, 68, 0.18);
}

.badge-waiting-for-payment {
  color: #991b1b;
  background-color: rgba(239, 68, 68, 0.18);
}

/* INVOICED - kuning soft */
.badge-invoiced {
  color: #92400e;
  background-color: rgba(234, 179, 8, 0.25);
}

.badge-partially-paid {
  color: #92400e;
  background-color: rgba(234, 179, 8, 0.25);
}

/* PAID - hijau soft */
.badge-paid {
  color: #166534;
  background-color: rgba(34, 197, 94, 0.22);
}

.trx-check {
  transform: scale(0.72);
  cursor: pointer;
  margin-top: 0%!important;
  background-color: #ffffff;
  border: 1px solid #515151;              /* gray-300 */
  border-radius: 3px;

  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.accordion-body {
  padding: 0.25rem 1rem 0.75rem;
}
.accordion-trigger {
  padding: 6px 6px;
  background-color: #f5f6f8;
  cursor: pointer;
  border-bottom: 1px solid #e5e7eb;
}

.accordion-item:first-child .accordion-trigger {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.accordion-trigger:hover {
  background-color: #eef0f3;
}

.trx-no {
  font-size: 0.9rem;     /* sedikit lebih kecil */
  font-weight: 500;
  color: #374151;         /* gray-700 */
}

.trx-amount {
  font-size: 0.8rem;      /* lebih kecil dari title */
  font-weight: 500;
  color: #4b5563;         /* gray-600 */
  text-align: right;
  white-space: nowrap;
}

.trx-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827; /* gray-900 */
}

.trx-date {
  font-size: 0.75rem;
  color: #6b7280; /* gray-500 */
}


.trx-item-line {
  font-size: 0.85rem;
  color: #374151; /* gray-700 */
  padding: 4px 0;
}

.trx-item-qty {
  font-weight: 600;
  margin-right: 1px;
}

.trx-item-unit {
  color: #6b7280; /* gray-500 */
}

.trx-item-name {
  font-weight: 500;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
}

.clear-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: #6c757d;
  text-decoration: none;
}

.clear-icon:hover {
  color: #dc3545;
}
