/* =========================================================
   COMPONENTS (FINAL ENTERPRISE)
========================================================= */

/* ================= BUTTONS ================= */

.btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

.btn.primary { background: var(--primary); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.danger  { background: var(--danger);  color: #fff; }

/* ================= N/A ================= */

.na-btn {
  background: var(--warning);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
}

.active-na {
  background: #ffccaa;
  border: 1px solid #ff9966;
}

/* ================= TOAST ================= */

#toastContainer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
}

.toast {
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px;
  border-radius: 6px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ================= FILTER SYSTEM (PROFESSIONAL) ================= */

th.filterable {
  position: relative;
}

.filter-icon {
  font-size: 12px;
  margin-left: 6px;
  opacity: 0;
}

th:hover .filter-icon {
  opacity: 1;
}

/* Filtered column indicator */
th.filtered-column {
  border-bottom: 3px solid #f97316 !important;   /* orange underline */
  background: #fff7ed !important;                /* subtle orange tint */
}

th.filtered-column .filter-icon {
  color: #f97316 !important;
  font-weight: bold;
  transform: scale(1.1);
  display: inline-block;
  opacity: 1; /* stay visible without hovering once a filter is active */
}

/* Clear button styling */
.clear-filter-btn {
  margin-left: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  color: #b00020;
  background: transparent;
  border: none;
  display: inline-block;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.clear-filter-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 5000;
  padding: 8px 0;
  min-width: 180px;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  color: #1e293b;                /* ✅ explicit text color */
  font-size: 13px;
  text-transform: uppercase;
}

.filter-dropdown.open {
  display: block;
}

.filter-dropdown label {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  color: #1e293b;                /* ✅ ensure label text is dark */
  background: transparent;
}

.filter-dropdown label:hover {
  background: #f0f0f0;
}

.filter-dropdown input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #0300f6;         /* ✅ checkbox color */
}

.filter-dropdown .select-all {
  border-bottom: 1px solid #e2e8f0;
  font-weight: bold;
}

/* ================= FILTER DROPDOWN PORTAL ================= */
#filter-dropdown-portal {
  pointer-events: none;
}

#filter-dropdown-portal .filter-dropdown {
  pointer-events: auto;
}


/* ================= EXPORT ================= */

.icon-btn {
  cursor: pointer;
}


/* ================= BACK BUTTON ================= */
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  margin-bottom: 16px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.back-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateX(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.back-btn:active {
  transform: translateX(0);
  box-shadow: none;
}

/* ================= EXPIRY AND STATUS COLOURS ================= */
.expiry-red { background-color: #ffcccc !important; }
.expiry-yellow { background-color: #fff3cd !important; }

.row-expired { background-color: #f8d7da !important; }
.row-warning { background-color: #fff3cd !important; }
.row-valid { background-color: #d4edda !important; }

.invoice-status-red,
.invoice-status-red td {
  background-color: #f8d7da !important;
}
.invoice-status-yellow,
.invoice-status-yellow td {
  background-color: #fff3cd !important;
}
.invoice-status-green,
.invoice-status-green td {
  background-color: #d4edda !important;
}

/* Ensure column separators remain visible on colored rows */
.invoice-status-red td,
.invoice-status-yellow td,
.invoice-status-green td {
  border-right: 1px solid rgba(0,0,0,0.2) !important;
}
/* Keep the last column without right border */
.invoice-status-red td:last-child,
.invoice-status-yellow td:last-child,
.invoice-status-green td:last-child {
  border-right: none !important;
}

/* ================= INLINE EDITOR ================= */
.inline-editor {
  width: 100%;
  height: 100%;
  border: 2px solid #0300f6 !important;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  text-transform: uppercase;
  padding: 8px 12px;
  margin: 0;
  background: white;
  box-sizing: border-box;
  border-radius: 2px;
}

/* ================= AUTOCOMPLETE (FINAL – CLEAN VERSION) ================= */
.autocomplete-dropdown {
  position: fixed !important;
  background: white !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  z-index: 999999 !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  font-size: 13px !important;
  text-transform: uppercase !important;
}

.autocomplete-item {
  padding: 8px 12px !important;
  cursor: pointer !important;
  color: #222 !important;
  background: white !important;
  transition: background 0.1s !important;
}

.autocomplete-item:hover {
  background: #e6e6e6 !important;
}

.autocomplete-item.active {
  background: #0300f6 !important;
  color: white !important;
}

.filter-dropdown label {
  pointer-events: auto !important;
  user-select: none;
}
.filter-dropdown input[type="checkbox"] {
  pointer-events: auto !important;
}

/* Visual indicator for selected editable cell (daily trips entry) */
td.selected-cell.editable {
  position: relative;
}
td.selected-cell.editable::after {
  content: "✏️";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 12px;
  opacity: 0.7;
  pointer-events: none;
}

/* Visual indicator for selected editable cell (invoice page) */
td.selected-cell.editable-invoice {
  position: relative;
}
td.selected-cell.editable-invoice::after {
  content: "✏️";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 12px;
  opacity: 0.7;
  pointer-events: none;
}

/* ================= NEW: INVOICE DETAILS BADGE ================= */
.badge-can-invoice {
  display: inline-block;
  padding: 2px 10px;
  background: #e6ffe6;
  color: #1f8a3d;
  border: 1px solid #2e8b57;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  text-transform: uppercase;
}

/* Custom modal */
.custom-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-modal {
  background: white;
  padding: 24px;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.custom-modal h3 { margin-top: 0; }
.custom-modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}