/* admin-email-gateways.css — Email Gateways tab styles
   Uses standard app theme tokens (var(--bg), var(--border), var(--text) etc.)
   so it renders correctly in every theme including the default light theme.
   Class prefix: eg- (email gateway)
*/

/* ── Header ─────────────────────────────────────────────────────────────────── */
.eg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.eg-header h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.eg-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Loading / error states ──────────────────────────────────────────────────── */
.eg-loading {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.eg-error {
  padding: 16px;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  font-size: 0.85rem;
}

/* ── Gateway list ────────────────────────────────────────────────────────────── */
.eg-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Individual gateway card ─────────────────────────────────────────────────── */
.eg-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.18s;
}
.eg-card-active {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}

.eg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

/* ── Provider info ───────────────────────────────────────────────────────────── */
.eg-provider-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.eg-provider-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}
.eg-provider-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Active badge ────────────────────────────────────────────────────────────── */
.eg-active-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #22c55e;
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
}

/* ── Test badge ──────────────────────────────────────────────────────────────── */
.eg-test-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 3px 10px 6px;
  color: var(--muted);
}
.eg-test-badge.ok    { color: #16a34a; }
.eg-test-badge.fail  { color: #dc2626; }
.eg-test-badge.untested { font-style: italic; }

/* ── Card action buttons ─────────────────────────────────────────────────────── */
.eg-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.eg-set-active-btn  { font-size: 0.8rem; }
.eg-toggle-config-btn { font-size: 0.8rem; }

/* ── Config panel (collapsible) ──────────────────────────────────────────────── */
.eg-config-panel {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Form fields ─────────────────────────────────────────────────────────────── */
.eg-field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eg-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.eg-key-status {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}
.eg-input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.18s;
  outline: none;
}
.eg-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.eg-hint {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.4;
}
.eg-docs-link {
  color: var(--blue);
  text-decoration: none;
  margin-left: 4px;
}
.eg-docs-link:hover {
  text-decoration: underline;
}

/* ── Config footer: save + test row ─────────────────────────────────────────── */
.eg-config-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eg-test-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}
.eg-test-input {
  flex: 1;
  min-width: 0;
}

/* ── Feedback message ────────────────────────────────────────────────────────── */
.eg-feedback {
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg3, var(--bg2));
  color: var(--text);
  margin-top: -4px;
}
.eg-feedback.ok   { background: rgba(34, 197, 94, 0.1);  color: #16a34a; }
.eg-feedback.fail { background: rgba(220, 38, 38, 0.1);  color: #dc2626; }

/* ── Email send log ──────────────────────────────────────────────────────────── */
.eg-log-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.eg-log-wrap {
  overflow-x: auto;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .eg-card-header    { flex-wrap: wrap; }
  .eg-card-actions   { flex-wrap: wrap; width: 100%; }
  .eg-config-footer  { flex-direction: column; align-items: stretch; }
  .eg-test-row       { min-width: 0; width: 100%; }
}
