/* Encoders: styles for the URL Encoder/Decoder, Base64 Encoder/Decoder and UUID Generator pages.
   Shared styles live in /tools/shared/tools.css. Everything here uses the tokens from tokens.css. */

html,
body {
  overflow-x: clip;
}
.enc-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.enc-page .workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-4) var(--space-16);
}
.enc-noscript {
  max-width: 880px;
  color: var(--color-text);
}
[hidden] {
  display: none !important;
}

/* The card */
.enc-card {
  width: 100%;
  max-width: 880px;
  padding: var(--space-6);
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
}

/* Row of controls: segmented choices, checkboxes and buttons */
.enc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-6);
  margin-bottom: var(--space-4);
}
.enc-ctl {
  min-width: 0;
}
.enc-ctl .field-label {
  padding-top: 0;
}
.enc-ctl .segmented {
  min-width: 11rem;
}
.enc-ctl .segmented button {
  cursor: pointer;
  white-space: nowrap;
}
.enc-ctl .segmented button:hover:not([aria-pressed="true"]) {
  color: var(--color-ink);
}
.enc-ctl .segmented button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.enc-ctl .segmented button:not(:disabled):active {
  transform: scale(0.97);
}
.enc-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  align-items: center;
}
.enc-checks .check-row {
  padding-block: var(--space-3);
}
.enc-checks .check-row.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Two panes: input and output */
.enc-panes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-6);
}
.enc-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.enc-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 2rem;
}
.enc-pane-head .field-label {
  padding-block: 0;
}
.enc-pane .textarea {
  min-height: 14rem;
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  word-break: break-all;
}
.enc-pane .textarea[readonly] {
  cursor: text;
}
.enc-pane .textarea.is-invalid,
.enc-pane .textarea.is-invalid:focus-visible {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 1px var(--color-danger);
}
.enc-pane .textarea:focus-visible[readonly] {
  border-color: var(--color-accent);
}
.enc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.enc-actions .btn {
  min-width: 0;
}

/* Status line under the panes. The text is announced as it changes. */
.enc-status {
  min-height: 1.25rem;
  margin: var(--space-3) var(--space-1) 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}
.enc-status.is-error {
  color: var(--color-danger);
}
.enc-status.is-note {
  color: var(--color-warning);
}
.enc-status code,
.enc-code {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

/* File picker area for Base64 file mode */
.enc-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 14rem;
  padding: var(--space-6);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: transparent;
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-sm);
  transition: background-color var(--duration), border-color var(--duration);
}
.enc-drop:hover {
  background: var(--color-field);
}
.enc-drop.is-over {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}
.enc-drop.has-file {
  border-style: solid;
}
.enc-drop .enc-file-name {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--color-ink);
  font-weight: var(--weight-bold);
}
.enc-drop input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.enc-preview {
  max-width: 100%;
  max-height: 6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

/* UUID: quantity and output */
.enc-qty {
  width: 8.5rem;
}
.enc-uuid-out .textarea {
  min-height: 18rem;
}
.enc-stat {
  font-size: var(--text-sm);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .enc-card {
    padding: var(--space-4);
  }
  .enc-panes {
    grid-template-columns: minmax(0, 1fr);
  }
  .enc-pane .textarea {
    min-height: 10rem;
  }
  .enc-ctl,
  .enc-ctl .segmented {
    width: 100%;
  }
  .enc-bar {
    gap: var(--space-1) var(--space-4);
  }
  .enc-actions .btn {
    flex: 1 1 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .enc-drop,
  .enc-ctl .segmented button {
    transition: none;
  }
}

/* Choose-file button: the real input is visually hidden, so show focus on the button */
.enc-drop .btn {
  position: relative;
}
.enc-drop .btn:has(input:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.enc-drop .btn:active {
  transform: scale(0.97);
}
