/* Reset and base styles */
#brevo-app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 14px;
  margin-bottom: 20px;
  color: #666;
}

.breadcrumb a {
  color: #417690;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.kpi-card.clickable {
  cursor: pointer;
  border: 2px solid transparent;
}

.kpi-card.clickable:hover {
  border-color: #417690;
}

.kpi-card.clickable.active {
  border-color: #417690;
  background: #f0f7ff;
}

.kpi-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 32px;
  font-weight: bold;
  color: #333;
}

.kpi-value a {
  color: #417690;
  text-decoration: none;
}

.kpi-value a:hover {
  text-decoration: underline;
}

/* KPI Bar (for filtering) */
.kpi-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.kpi-bar .kpi-card {
  flex: 1;
  min-width: 150px;
  cursor: pointer;
  border: 2px solid transparent;
}

.kpi-bar .kpi-card.active {
  border-color: #417690;
  background-color: #f0f7fa;
}

.kpi-bar .kpi-value {
  font-size: 24px;
}

/* Section */
.section {
  margin-bottom: 40px;
}

.section h2 {
  font-size: 20px;
  margin-bottom: 15px;
  color: #333;
}

/* Messages list */
.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.btn-link {
  color: #417690;
  text-decoration: none;
  font-size: 14px;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table thead {
  background-color: #f5f5f5;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid #ddd;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s;
}

.data-table tbody tr:hover {
  background-color: #f9f9f9;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-sent {
  background-color: #e0e0e0;
  color: #666;
}

.status-delivered {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.status-opened {
  background-color: #e3f2fd;
  color: #1565c0;
}

.status-clicked {
  background-color: #fff3e0;
  color: #e65100;
}

.status-bounced {
  background-color: #ffebee;
  color: #c62828;
}

.status-blocked {
  background-color: #fce4ec;
  color: #880e4f;
}

.status-deferred {
  background-color: #fff9c4;
  color: #f57f17;
}

.status-unsubscribed {
  background-color: #f5f5f5;
  color: #666;
}

/* Rate badges */
.badge.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.badge.warning {
  background-color: #fff3e0;
  color: #e65100;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.badge.danger {
  background-color: #ffebee;
  color: #c62828;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* Search box */
.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  max-width: 400px;
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: #417690;
  box-shadow: 0 0 0 3px rgba(65, 118, 144, 0.1);
}

/* Email detail modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.modal-header h2 {
  font-size: 20px;
  margin: 0 0 8px 0;
  color: #333;
}

.modal-header p {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.modal-close:hover {
  background-color: #f5f5f5;
  color: #333;
}

.modal-body {
  padding: 24px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline-event {
  position: relative;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-left: 2px solid #ddd;
}

.timeline-event:last-child {
  border-left-color: transparent;
  margin-bottom: 0;
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -9px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #417690;
  border: 3px solid white;
  box-shadow: 0 0 0 2px #ddd;
}

.timeline-content {
  padding-left: 16px;
}

.event-title {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  margin-bottom: 4px;
}

.event-time {
  font-size: 13px;
  color: #999;
  margin-bottom: 8px;
}

.event-detail {
  font-size: 13px;
  color: #666;
  margin-top: 6px;
}

.event-detail strong {
  color: #333;
}

.event-detail a {
  color: #417690;
  word-break: break-all;
}

/* Event type colors */
.event-sent .timeline-marker {
  background-color: #9e9e9e;
}

.event-delivered .timeline-marker {
  background-color: #4caf50;
}

.event-opened .timeline-marker {
  background-color: #2196f3;
}

.event-clicked .timeline-marker {
  background-color: #ff9800;
}

.event-bounced .timeline-marker {
  background-color: #f44336;
}

.event-blocked .timeline-marker {
  background-color: #c2185b;
}

/* Bounce type badges */
.bounce-hard {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  background-color: #ffebee;
  color: #c62828;
}

.bounce-soft {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  background-color: #fff3e0;
  color: #e65100;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 20px;
  color: #999;
}

/* Blacklist Management Styles */
.blacklist-dashboard {
  max-width: 1400px;
  margin: 0 auto;
}

.blacklist-tab {
  padding: 20px 0;
}

.alert {
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid;
}

.alert-warning {
  background: #fff3e0;
  border-color: #ff9800;
  color: #555;
}

.alert-success {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #2e7d32;
}

.alert-error {
  background: #ffebee;
  border-color: #f44336;
  color: #c62828;
}

.result-box {
  animation: fadeIn 0.3s ease-in;
}

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

/* Reason badges */
.badge-hard_bounce {
  background-color: #ffebee;
  color: #c62828;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-soft_bounce {
  background-color: #fff3e0;
  color: #e65100;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-complaint {
  background-color: #fce4ec;
  color: #880e4f;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-unsubscribe {
  background-color: #f5f5f5;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-invalid_email {
  background-color: #fce4ec;
  color: #c2185b;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-bar {
    flex-direction: column;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }
}
