/* ============================================================
   URL Encoder / Decoder — App Styles
   Accent: teal #0d9488 / #5eead4
   Border: thick-rounded (2px, 12px radius)
   Motion: measured-reveal decode animation
   Signature: teal signal strip on output panel top edge
   ============================================================ */

.url-workbench-page {
  --url-frame-width: 1160px;
  --url-border: rgba(13, 148, 136, 0.28);
  --url-surface: linear-gradient(180deg, rgba(10, 18, 22, 0.98), rgba(6, 13, 17, 0.98));
  --url-surface-soft: linear-gradient(180deg, rgba(12, 22, 24, 0.96), rgba(7, 15, 18, 0.98));
  --url-workbench-surface:
    linear-gradient(90deg, rgba(13, 148, 136, 0.07), transparent 18%, transparent 82%, rgba(94, 234, 212, 0.05)),
    linear-gradient(180deg, rgba(5, 12, 16, 0.98), rgba(3, 9, 12, 0.99));
  --url-accent: #5eead4;
  --url-accent-primary: #0d9488;
  --url-accent-soft: #2dd4bf;
  --url-success: #5eead4;
  --url-warning: #fbbf24;
  --url-error: #f87171;
  --url-ink: #134e4a;
  overflow-x: clip;
}

/* ── Page frame ── */

.url-workbench-page .tool-frame {
  width: 100%;
  max-width: var(--url-frame-width);
  margin-inline: auto;
}

.url-workbench-page .tool-header-block {
  max-width: none;
  margin-inline: 0;
  text-align: left;
  padding-top: 8px;
  padding-bottom: 14px;
}

.url-workbench-page .page-title {
  max-width: none;
  font-size: clamp(36px, 2.7vw, 44px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.url-workbench-page .page-subtitle {
  max-width: 580px;
  margin-inline: 0;
  font-size: 16px;
  line-height: 1.5;
  text-wrap: balance;
}

/* ── Header row (title + lang toggle) ── */

.url-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

/* ── Language toggle ── */

.url-lang-toggle {
  appearance: none;
  border: 2px solid rgba(13, 148, 136, 0.4);
  border-radius: 999px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  background: rgba(13, 148, 136, 0.1);
  color: var(--url-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}

.url-lang-toggle:hover {
  background: rgba(13, 148, 136, 0.2);
  border-color: rgba(94, 234, 212, 0.6);
}

/* ── Workbench outer shell ── */

.url-workbench {
  position: relative;
  padding: 10px;
  border: 2px solid var(--url-border);
  border-radius: 32px;
  background: var(--url-workbench-surface);
  box-shadow: 0 28px 76px rgba(0, 10, 8, 0.52);
}

/* ── Deckbar ── */

.url-deckbar,
.url-panel__meta,
.url-summary__chips,
.url-metrics,
.url-actions,
.url-mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.url-chip,
.url-pill,
.url-summary__chip,
.url-trust-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 2px solid rgba(13, 148, 136, 0.2);
  border-radius: 12px;
  white-space: nowrap;
  background: rgba(6, 14, 14, 0.78);
  color: var(--color-text-muted);
  font-size: 13px;
}

.url-chip {
  color: var(--url-accent-soft);
}

.url-deckbar {
  position: relative;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 2px 10px;
  margin-bottom: 10px;
  border-bottom: 2px solid rgba(13, 148, 136, 0.14);
}

.url-deckbar__eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(94, 234, 212, 0.82);
}

.url-deckbar__title {
  margin: 0;
  font-size: 16px;
  color: rgba(220, 248, 244, 0.96);
}

/* ── Two-column layout ── */

.url-workbench__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

/* ── Panels ── */

.url-panel {
  min-width: 0;
  padding: 14px;
  border-radius: 22px;
  border: 2px solid rgba(13, 148, 136, 0.2);
  background: var(--url-surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 1px 0 rgba(94, 234, 212, 0.03);
}

.url-panel--output {
  background: var(--url-surface-soft);
  position: relative;
  padding-top: 0;
}

.url-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.url-panel__eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--url-accent);
}

