/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #f0f2f5;
  color: #333;
  line-height: 1.6;
}

/* ===== Dashboard Header ===== */
.dashboard-header {
  background-color: #1a1a2e;
  color: #fff;
  padding: 16px 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dashboard-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ===== Dashboard Main ===== */
.dashboard-main {
  max-width: 100%;
  margin: 24px auto;
  padding: 0 24px;
}

/* ===== Tab Navigation ===== */
.tab-navigation {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 24px;
  border: none;
  background: transparent;
  color: #6c757d;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: #16213e;
}

.tab-btn.active {
  color: #16213e;
  border-bottom-color: #0f3460;
  font-weight: 600;
}

/* ===== Tab Content ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Filter Controls ===== */
.filter-controls {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filter-group input,
.filter-group select {
  padding: 7px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #333;
  background-color: #fff;
  transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #0f3460;
  box-shadow: 0 0 0 2px rgba(15, 52, 96, 0.15);
}

.filter-actions {
  justify-content: flex-end;
}

.btn-clear-filter {
  padding: 7px 16px;
  background-color: #6c757d;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-clear-filter:hover {
  background-color: #5a6268;
}

/* ===== Override DataTables max-width ===== */
.dataTables_wrapper,
.dashboard-main .dataTables_wrapper,
div.dataTables_wrapper {
  max-width: none !important;
  width: 100% !important;
}

.dashboard-main * {
  max-width: none !important;
}

/* ===== Table Container ===== */
.table-container {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.table-container table.dataTable {
  width: 100% !important;
}

.table-container table.dataTable thead th {
  background-color: #f8f9fa;
  color: #495057;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

.table-container table.dataTable tbody td {
  font-size: 0.875rem;
  vertical-align: middle;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Status Badges ===== */
[class^="badge-"] {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success {
  background-color: #d4edda;
  color: #155724;
}

.badge-error {
  background-color: #f8d7da;
  color: #721c24;
}

.badge-pending {
  background-color: #fff3cd;
  color: #856404;
}

/* ===== Error Category Badges ===== */
.badge-client-error {
  background-color: #ffe0b2;
  color: #e65100;
}

.badge-server-error {
  background-color: #f8d7da;
  color: #b71c1c;
}

.badge-timeout-error {
  background-color: #e1bee7;
  color: #6a1b9a;
}

.badge-connection-error {
  background-color: #ffcdd2;
  color: #880e4f;
}

.badge-gateway-error {
  background-color: #bbdefb;
  color: #0d47a1;
}

/* ===== Resend Button ===== */
.btn-resend {
  padding: 5px 14px;
  background-color: #0f3460;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.btn-resend:hover {
  background-color: #16213e;
}

/* ===== Ignore Button ===== */
.btn-ignore {
  padding: 5px 14px;
  background-color: #6c757d;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
  margin-left: 4px;
}

.btn-ignore:hover {
  background-color: #5a6268;
}

.action-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 90%;
  max-width: 540px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.modal-content h2 {
  font-size: 1.15rem;
  margin-bottom: 16px;
  color: #1a1a2e;
}

.modal-details {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  max-height: 260px;
  overflow-y: auto;
  word-break: break-all;
}

.modal-details p {
  margin-bottom: 6px;
}

.modal-details strong {
  color: #495057;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-confirm {
  padding: 8px 20px;
  background-color: #0f3460;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-confirm:hover {
  background-color: #16213e;
}

.btn-cancel {
  padding: 8px 20px;
  background-color: #e9ecef;
  color: #495057;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-cancel:hover {
  background-color: #dee2e6;
}

/* ===== Notification Area ===== */
.notification-area {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.notification {
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
}

.notification.success {
  background-color: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.notification.error {
  background-color: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Stack Trace Truncation ===== */
.stack-trace-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}

.stack-trace-cell:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  background: #1a1a2e;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  max-width: 400px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  word-break: break-all;
}

/* ===== Responsive Tweaks ===== */
@media (max-width: 768px) {
  .dashboard-header {
    padding: 12px 16px;
  }

  .dashboard-main {
    padding: 0 12px;
    margin: 12px auto;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .tab-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}
