:root {
  --color-dark-olive: #41431B;
  --color-muted-sage: #AEB784;
  --color-warm-sand: #E3DBBB;
  --color-cream-bg: #F8F3E1;
  --color-white: #FFFFFF;
  --color-text: #2C2E15;
  --color-text-light: #60643A;
  --shadow-sm: 0 2px 8px rgba(65, 67, 27, 0.06);
  --shadow-md: 0 8px 24px rgba(65, 67, 27, 0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', sans-serif; }
body { background-color: var(--color-cream-bg); color: var(--color-text); min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* =========================================
   --- 1. ELEMEN COVER LOGIN --- 
   ========================================= */
.login-container { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  padding: 20px; 
}

.login-card { 
  background-color: var(--color-white); 
  width: 100%; 
  max-width: 400px; 
  padding: 40px 32px 32px; 
  border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-md); 
  border: 1px solid var(--color-warm-sand); 
  text-align: center; 
}

.login-logo {
  width: 100%;
  max-width: 160px;
  height: auto;
  margin: 0 auto 16px auto; 
  display: block;
}

.login-slogan {
  font-size: 13px;
  color: #795548; 
  font-style: italic;
  font-weight: 500;
  margin-bottom: 24px; 
  line-height: 1.4;
  padding: 0 10px;
}

.login-footer {
  margin-top: 24px; 
  text-align: center;
  font-size: 12px;
  color: #9c9780; 
  font-weight: 500;
  letter-spacing: 0.5px;
}

.office-badge-desktop {
  position: absolute;
  top: 32px;
  left: 40px;
  height: 65px; 
  width: auto;
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(65, 67, 27, 0.15)); 
}

/* =========================================
   --- 2. FORMS & INPUT COMPONENT --- 
   ========================================= */
.input-group { margin-bottom: 14px; text-align: left; }
.input-group label { display: block; font-size: 11.5px; font-weight: 600; margin-bottom: 6px; color: var(--color-dark-olive); text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input, .input-group select, .input-group textarea { width: 100%; padding: 10px 12px; background-color: var(--color-cream-bg); border: 1px solid var(--color-warm-sand); border-radius: var(--radius-sm); outline: none; font-size: 13px; color: var(--color-text); }
.input-group input:focus, .input-group select:focus, .input-group textarea:focus { border-color: var(--color-dark-olive); background-color: var(--color-white); box-shadow: 0 0 0 3px rgba(65, 67, 27, 0.1); }

.file-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background-color: var(--color-cream-bg); border: 2px dashed var(--color-muted-sage); border-radius: var(--radius-md); cursor: pointer; text-align: center; transition: all 0.2s;}
.file-dropzone:hover { background-color: var(--color-white); border-color: var(--color-dark-olive); }
.dropzone-icon { color: var(--color-muted-sage); margin-bottom: 4px; }
.dropzone-icon svg { width: 22px; height: 22px; }
.file-text { font-size: 11.5px; font-weight: 500; color: var(--color-text-light); }

/* --- PASSWORD TOGGLE --- */
.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { padding-right: 40px; }
.btn-toggle-pass { position: absolute; right: 12px; background: none; border: none; color: var(--color-text-light); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: color 0.2s; }
.btn-toggle-pass svg { width: 18px; height: 18px; }
.btn-toggle-pass:hover { color: var(--color-dark-olive); }

/* =========================================
   --- 3. MAIN LAYOUT --- 
   ========================================= */
.main-container { max-width: 98%; width: 1600px; margin: 0 auto; padding: 16px 8px; }
.navbar { display: flex; justify-content: space-between; align-items: center; background-color: var(--color-dark-olive); padding: 12px 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); color: var(--color-white); margin-bottom: 16px; }
.nav-brand { display: flex; align-items: center; gap: 8px; }
.nav-icon svg { width: 22px; height: 22px; }
.nav-brand h1 { font-size: 18px; font-weight: 700; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.user-badge { background-color: rgba(255, 255, 255, 0.12); padding: 4px 10px; border-radius: 20px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.user-dot { width: 6px; height: 6px; background-color: var(--color-muted-sage); border-radius: 50%; }
.btn-logout-icon { background: none; border: none; color: var(--color-white); cursor: pointer; display: flex; align-items: center; opacity: 0.8; transition: opacity 0.2s; }
.btn-logout-icon:hover { opacity: 1; }
.btn-logout-icon svg { width: 20px; height: 20px; }

/* =========================================
   --- 4. TOOLBAR --- 
   ========================================= */
.toolbar-wrapper { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; width: 100%; }
.search-box { position: relative; flex: 1; }
.search-box input { width: 100%; padding: 10px 14px 10px 36px; background-color: var(--color-white); border: 1px solid var(--color-warm-sand); border-radius: var(--radius-sm); font-size: 13px; outline: none; box-shadow: var(--shadow-sm); }
.search-box input:focus { border-color: var(--color-dark-olive); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--color-text-light); }
.filter-box select { padding: 10px 14px; background-color: var(--color-white); border: 1px solid var(--color-warm-sand); border-radius: var(--radius-sm); font-size: 13px; outline: none; box-shadow: var(--shadow-sm); color: var(--color-text); cursor: pointer; }

@media (min-width: 768px) { 
  .toolbar-wrapper { flex-direction: row; justify-content: space-between; align-items: center; } 
  .toolbar-left { width: auto; flex: 1; max-width: 600px; } 
  .toolbar-right { width: auto; justify-content: flex-end; } 
}

/* =========================================
   --- 5. BUTTONS --- 
   ========================================= */
.flex-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); white-space: nowrap; }
.btn-primary { background-color: var(--color-dark-olive); color: white; border: none; }
.btn-primary:hover { background-color: #555725; }
.btn-icon { width: 16px; height: 16px; }
.btn-secondary { background-color: var(--color-white); color: var(--color-dark-olive); border: 1px solid var(--color-warm-sand); padding: 10px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-secondary:hover { background-color: var(--color-warm-sand); }

/* Tombol Login */
#btn-login { width: 100%; padding: 14px; background-color: var(--color-dark-olive); color: var(--color-white); border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color 0.2s ease; margin-top: 10px; }
#btn-login:hover { background-color: #555725; }
#btn-login:disabled { background-color: var(--color-muted-sage); opacity: 0.7; cursor: not-allowed; }
#btn-login.btn-brown { background-color: #5D4037; }
#btn-login.btn-brown:hover { background-color: #4E342E; }

/* =========================================
   --- 6. FULL WIDTH TABLE DESIGN --- 
   ========================================= */
.card { background-color: var(--color-white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--color-warm-sand); }
.full-width-card { width: 100%; padding: 16px; }

.table-responsive { 
  overflow-x: auto; 
  overflow-y: auto; 
  max-height: calc(100vh - 220px); 
  border: 1px solid var(--color-warm-sand); 
  border-radius: var(--radius-sm); 
}

table { width: 100%; border-collapse: collapse; text-align: left; }
table th { 
  position: sticky; 
  top: 0; 
  z-index: 10; 
  background-color: var(--color-warm-sand); 
  color: var(--color-dark-olive); 
  font-weight: 600; 
  font-size: 12.5px; 
  padding: 14px 16px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  box-shadow: 0 2px 4px rgba(65, 67, 27, 0.1); 
}
table td { padding: 14px 16px; font-size: 13.5px; border-bottom: 1px solid #F3F4F6; color: var(--color-text); background-color: var(--color-white); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background-color: rgba(248, 243, 225, 0.3); }

/* BADGES AT CELL */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background-color: var(--color-dark-olive); color: var(--color-white); }

/* TABLE ACTIONS CELL BUTTONS */
.actions-cell-wrapper { display: flex; justify-content: center; gap: 6px; }
.btn-table-action { background: var(--color-cream-bg); border: 1px solid var(--color-warm-sand); width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--color-dark-olive); cursor: pointer; transition: all 0.2s; }
.btn-table-action:hover { background-color: var(--color-dark-olive); color: var(--color-white); border-color: var(--color-dark-olive); }
.btn-table-action.delete:hover { background-color: #DC2626; border-color: #DC2626; color: white; }
.btn-table-action svg { width: 15px; height: 15px; }

/* --- SORTABLE TABLE HEADERS --- */
.sortable-th { cursor: pointer; transition: background-color 0.2s ease; user-select: none; }
.sortable-th:hover { background-color: #EBE5CF; }
.th-content { display: flex; align-items: center; justify-content: flex-start; gap: 6px; white-space: nowrap; }
.sort-icon { display: inline-block; font-size: 16px; font-weight: 700; line-height: 1; color: var(--color-text-light); opacity: 0.3; transition: all 0.2s ease; margin-left: 2px; }
.sort-icon.active { opacity: 1; color: var(--color-dark-olive); }
.sort-icon.asc { transform: rotate(180deg); }

/* --- HIGHLIGHT ANIMATION --- */
.row-flash-highlight td { animation: flashHighlight 3s ease-out; }
@keyframes flashHighlight {
  0% { background-color: #FEF08A !important; } 
  100% { background-color: var(--color-white) !important; } 
}

/* =========================================
   --- 7. PAGINATION & TABLE FOOTER --- 
   ========================================= */
.table-footer { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding-top: 16px; gap: 12px; }
@media (min-width: 600px) { .table-footer { flex-direction: row; } }

.rows-selector { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-light); font-weight: 500; }
.rows-selector select { padding: 6px 10px; border: 1px solid var(--color-warm-sand); border-radius: var(--radius-sm); background-color: var(--color-cream-bg); color: var(--color-dark-olive); font-weight: 600; outline: none; cursor: pointer; }

.pagination-controls { display: flex; align-items: center; gap: 6px; }
.btn-pagination { background-color: var(--color-cream-bg); border: 1px solid var(--color-warm-sand); color: var(--color-dark-olive); padding: 6px 12px; font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; }
.btn-pagination:hover:not(.disabled):not(.active) { background-color: var(--color-warm-sand); }
.btn-pagination.active { background-color: var(--color-dark-olive); color: var(--color-white); border-color: var(--color-dark-olive); cursor: default; }
.btn-pagination.disabled { opacity: 0.5; cursor: not-allowed; background-color: #f9fafb; }
.pagination-dots { color: var(--color-text-light); font-weight: 600; padding: 0 4px; }

/* =========================================
   --- 8. MODAL DIALOG POPUP DESIGN --- 
   ========================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(65, 67, 27, 0.4); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background-color: var(--color-white); width: 100%; max-width: 500px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); border: 1px solid var(--color-warm-sand); display: flex; flex-direction: column; animation: modalFadeIn 0.2s ease-out; }
@keyframes modalFadeIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--color-warm-sand); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--color-dark-olive); }
.modal-close-x { background: none; border: none; font-size: 22px; color: var(--color-text-light); cursor: pointer; }
.modal-close-x:hover { color: var(--color-dark-olive); }
#upload-form { padding: 20px; overflow-y: auto; max-height: 80vh; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; border-top: 1px solid var(--color-warm-sand); padding-top: 14px; }
.btn-primary-action { padding: 10px 20px; background-color: var(--color-dark-olive); color: white; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-primary-action:hover { background-color: #555725; }
.btn-primary-action:disabled { background-color: var(--color-muted-sage); cursor: not-allowed; }

.status-box { margin-top: 10px; font-size: 12.5px; text-align: center; font-weight: 500; }
.error-msg { color: #DC2626; font-size: 13px; margin-top: 10px; font-weight: 500; }

/* Kategori List Styles */
.cat-list-wrapper { list-style: none; padding: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--color-warm-sand); border-radius: var(--radius-sm); background: #f9fafb; }
.cat-list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--color-warm-sand); font-size: 13.5px; font-weight: 500; color: var(--color-text); background: var(--color-white); }
.cat-list-item:last-child { border-bottom: none; }
.cat-list-item-actions { display: flex; gap: 8px; }
.cat-action-btn { background: none; border: none; cursor: pointer; color: var(--color-text-light); transition: color 0.2s;}
.cat-action-btn:hover { color: var(--color-dark-olive); }
.cat-action-btn.delete:hover { color: #DC2626; }
.cat-action-btn svg { width: 18px; height: 18px; }

/* Modal Preview (Iframe) */
.modal-xl { max-width: 90vw !important; height: 90vh !important; }
.modal-xl .modal-body { flex: 1; padding: 0; display: flex; flex-direction: column; }
#preview-iframe { width: 100%; height: 100%; border: none; background-color: #f3f4f6; }

/* --- STATISTIK PROGRESS BAR --- */
.stat-item { margin-bottom: 16px; }
.stat-header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.stat-count { color: var(--color-text-light); font-size: 12px; }
.stat-bar-bg { width: 100%; height: 8px; background-color: var(--color-cream-bg); border: 1px solid var(--color-warm-sand); border-radius: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; background-color: var(--color-dark-olive); border-radius: 4px; transition: width 0.6s ease-out; }

/* --- LOADING SPINNER ANIMATION --- */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: var(--color-white); animation: spin 1s ease-in-out infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =======================================================
   --- 9. RESPONSIVE MOBILE (HP & TABLET) --- 
   ======================================================= */
@media (max-width: 768px) {

  /* Sembunyikan badge logo di layar sempit */
  .office-badge-desktop { display: none; }

  /* Toolbar menjadi tumpukan vertikal */
  .toolbar-left { flex-direction: column; align-items: stretch; }
  .toolbar-right { justify-content: space-between; gap: 8px; }
  .toolbar-right .flex-btn { flex: 1; padding: 10px 0; }
  .toolbar-right .flex-btn span { display: none; } /* Hilangkan teks tombol aksi */
  .toolbar-right .flex-btn svg { margin: 0; }

  /* Transformasi Tabel menjadi Card List */
  table, thead, tbody, th, td, tr { display: block; }
  table thead { display: none; }
  
  .card.full-width-card { background-color: transparent; border: none; box-shadow: none; padding: 0; }
  .table-responsive { border: none; max-height: none; overflow: visible; }
  
  table tr { display: flex; flex-direction: column; background-color: var(--color-white); border: 1px solid var(--color-warm-sand); border-radius: var(--radius-md); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
  table td { border: none !important; padding: 0 !important; text-align: left; background-color: transparent !important; }
  
  /* Urutan Elemen dalam Card (Mobile) */
  table tr td:nth-child(2) { order: 1; align-self: flex-start; margin-bottom: 8px; }
  table tr td:nth-child(3) { order: 2; font-size: 16px !important; font-weight: 700 !important; color: var(--color-dark-olive) !important; line-height: 1.3; margin-bottom: 4px; }
  table tr td:nth-child(1) { order: 3; font-size: 12px; color: var(--color-text-light) !important; margin-bottom: 10px; }
  table tr td:nth-child(4) { order: 4; font-size: 13.5px; margin-bottom: 16px; line-height: 1.5; }
  table tr td:nth-child(5) { order: 5; border-top: 1px dashed var(--color-warm-sand) !important; padding-top: 14px !important; }
  
  .actions-cell-wrapper { justify-content: flex-end; }
  
  /* Penyesuaian tombol paginasi */
  .table-footer { padding: 16px; background: var(--color-white); border-radius: var(--radius-md); border: 1px solid var(--color-warm-sand); }
}