.url-panel__hint,
.url-summary__detail {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1.6;
}

.url-panel__hint {
  max-width: 28ch;
}

/* ── Teal signal strip ── */

.url-signal-strip {
  height: 3px;
  margin: 0 -2px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, var(--url-accent-primary), var(--url-accent), var(--url-accent-primary));
  opacity: 0;
  transition: opacity 200ms ease;
}

.url-signal-strip.is-pulsing {
  animation: url-signal-pulse 600ms ease forwards;
}

@keyframes url-signal-pulse {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Output panel inner padding (compensate for signal strip sitting at top) */
.url-panel--output .url-panel__header {
  margin-top: 10px;
}

/* ── Mode toggle buttons ── */

.url-mode {
  appearance: none;
  border: 2px solid rgba(13, 148, 136, 0.22);
  border-radius: 12px;
  min-height: 44px;
  padding: 12px 18px;
  background: rgba(6, 15, 15, 0.84);
  color: rgba(200, 240, 234, 0.8);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.url-mode--active {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.28), rgba(9, 106, 97, 0.2));
  border-color: rgba(94, 234, 212, 0.58);
  color: #ffffff;
}

.url-mode:hover:not(.url-mode--active) {
  border-color: rgba(13, 148, 136, 0.4);
  background: rgba(13, 148, 136, 0.1);
}

.url-trust-pill {
  margin-left: auto;
  color: var(--url-success);
  border-color: rgba(13, 148, 136, 0.3);
}

/* ── Textareas ── */

.url-textarea {
  width: 100%;
  min-height: 220px;
  padding: 15px 16px;
  border-radius: 12px;
  border: 2px solid rgba(13, 148, 136, 0.18);
  background: rgba(8, 16, 16, 0.9);
  color: var(--color-text);
  resize: vertical;
  font: 500 17px/1.65 "IBM Plex Mono", "Cascadia Code", "Fira Code", monospace;
  transition: border-color 160ms ease;
}

.url-textarea:focus {
  outline: none;
  border-color: rgba(13, 148, 136, 0.48);
}

.url-textarea--output {
  background: rgba(5, 11, 12, 0.92);
  min-height: 220px;
}

/* ── Action buttons ── */

.url-action-primary {
  min-width: 156px;
  padding-inline: 24px;
  background: linear-gradient(180deg, #0d9488, #0a7a72);
  border-color: rgba(94, 234, 212, 0.3);
}

.url-action-primary:hover {
  background: linear-gradient(180deg, #0f9e92, #0d9488);
}

/* ── Feedback slot ── */

.url-feedback-slot {
  min-height: 26px;
}

.url-inline-feedback {
  margin: 0;
  font-size: 16px;
  color: var(--color-text-muted);
}

.url-inline-feedback[data-state="success"] { color: var(--url-success); }
.url-inline-feedback[data-state="warning"]  { color: var(--url-warning); }
.url-inline-feedback[data-state="error"]    { color: var(--url-error); }

/* ── Summary block ── */

.url-summary {
  padding: 12px;
  border: 2px solid rgba(13, 148, 136, 0.16);
  border-radius: 12px;
  background: rgba(6, 14, 14, 0.6);
  display: grid;
  gap: 10px;
}

.url-summary__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.url-copy {
  align-self: flex-start;
  min-width: 76px;
}

/* ── Bridge ── */

.url-bridge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 18px;
  overflow: visible;
}

.url-bridge__line {
  width: 2px;
  height: 100%;
  min-height: 320px;
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.12), rgba(94, 234, 212, 0.7), rgba(13, 148, 136, 0.12));
}

.url-bridge__badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid rgba(13, 148, 136, 0.28);
  background: rgba(5, 14, 13, 0.92);
  box-shadow: 0 10px 20px rgba(0, 6, 6, 0.3);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--url-accent-soft);
  white-space: nowrap;
}

.url-bridge__copy {
  margin: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(13, 148, 136, 0.5);
}

/* ── Decode-reveal animation ── */

