/* ============================================================================
   SWIFTTRAP FOR MAILTRAP - ADMIN STYLES
   ============================================================================ */

/* Grid layout for dashboard cards */
.wrap .swifttrap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
  margin-top: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .wrap .swifttrap-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* Cards */
.wrap .swifttrap-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease;
}

.wrap .swifttrap-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wrap .swifttrap-card h2 {
  margin-top: 0;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wrap .swifttrap-card h3 {
  margin: 0 0 6px 0;
  padding: 0 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: #1d2327;
  border-left: 3px solid #0073aa;
  line-height: 1.4;
}

.wrap .swifttrap-card h3 + p {
  margin: 0 0 20px 0;
  font-size: 13px;
  color: #888;
  line-height: 1.5;
}

.wrap .swifttrap-card p {
  margin: 10px 0;
}

/* Form inputs */
.wrap input[type="text"],
.wrap input[type="email"],
.wrap input[type="password"],
.wrap input[type="number"],
.wrap input[type="date"],
.wrap textarea,
.wrap select {
  width: 100%;
  max-width: 400px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: #333;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.wrap input[type="text"]:focus,
.wrap input[type="email"]:focus,
.wrap input[type="password"]:focus,
.wrap input[type="number"]:focus,
.wrap input[type="date"]:focus,
.wrap textarea:focus,
.wrap select:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1);
}

.wrap input[type="number"] {
  max-width: 80px;
}

/* Checkboxes */
.wrap input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

/* Code blocks */
.wrap code {
  background: #f4f4f4;
  color: #333;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: Courier, "Courier New", monospace;
  font-size: 13px;
}

/* Descriptions inherit from WordPress */
.wrap .description {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

/* Tables */
.wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.wrap table th,
.wrap table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.wrap table th {
  background: #f9f9f9;
  font-weight: 600;
  color: #333;
}

.wrap table tbody tr:hover {
  background: #f9f9f9;
}

/* Form field group */
.swifttrap-field-group {
  margin-bottom: 0;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f1;
}

.swifttrap-field-group:first-child {
  padding-top: 0;
}

.swifttrap-field-group:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* Form label */
.swifttrap-field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: #1d2327;
  letter-spacing: 0.01em;
}

/* Checkbox label with flex alignment */
.swifttrap-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: #333;
  padding: 6px 12px;
  border-radius: 4px;
  background: #f6f7f7;
  transition: background 0.15s ease;
}

.swifttrap-checkbox-label:hover {
  background: #eef0f1;
}

.swifttrap-checkbox-label input[type="checkbox"] {
  margin: 0;
}

/* Help text for fields */
.swifttrap-field-help {
  margin: 6px 0 0 0;
  font-size: 12px;
  color: #888;
  line-height: 1.5;
}

/* Form input full width */
.swifttrap-input-full {
  width: 100%;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: #fbfbfb;
  transition: border-color 0.2s, background 0.2s;
}

.swifttrap-input-full:focus {
  background: #fff;
}

/* Form input small width (numbers) */
.swifttrap-input-small {
  width: 100%;
  max-width: 80px;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: #fbfbfb;
  transition: border-color 0.2s, background 0.2s;
}

.swifttrap-input-small:focus {
  background: #fff;
}

/* Monospace input for endpoints */
.swifttrap-input-mono {
  font-family: Courier, "Courier New", monospace;
}

/* Status indicators */
.swifttrap-status-enabled {
  color: green;
}

.swifttrap-status-disabled {
  color: red;
}

.swifttrap-status-warning {
  color: orange;
}

/* Info section with heading and content */
.swifttrap-info-block {
  margin-bottom: 15px;
}

.swifttrap-info-block:last-child {
  margin-bottom: 0;
}

.swifttrap-info-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.swifttrap-info-value {
  font-weight: 600;
  color: #333;
}

/* Account info display */
.swifttrap-account-section {
  margin-bottom: 15px;
}

.swifttrap-account-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.swifttrap-account-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* Stats grid (2 columns below account info) */
.swifttrap-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

/* Dashboard header with timezone */
.swifttrap-table-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.swifttrap-table-header h2 {
  margin: 0;
  padding: 0;
}

/* Logs table wrapper */
.swifttrap-logs-wrapper {
  overflow-x: auto;
}

.swifttrap-logs-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.swifttrap-logs-table thead tr {
  border-bottom: 2px solid #eee;
}

.swifttrap-logs-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
}

.swifttrap-logs-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  color: #666;
  font-size: 12px;
}

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

