/* ── Reset & Base ─────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #F0F3F7; color: #1a1a1a;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
.top-bar {
  background: linear-gradient(135deg, #184290 0%, #1A5BB8 100%);
  padding: 16px 24px;
  box-shadow: 0 4px 20px rgba(24, 66, 144, 0.25);
  position: relative;
  overflow: hidden;
  animation: headerShimmer 3s ease-in-out;
}
.top-bar::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  animation: shimmer 4s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}
@keyframes headerShimmer {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}
.top-bar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.top-bar h1 {
  color: #fff; font-size: 22px; font-weight: 700;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 32px;
  text-align: center;
}
.badge {
  display: inline-block;
  background: rgba(24, 66, 144, 0.06);
  color: rgba(24, 66, 144, 0.6);
  font-size: 11px; font-weight: 500;
  padding: 4px 12px; border-radius: 20px;
  border: 1px solid rgba(24, 66, 144, 0.08);
  letter-spacing: 0.2px;
}

/* ── Layout ──────────────────────────────────────────────────── */
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 24px 40px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid rgba(24, 66, 144, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(24, 66, 144, 0.05);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.card:hover {
  box-shadow: 0 4px 20px rgba(24, 66, 144, 0.1);
}
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 80ms; }
.card:nth-child(3) { animation-delay: 160ms; }
.card:nth-child(4) { animation-delay: 240ms; }
.card:nth-child(5) { animation-delay: 320ms; }

@keyframes slideUp {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

.card.compact { padding: 12px 18px; }
.card.compact h2 { margin: 0 0 8px; }

/* Encoded results gets subtle blue tint */
.card:nth-child(2) {
  background: linear-gradient(135deg, #FAFCFF 0%, #F4F7FC 100%);
  border-left: 3px solid #184290;
}

/* ── Section headings ────────────────────────────────────────── */
h2 {
  font-size: 13px; font-weight: 600; margin: 0 0 10px;
  color: #184290;
  display: flex; align-items: center; gap: 6px;
}
h2::before {
  content: "";
  width: 3px; height: 14px;
  background: #184290;
  border-radius: 2px;
  display: inline-block;
}
/* Skip accent bar for cards that already have left border */
.card:nth-child(2) h2::before { display: none; }

/* ── Rows & Inputs ───────────────────────────────────────────── */
.row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
.row label { font-size: 12px; font-weight: 500; color: #5A6577; }
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1; padding: 10px 12px;
  border: 1px solid #D0D7E2; border-radius: 8px;
  font-size: 13px; background: #FAFBFC;
  transition: all 0.2s ease;
}
.input-row input:focus {
  outline: none;
  border-color: #184290;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(24, 66, 144, 0.1);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 10px 18px;
  border: 1px solid #D0D7E2; border-radius: 8px;
  background: #fff; cursor: pointer;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:hover { background: #F0F3F7; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, #184290 0%, #1A5BB8 100%);
  color: #fff; border-color: #184290;
  box-shadow: 0 2px 8px rgba(24, 66, 144, 0.25);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #1A5BB8 0%, #2066C8 100%);
  box-shadow: 0 4px 14px rgba(24, 66, 144, 0.35);
  transform: translateY(-1px) scale(1.02);
}
.btn.primary:active {
  transform: translateY(0) scale(1);
  box-shadow: 0 1px 4px rgba(24, 66, 144, 0.2);
}
.btn.primary.fetching {
  background: linear-gradient(135deg, #D63031 0%, #E84142 100%);
  border-color: #c0392b;
  box-shadow: 0 2px 8px rgba(214, 48, 49, 0.3);
  animation: pulse 1.5s ease infinite;
}
.btn.primary.fetching:hover { background: linear-gradient(135deg, #c0392b, #D63031); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(214, 48, 49, 0.3); }
  50% { box-shadow: 0 2px 16px rgba(214, 48, 49, 0.5); }
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ── Grid layouts ────────────────────────────────────────────── */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .flabel { min-height: 18px; }
.grid-enc { display: grid; grid-template-columns: 140px 1fr 1fr 1fr; gap: 12px; }
.field-sm textarea.sm { min-height: 44px; }

/* ── Fields & Labels ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 3px; }
.flabel {
  font-size: 11px; font-weight: 500; color: #5A6577;
  display: flex; justify-content: space-between; align-items: center;
}

/* ── Copy buttons ────────────────────────────────────────────── */
.copy {
  border: none; background: transparent; cursor: pointer; font-size: 13px;
  color: #9CA3AF; padding: 2px 6px; border-radius: 4px;
  transition: all 0.2s ease;
}
.copy:hover { background: #E8EFF8; color: #184290; }

/* ── Textareas ───────────────────────────────────────────────── */
textarea {
  width: 100%; min-height: 70px; padding: 8px;
  border: 1px solid #D0D7E2; border-radius: 8px;
  font-family: "SF Mono", Consolas, "Cascadia Code", monospace; font-size: 12px;
  background: #FAFBFC; resize: vertical;
  transition: all 0.2s ease;
}
textarea:focus {
  outline: none;
  border-color: #184290;
  box-shadow: 0 0 0 3px rgba(24, 66, 144, 0.08);
}
#activity, #raw-req { min-height: 110px; }

/* ── Debug Console ───────────────────────────────────────────── */
.console-title { color: #184290; }
.console {
  background: #0d0d0d; color: #33ff66;
  padding: 14px; border-radius: 8px;
  border-top: 3px solid #184290;
  font-family: "SF Mono", Consolas, "Cascadia Code", monospace; font-size: 12px;
  min-height: 140px; max-height: 320px;
  overflow-y: auto; margin: 0;
  white-space: pre-wrap; word-break: break-word;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

/* ── Flash animation ─────────────────────────────────────────── */
.flash { animation: flash 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes flash {
  0% { background: #d4e6ff; box-shadow: 0 0 12px rgba(24, 66, 144, 0.15); }
  100% { background: #FAFBFC; box-shadow: none; }
}

/* ── Loader overlay ──────────────────────────────────────────── */
.loader-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(240, 243, 247, 0.88);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.loader-box {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  animation: loaderIn 0.3s ease;
}
@keyframes loaderIn {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid #D0D7E2; border-top-color: #184290;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text {
  font-size: 14px; font-weight: 500; color: #5A6577;
  min-height: 22px; text-align: center;
  animation: fadeText 0.4s ease;
}
@keyframes fadeText {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.btn.cancel {
  background: linear-gradient(135deg, #D63031, #E84142);
  color: #fff; border-color: #c0392b;
  padding: 8px 24px; font-size: 12px;
  box-shadow: 0 2px 8px rgba(214, 48, 49, 0.2);
}
.btn.cancel:hover {
  background: linear-gradient(135deg, #c0392b, #D63031);
  box-shadow: 0 4px 14px rgba(214, 48, 49, 0.3);
}
