/**
 * Portal overrides — loaded after TailAdmin + DataTables.
 * Fixes: harsh DataTables borders, button chrome, Select2 edges.
 */

/* Modals sit above sidebar; full-screen fixed layer */
.portal-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99990 !important;
}
.select2-container--open {
  z-index: 99995 !important;
}

/* SweetAlert2 — slightly smaller typography + portal variants */
.swal2-popup {
  font-size: 0.875rem !important;
}
.portal-swal-popup {
  border-radius: 1rem !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18) !important;
}
.portal-swal-popup--success .swal2-title {
  color: #14532d !important;
}
.portal-swal-popup--error .swal2-title {
  color: #991b1b !important;
}
.portal-swal-popup .swal2-confirm {
  border-radius: 0.5rem !important;
  padding: 0.5rem 1.25rem !important;
  font-weight: 600 !important;
}
.portal-swal-popup--success .swal2-confirm {
  background: #059669 !important;
}
.portal-swal-popup--error .swal2-confirm {
  background: #dc2626 !important;
}
.swal2-title {
  font-size: 1rem !important;
  font-weight: 600 !important;
}
.swal2-html-container {
  font-size: 0.8125rem !important;
}
.swal2-validation-message {
  font-size: 0.75rem !important;
}

/* ---- Tables (DataTables default uses dark cell borders) ---- */
table.dataTable thead th,
table.dataTable thead td {
  border-bottom: 1px solid #e2e8f0 !important;
  font-weight: 600;
  color: #334155;
}
table.dataTable tbody th,
table.dataTable tbody td {
  border-top: 1px solid #f1f5f9 !important;
  border-left: none !important;
  border-right: none !important;
  color: #334155;
}
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
  background-color: #fafafa !important;
}
table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover {
  background-color: #f8fafc !important;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: #64748b !important;
  font-size: 0.875rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: none !important;
  background: transparent !important;
  color: #475569 !important;
  border-radius: 0.5rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #e0e7ff !important;
  color: #312e81 !important;
  border: none !important;
}
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.5rem !important;
  padding: 0.35rem 0.75rem !important;
  outline: none !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #a5b4fc !important;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.25) !important;
}

/* ---- Select2 ---- */
.select2-container .select2-selection--multiple {
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.5rem !important;
  min-height: 2.75rem !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: #a5b4fc !important;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.2) !important;
}

/* Select2 multi-value tags (recipient / settings emails) */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  margin-top: 0.35rem !important;
  margin-right: 0.35rem !important;
  padding: 0.2rem 0.55rem 0.2rem 0.45rem !important;
  border: none !important;
  border-radius: 9999px !important;
  background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%) !important;
  color: #3730a3 !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: #4f46e5 !important;
  margin-right: 0.2rem !important;
  font-weight: 700 !important;
  border-right: none !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #1e1b4b !important;
  background: transparent !important;
}

/* ---- Fund table row hover (from layout) ---- */
.fund-row-hover tbody tr:hover {
  background: #fef9c3 !important;
  font-weight: 700;
  color: #0f172a;
}

/* ---- Logout: always visible red (TailAdmin build omits many utilities) ---- */
.portal-logout-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  margin: 0;
  border: none;
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff !important;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
  transition: filter 0.15s ease, transform 0.1s ease;
}
.portal-logout-btn:hover {
  filter: brightness(1.06);
}
.portal-logout-btn:active {
  transform: scale(0.99);
}
.portal-logout-btn:focus-visible {
  outline: 2px solid #fca5a5;
  outline-offset: 2px;
}
.portal-logout-btn i {
  color: #fff !important;
}

/* ---- Table action chips (no harsh black outline) ---- */
.btn-action-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff7ed;
  color: #c2410c;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.35);
}
.btn-action-edit:hover {
  background: #ffedd5;
}
.btn-action-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fef2f2;
  color: #b91c1c;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.45);
}
.btn-action-delete:hover {
  background: #fee2e2;
}

/* Alerts table — status toggle (reliable hit target, above row hover) */
#alertsTable button.btn-toggle-alert {
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
#alertsTable button.btn-toggle-alert:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
#alertsTable button.btn-toggle-alert:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}
#alertsTable button.btn-toggle-alert:active {
  transform: scale(0.98);
}

/* ---- Soft panel: use instead of ring + heavy shadow ---- */
.portal-panel {
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.portal-panel-muted {
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
