/* =====================================================
   Naleng AutoPOS — Expense Module Styling
   Enterprise | Mobile First | Premium UI
===================================================== */

/* ================= ROOT ================= */

:root {
  --primary: #0f62fe;
  --soft: #f4f7ff;
  --border: #e5e9f2;
  --danger: #e5484d;
  --success: #16a34a;
  --warning: #ffb020;
  --dark: #1e293b;
}

/* ================= TABLE ================= */

.table-wrapper {
  width: 100%;
  overflow: hidden;
  margin-top: 1rem;
}

.expense-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 16px;
}

.expense-table thead {
  background: #f8fafc;
}

.expense-table th {
  text-align: left;
  padding: 0.9rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid var(--border);
}

.expense-table td {
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.expense-table tbody tr:hover {
  background: #f9fafb;
}

.exp-amount {
  font-weight: 700;
}

/* ================= STATUS BADGES ================= */

.exp-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.exp-status.pending {
  background: rgba(255,176,32,0.15);
  color: #7a4b00;
}

.exp-status.approved {
  background: rgba(22,163,74,0.15);
  color: #0f6a2e;
}

.exp-status.rejected {
  background: rgba(229,72,77,0.15);
  color: #8a1b1f;
}

/* ================= ACTION BUTTONS ================= */

.table-actions {
  display: flex;
  gap: 6px;
}

.table-btn {
  border: none;
  background: #f1f5f9;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-btn:hover {
  transform: translateY(-2px);
  background: #e2e8f0;
}

.table-btn.edit { color: var(--primary); }
.table-btn.view { color: var(--dark); }
.table-btn.delete { color: var(--danger); }

/* ================= EMPTY ================= */

.table-empty {
  text-align: center;
  margin-top: 2rem;
  opacity: 0.6;
}

/* =====================================================
   MODAL SYSTEM
===================================================== */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(6px);
  padding: 1rem;
  z-index: 2000;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  animation: modalPop .25s ease;
  overflow: hidden;
}

.modal-small {
  max-width: 400px;
}

@keyframes modalPop {
  from { transform: scale(.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ================= MODAL HEAD ================= */

.modal-head {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title.danger {
  color: var(--danger);
}

/* ================= MODAL BODY ================= */

.modal-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* ================= MODAL FOOT ================= */

.modal-foot {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================= VIEW GRID ================= */

.view-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.view-row {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: #f8fafc;
  border-radius: 12px;
  font-size: 0.9rem;
}

.view-label {
  color: #64748b;
  font-weight: 600;
}

.view-value {
  font-weight: 500;
  color: var(--dark);
}

/* ================= FORM GROUP ================= */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  transition: 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,98,254,0.1);
}

textarea {
  resize: none;
  min-height: 70px;
}

/* ================= DELETE MODAL ================= */

.delete-message {
  font-size: 0.9rem;
}

.delete-highlight {
  margin-top: 6px;
  font-weight: 600;
  color: var(--danger);
}

/* ================= BUTTONS ================= */

/* =====================================================
   PRIMARY BUTTON (Modal-Aligned Styling)
===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 18px;
  border-radius: 14px;
  border: none;

  font-size: 0.85rem;
  font-weight: 600;

  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;

  box-shadow: 0 10px 25px rgba(15,98,254,0.25);
  cursor: pointer;

  transition: all 0.25s ease;
}

/* Hover */
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 35px rgba(15,98,254,0.35);
}

/* Active Click */
.btn:active {
  transform: scale(0.97);
}

/* Icon inside */
.btn i {
  font-size: 0.8rem;
}

/* Ghost button */
.btn.ghost {
  background: #f1f5f9;
  color: #334155;
  box-shadow: none;
}

/* Danger button */
.btn.danger {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  box-shadow: 0 10px 25px rgba(229,72,77,0.25);
}
#addExpenseBtn {
  min-width: 160px;
}


/* ================= ICON BUTTON ================= */

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
}

/* =====================================================
   TOAST SYSTEM
===================================================== */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.toast {
  background: #fff;
  border-left: 5px solid var(--success);
  padding: 1rem;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  display: flex;
  gap: 10px;
  align-items: center;
  animation: toastIn 0.3s ease;
}

.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* =====================================================
   MOBILE RESPONSIVE
===================================================== */

@media (max-width: 768px) {

  .expense-table thead {
    display: none;
  }

  .expense-table,
  .expense-table tbody,
  .expense-table tr,
  .expense-table td {
    display: block;
    width: 100%;
  }

  .expense-table tr {
    background: #fff;
    margin-bottom: 1rem;
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
  }

  .expense-table td {
    border: none;
    padding: 0.4rem 0;
    display: flex;
    flex-direction: column;
  }

  .view-row {
    flex-direction: column;
    align-items: flex-start;
  }

}
/* ================= ACTION BAR ================= */

.debtor-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 1.5rem 0;
  align-items: center;
}

.debtor-filter input,
.debtor-filter select {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background: #fff;
  transition: 0.2s ease;
}

.debtor-filter input:focus,
.debtor-filter select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,98,254,0.1);
}

.debtor-filter .btn {
  white-space: nowrap;
}
/* ==========================================
   FIX ONLY ADD EXPENSE MODAL
========================================== */

#expenseModal {
  padding: 50px; /* more breathing space around */
}

#expenseModal .modal-card {
  max-width: 700px;      /* wider */
  max-height: 75vh;      /* reduce height */
  display: flex;
  flex-direction: column;
}

/* Make body scroll instead of stretching modal */
#expenseModal .modal-body {
  overflow-y: auto;
  max-height: 55vh;   /* control internal height */
}

/* Optional: smoother scroll */
#expenseModal .modal-body::-webkit-scrollbar {
  width: 6px;
}

#expenseModal .modal-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 10px;
}