@keyframes url-char-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.url-textarea--output[data-revealing="true"] {
  /* The reveal is applied via JS-injected spans in a temporary overlay */
  color: transparent;
}

/* ── Inline malformed warning ── */

.url-warn-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--url-warning);
  font-size: 12px;
  vertical-align: middle;
}

/* ============================================================
   Responsive: ≤1024px tablet
   ============================================================ */

@media (max-width: 1024px) {
  .url-workbench-page .tool-header-block {
    padding-bottom: 10px;
  }

  .url-workbench-page .page-title {
    max-width: none;
    font-size: 36px;
  }

  .url-workbench-page .page-subtitle {
    max-width: 480px;
    font-size: 16px;
  }

  .url-workbench {
    padding: 8px;
  }

  .url-deckbar {
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .url-deckbar__eyebrow { font-size: 11px; }
  .url-deckbar__title   { font-size: 15px; }

  .url-chip,
  .url-pill,
  .url-summary__chip,
  .url-trust-pill {
    padding: 6px 10px;
    font-size: 12px;
  }

  .url-panel {
    padding: 12px;
    gap: 8px;
  }

  .url-panel__hint,
  .url-summary__detail {
    font-size: 14px;
  }

  .url-textarea { min-height: 136px; font-size: 16px; }
  .url-textarea--output { min-height: 180px; }

  .url-summary { padding: 10px; }
  .url-summary__detail { display: none; }
  .url-inline-feedback { font-size: 14px; }
  .url-action-primary { min-width: 134px; }
}

/* ============================================================
   Responsive: ≤720px mobile — stack panels
   ============================================================ */

@media (max-width: 720px) {
  .url-workbench-page .tool-frame {
    padding-inline: 6px;
  }

  .url-workbench-page .tool-header-block,
  .url-workbench-page .page-title,
  .url-workbench-page .page-subtitle {
    max-width: none;
  }

  .url-workbench-page .tool-header-block {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-inline: 0;
    text-align: left;
  }

  .url-workbench-page .page-title {
    margin-inline: 0;
    font-size: clamp(27px, 6.2vw, 33px);
    line-height: 1.1;
  }

  .url-workbench-page .page-subtitle {
    font-size: 14px;
  }

  /* Stack panels vertically on mobile */
  .url-workbench__layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Reduce nesting padding on mobile to maximize content area */
  .url-workbench { padding: 6px; border-radius: 20px; }
  .url-panel { padding: 8px; border-radius: 14px; border-width: 1px; }

  /* Mobile textarea min-height per spec */
  .url-textarea { min-height: 160px; }
  .url-textarea--output { min-height: 160px; }

  .url-trust-pill { margin-left: 0; }

  .url-panel__hint { font-size: 14px; max-width: 32ch; }
  .url-panel--input .url-panel__hint,
  .url-panel--output .url-panel__hint { display: none; }

  .url-panel--output { gap: 8px; }
  .url-panel--output .url-panel__header {
    flex-direction: row;
    align-items: center;
  }

  .url-summary__detail { font-size: 14px; }

  .url-copy { font-size: 14px; padding-inline: 12px; }

  .url-feedback-slot { min-height: 0; }

  .url-deckbar { display: none; }
  .url-bridge  { display: none; }
}

/* ============================================================
   Responsive: ≤480px small-mobile
   ============================================================ */

@media (max-width: 480px) {
  .url-workbench-page .tool-frame {
    padding-inline: 6px;
  }

  .url-workbench { padding: 4px; border-radius: 16px; }
  .url-panel { padding: 6px; border-radius: 12px; }

  .url-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .url-actions .button {
    width: 100%;
    min-width: 0;
  }

  .url-action-primary {
    grid-column: 1 / -1;
    order: 3;
  }

  .url-panel__header { flex-direction: column; }

  .url-panel__meta,
  .url-metrics,
  .url-summary__chips { gap: 6px; }

  .url-chip,
  .url-pill,
  .url-summary__chip,
  .url-trust-pill { padding: 5px 8px; font-size: 12px; }
}