/* Column widths */
.swifttrap-col-to {
  width: 30%;
}

.swifttrap-col-from {
  width: 20%;
}

.swifttrap-col-date {
  width: 25%;
}

.swifttrap-col-status {
  width: 15%;
}

.swifttrap-col-http {
  width: 10%;
}

.swifttrap-log-to {
  color: #333;
}

.swifttrap-log-from {
  color: #666;
}

.swifttrap-log-date {
  color: #666;
  font-size: 12px;
}

.swifttrap-log-status {
  font-weight: bold;
}

.swifttrap-log-http {
  color: #999;
}

.swifttrap-log-email {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pagination section */
.swifttrap-pagination {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center;
}

.swifttrap-pagination-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

.swifttrap-pagination-info {
  color: #666;
  font-size: 12px;
  margin: 0;
}

/* ============================================================================
   SETTINGS SUBMIT AREA
   ============================================================================ */

.wrap .swifttrap-grid + .submit {
  margin-top: 10px;
  padding-top: 0;
}

.wrap .swifttrap-grid + .submit .button-primary {
  padding: 6px 24px;
  font-size: 14px;
  border-radius: 4px;
  min-height: 36px;
}

/* ============================================================================
   CATEGORY BADGES
   ============================================================================ */

.swifttrap-category-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 3px;
  background: #f0f0f1;
  color: #50575e;
}

.swifttrap-category-badge--empty {
  color: #999;
  background: none;
  padding: 0;
}

/* ============================================================================
   LOG STATUS COLORS
   ============================================================================ */

.swifttrap-log-status--success {
  color: #28a745;
}

.swifttrap-log-status--failed {
  color: #dc3545;
}

/* ============================================================================
   TEST EMAIL RESULT
   ============================================================================ */

.swifttrap-test-result {
  margin-left: 10px;
}

.swifttrap-test-result--success {
  color: #28a745;
}

.swifttrap-test-result--error {
  color: #dc3545;
}

/* ============================================================================
   LOGS HEADER (flex with h2, button, timezone)
   ============================================================================ */

.swifttrap-logs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.swifttrap-logs-header h2 {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

.swifttrap-logs-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.swifttrap-logs-header .swifttrap-timezone {
  font-size: 12px;
  color: #666;
}

/* ============================================================================
   LOGS SECTION WRAPPER
   ============================================================================ */

.swifttrap-logs-section {
  margin-top: 30px;
}

/* ============================================================================
   DASHBOARD WIDGET
   ============================================================================ */

.swifttrap-widget-info {
  margin-bottom: 15px;
}

.swifttrap-widget-info .swifttrap-info-value {
  font-size: 14px;
}

.swifttrap-widget-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.swifttrap-widget-stats .swifttrap-info-value {
  font-size: 14px;
}

/* ============================================================================
   QUOTA BAR (progress bar for monthly usage)
   ============================================================================ */

.swifttrap-quota-bar {
  width: 100%;
  height: 20px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}

.swifttrap-quota-bar__fill {
  height: 100%;
  background: #0073aa;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.swifttrap-quota-bar__fill--warning {
  background: #f0ad4e;
}

.swifttrap-quota-bar__fill--critical {
  background: #dc3545;
}

.swifttrap-quota-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
  margin-top: 6px;
}

/* ============================================================================
   STATS SUMMARY (success/failed/rate cards)
   ============================================================================ */

.swifttrap-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.swifttrap-stats-summary__item {
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 4px;
  text-align: center;
  background: #fafafa;
}

.swifttrap-stats-summary__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  font-weight: 600;
  margin-bottom: 6px;
}

.swifttrap-stats-summary__value {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

.swifttrap-stats-summary__value--success {
  color: #28a745;
}

.swifttrap-stats-summary__value--failed {
  color: #dc3545;
}

.swifttrap-stats-summary__sub {
  display: block;
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* ============================================================================
   CATEGORY LIST (categories with counts)
   ============================================================================ */

.swifttrap-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.swifttrap-category-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f1;
  font-size: 13px;
}

.swifttrap-category-list li:last-child {
  border-bottom: none;
}

.swifttrap-category-list .swifttrap-category-count {
  font-weight: 600;
  color: #333;
  min-width: 30px;
  text-align: right;
}

/* ============================================================================
   DAILY CHART (CSS bar chart - 7 days)
   ============================================================================ */

.swifttrap-daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  margin-top: 10px;
  padding-top: 10px;
}

