/* MBUS — Mail Bus admin tab styles. Block 9 of task 365. */

.mbus-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sub-tabs */
.mbus-subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-2, #122030);
  padding-bottom: 0;
}
.mbus-subtab {
  background: transparent;
  border: none;
  color: rgba(234, 242, 255, 0.55);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.mbus-subtab:hover {
  color: rgba(234, 242, 255, 0.88);
}
.mbus-subtab.is-active {
  color: #4ea4d6;
  border-bottom-color: #4ea4d6;
}

.mbus-pane.is-active {
  display: block;
}

/* Placeholder for Аналитика */
.mbus-placeholder {
  padding: 32px;
  text-align: center;
  color: rgba(234, 242, 255, 0.45);
  font-size: 14px;
}

/* Filter grid layout */
.mbus-filters {
  padding: 12px 14px;
}
.mbus-filters .ra-filter-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr 0.9fr 1.4fr;
  gap: 10px;
  align-items: end;
}
.mbus-filters .ra-active-filters-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.ra-reset-filters {
  font-size: 12px;
  padding: 0 12px;
  min-height: 32px;
  color: rgba(226, 107, 107, 0.85);
  border-color: rgba(226, 107, 107, 0.25);
}
.ra-reset-filters:hover {
  color: #e26b6b;
  border-color: rgba(226, 107, 107, 0.55);
}

/* Table card + hover */
.mbus-table-card {
  overflow: hidden;
  padding: 0;
}
.mbus-table-card .ra-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.mbus-table-card .ra-table th,
.mbus-table-card .ra-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--ra-stroke);
  vertical-align: top;
}
.mbus-table-card .ra-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(6, 17, 34, 0.96);
  color: var(--ra-text-2);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 800;
  text-align: left;
}
.mbus-table-card .ra-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status badges */
.mbus-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 6px;
  white-space: nowrap;
}
.mbus-badge-sent {
  background: rgba(160, 160, 160, 0.18);
  color: rgba(234, 242, 255, 0.65);
}
.mbus-badge-opened {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}
.mbus-badge-clicked {
  background: rgba(78, 164, 214, 0.18);
  color: #4ea4d6;
}
/* Block 15: Очередь status badges */
.mbus-badge-pending {
  background: rgba(251, 146, 60, 0.18);
  color: #fb923c;
}
.mbus-badge-failed {
  background: rgba(248, 113, 113, 0.18);
  color: #f87171;
}
/* B5.3: digest items count badge — "×3" rendered next to subject in «Все рассылки» */
.mbus-badge-count {
  background: rgba(168, 139, 250, 0.18);
  color: #a78bfa;
  margin-left: 4px;
  margin-right: 0;
  cursor: help;
}
.mbus-last-error {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  color: #f87171;
  font-size: 12px;
}
.mbus-outbox-row { cursor: default; }

/* Filter grid for Очередь — 4 columns (no date range) */
.mbus-filters-outbox .ra-filter-grid {
  grid-template-columns: 1.2fr 0.9fr 0.9fr 1.4fr;
}

/* Table states */
.mbus-loading, .mbus-empty, .mbus-error {
  text-align: center;
  padding: 32px;
  color: rgba(234, 242, 255, 0.45);
  font-size: 13px;
}
.mbus-error { color: #e26b6b; }

/* Pagination */
.mbus-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-2, #122030);
}
.mbus-page-info {
  font-size: 12px;
  color: rgba(234, 242, 255, 0.55);
}

/* Safety: .hidden utility (used by JS classList.toggle) */
.hidden { display: none !important; }

/* Row click affordance */
.mbus-row { cursor: pointer; }

/* Slideover — body preview + timeline (Block 10) */
.mbus-slideover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}
.mbus-slideover {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 580px;
  max-width: 100vw;
  background: #0a1828;
  border-left: 1px solid var(--ra-stroke, rgba(255,255,255,.1));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  box-shadow: -8px 0 30px rgba(0,0,0,0.4);
}
.mbus-slideover.is-open { transform: translateX(0); }

.mbus-slideover-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ra-stroke, rgba(255,255,255,.1));
}
.mbus-slideover-meta { flex: 1 1 auto; min-width: 0; }
.mbus-slideover-subject {
  font-size: 15px;
  font-weight: 600;
  color: rgba(234, 242, 255, 0.92);
  margin-bottom: 4px;
  line-height: 1.3;
  word-wrap: break-word;
}
.mbus-slideover-sub {
  font-size: 12px;
  color: rgba(234, 242, 255, 0.55);
  word-break: break-all;
}
.mbus-slideover-close {
  background: transparent;
  border: 1px solid var(--ra-stroke, rgba(255,255,255,.1));
  color: rgba(234, 242, 255, 0.65);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.mbus-slideover-close:hover { color: #fff; background: rgba(255,255,255,.05); }

.mbus-slideover-tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  border-bottom: 1px solid var(--ra-stroke, rgba(255,255,255,.1));
}
.mbus-slideover-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px 18px;
}
.mbus-slideover-pane:not(.is-active) { display: none; }
.mbus-body-iframe {
  width: 100%;
  height: 65vh;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

/* Timeline */
.mbus-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.mbus-timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(78, 164, 214, 0.25);
}
.mbus-tl-row {
  position: relative;
  padding: 0 0 18px 28px;
}
.mbus-tl-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4ea4d6;
  border: 3px solid #0a1828;
}
.mbus-tl-sent::before    { background: rgba(160,160,160,.6); }
.mbus-tl-opened::before  { background: #4ade80; }
.mbus-tl-clicked::before { background: #4ea4d6; }
.mbus-tl-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(234, 242, 255, 0.92);
}
.mbus-tl-meta {
  font-size: 12px;
  color: rgba(234, 242, 255, 0.55);
  margin-top: 2px;
}
.mbus-tl-url {
  font-size: 12px;
  margin-top: 4px;
  word-break: break-all;
}
.mbus-tl-url a {
  color: #4ea4d6;
  text-decoration: none;
}
.mbus-tl-url a:hover { text-decoration: underline; }