.swifttrap-daily-chart__bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.swifttrap-daily-chart__bar-fill {
  width: 100%;
  background: #0073aa;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.swifttrap-daily-chart__labels {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.swifttrap-daily-chart__labels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: #999;
}

/* ============================================================================
   SENDING DOMAINS
   ============================================================================ */

.swifttrap-domain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.swifttrap-domain-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f1;
}

.swifttrap-domain-list li:last-child {
  border-bottom: none;
}

.swifttrap-domain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.swifttrap-domain-name {
  font-weight: 600;
  font-size: 13px;
  color: #1d2327;
}

.swifttrap-domain-status--verified {
  color: #28a745;
  font-weight: 600;
  font-size: 12px;
}

.swifttrap-domain-status--pending {
  color: #f0ad4e;
  font-weight: 600;
  font-size: 12px;
}

.swifttrap-domain-status--failed {
  color: #dc3545;
  font-weight: 600;
  font-size: 12px;
}

.swifttrap-dns-records {
  display: flex;
  gap: 8px;
  font-size: 11px;
  margin-top: 4px;
}

.swifttrap-dns-pass {
  color: #28a745;
}

.swifttrap-dns-fail {
  color: #dc3545;
}

/* ============================================================================
   SUPPRESSIONS
   ============================================================================ */

.swifttrap-suppressions-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}

.swifttrap-suppressions-summary .swifttrap-stats-summary__item {
  padding: 10px;
}

.swifttrap-suppression-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.swifttrap-suppression-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f1;
  font-size: 12px;
}

.swifttrap-suppression-list li:last-child {
  border-bottom: none;
}

.swifttrap-suppression-email {
  color: #333;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.swifttrap-suppression-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swifttrap-suppression-date {
  color: #999;
  font-size: 11px;
}

.swifttrap-suppression-reason {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
}

.swifttrap-suppression-reason--bounce {
  background: #fce4e4;
  color: #dc3545;
}

.swifttrap-suppression-reason--complaint {
  background: #fff3cd;
  color: #856404;
}

.swifttrap-suppression-reason--unsubscribe {
  background: #e9ecef;
  color: #6c757d;
}

.swifttrap-suppression-reason--manual {
  background: #f0f0f1;
  color: #999;
}

.swifttrap-suppression-bounce-cat {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 3px;
  background: #f8d7da;
  color: #721c24;
  font-weight: 600;
  text-transform: uppercase;
}

/* ============================================================================
   AJAX LOADING STATES
   ============================================================================ */

@keyframes swifttrap-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.swifttrap-loading {
  color: #666;
  animation: swifttrap-pulse 1.5s ease-in-out infinite;
}

.swifttrap-card__body {
  min-height: 60px;
}

.swifttrap-error {
  color: #dc3545;
  font-size: 13px;
}

/* ============================================================================
   DASHBOARD WIDGET ACTIONS
   ============================================================================ */

.swifttrap-widget-actions {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #eee;
  margin-top: 12px;
}

/* ============================================================================
   MODAL POPUP STYLES
   ============================================================================ */
.swifttrap-modal {
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
}

.swifttrap-modal-content {
  background-color: #fff;
  padding: 24px;
  border: 1px solid #ddd;
  border-radius: 6px;
  width: 90%;
  max-width: 750px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
  position: relative;
  box-sizing: border-box;
}

.swifttrap-modal-close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  right: 18px;
  top: 12px;
  line-height: 1;
}

.swifttrap-modal-close:hover,
.swifttrap-modal-close:focus {
  color: #333;
}

.swifttrap-modal-body-content {
  margin-top: 15px;
}

/* Additional Log Status Classes */
.swifttrap-log-status--delivered {
  color: #28a745;
}

.swifttrap-log-status--bounced {
  color: #dc3545;
}

.swifttrap-log-status--spam {
  color: #ffc107;
}

.swifttrap-log-status--opened {
  color: #007bff;
}

.swifttrap-log-status--clicked {
  color: #17a2b8;
}

/* Email Logs table */
.swifttrap-card--full {
  grid-column: 1 / -1;
}

.swifttrap-email-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  background: #f0f0f1;
  color: #50575e;
}

.swifttrap-status--delivered { background: #d4edda; color: #155724; }
.swifttrap-status--opened    { background: #cce5ff; color: #004085; }
.swifttrap-status--clicked   { background: #d1ecf1; color: #0c5460; }
.swifttrap-status--bounced   { background: #f8d7da; color: #721c24; }
.swifttrap-status--spam      { background: #fff3cd; color: #856404; }
.swifttrap-status--unsub     { background: #e2e3e5; color: #383d41; }
