/* ── DM Sans font-face (self-hosted, variable font) ── */

/* latin-ext */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Icon font for theme toggle ── */

@font-face {
  font-family: 'Icons';
  src: url('/fonts/modes.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── CSS custom properties (theming) ── */

:root {
  /* Shared (same in both themes) */
  --brand: #F24822;
  --brand-hover: #F24822cc;
  --gap: 32px;

  /* Light theme defaults */
  --bg-body: #FFFFFF;
  --bg-paper: #FFFFFF;
  --text-primary: #121110;
  --text-secondary: #6D6D6C;
  --border-primary: rgba(0,0,0,0.12);
  --input-border: rgba(0,0,0,0.23);
  --input-border-hover: rgba(0,0,0,0.5);
  --logo: #121110;
  --nav-bg: rgba(0,0,0,0.04);
  --nav-border: rgba(0,0,0,0.16);
  --nav-color: #121110;
  --nav-bg-hover: rgba(0,0,0,0.08);
  --mode-icon: 'A';
  --bg-layer1: #00000005;
}

[data-theme="dark"] {
  --bg-body: #121110;
  --bg-paper: #1E1D1C;
  --text-primary: #FFFFFF;
  --text-secondary: #8C8B8B;
  --border-primary: rgba(255,255,255,0.12);
  --input-border: rgba(242,72,34,0.3);
  --input-border-hover: rgba(242,72,34,0.5);
  --logo: #FFFFFF;
  --nav-bg: rgba(255,255,255,0.06);
  --nav-border: rgba(255,255,255,0.16);
  --nav-color: #FFFFFF;
  --nav-bg-hover: rgba(255,255,255,0.12);
  --bg-layer1: #FFFFFF05;
  --mode-icon: 'B';
}

/* ── Reset & base ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-body);
  transition: background-color 0.2s, color 0.2s;
}

/* ── Typography ── */

h4 { font-weight: 500; font-size: 1.5rem; }
h5 { font-weight: 500; font-size: 1.125rem; }

@media (min-width: 768px) {
  :root {
    --gap: 40px;
  }
}

a { color: inherit; text-decoration: none; }

/* ── Layout ── */

.header {
  width: 100%;
  background: var(--bg-body);
  z-index: 10;
}

.header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--gap);
}

.logo-link {
  display: flex;
  background: none;
  transition: opacity 0.3s ease;
}
#header-logo path {
  fill: var(--logo);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* ── Nav pill (header button) ── */

.nav-pill {
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  color: var(--nav-color);
  padding: 2px 12px;
  border-radius: 48px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.3s ease;
  cursor: pointer;
}
.nav-pill-active {
  background: var(--brand);
  color: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.24);
}
/* ── Theme toggle (icon font) ── */

.mode-toggle {
  font-family: 'Icons', sans-serif;
  color: var(--nav-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: opacity 0.3s ease, color 0.3s ease;
  background: none;
  border: none;
  padding: 0;
}
.mode-toggle::before {
  content: var(--mode-icon);
  font-size: 22px;
  line-height: 22px;
  transition: all 0.3s ease;
}
.mode-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  max-width: min(720px, calc(100% - 32px));
  margin: 0 auto 16px;
  padding: 32px 24px;
  background: var(--bg-layer1);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.75;
  padding: 6px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-transform: none;
  text-decoration: none;
  transition: background-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.btn-primary {
  background-color: var(--brand);
  color: #FFFFFF;
  box-shadow: none;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 8px;
}
/* ── Form elements ── */

.text-field {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}
.text-field:focus {
  border-color: var(--brand);
}
.text-field::placeholder {
  color: var(--text-secondary);
}

.textarea {
  resize: vertical;
  min-height: 120px;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.field-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.field-error {
  font-size: 0.75rem;
  color: #FF5252;
  margin-top: 4px;
}

/* ── Radio group ── */

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0;
  border: none;
}

.radio-group legend {
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  width: 100%;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.radio-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--brand);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
}

.radio-label input[type="radio"]:checked::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--brand);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── Checkbox ── */

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--brand);
  border-radius: 1px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
  background-color: var(--brand);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ── Dropzone ── */

.dropzone {
  border: 2px dashed var(--input-border);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.dropzone.drag-active {
  border-color: var(--brand);
  background-color: rgba(242,72,34,0.05);
}
.dropzone h4 {
  margin-bottom: 8px;
}
.dropzone .caption {
  font-size: 0.875rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  padding: 5px 0;
}
.dropzone .upload-icon {
  color: var(--brand);
  margin: 20px 0;
}
.dropzone .upload-icon svg {
  width: 80px;
  height: 80px;
}

/* ── Result list ── */

.result-title {
  margin-bottom: 16px;
}
.result-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}
.result-actions {
  margin-top: 32px;
}
.result-label {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.result-field {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: transparent;
}
.result-value {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  padding: 10px 12px;
  font-size: 0.875rem;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-left: 1px solid var(--border-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}
.copy-btn.copied {
  color: #66BB6A;
}

/* ── Secret preformatted text (inside result-field) ── */

.result-field-pre {
  align-items: stretch;
}
.result-field-pre .copy-btn {
  align-self: flex-start;
  height: auto;
  min-height: 40px;
}
.result-pre {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: monospace, monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-all;
  margin: 0;
}

/* ── Error reasons ── */

.error-reasons {
  margin-top: 16px;
}
.error-reasons h5 {
  margin-top: 12px;
  margin-bottom: 4px;
}

/* ── Alert ── */

.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}
.alert-error {
  background-color: rgba(255,82,82,0.06);
  color: #D32F2F;
  border: 1px solid rgba(255,82,82,0.3);
}
.alert-success {
  background-color: rgba(102,187,106,0.06);
  color: #2E7D32;
  border: 1px solid rgba(102,187,106,0.3);
}
/* ── Modal (native dialog) ── */

dialog.modal {
  border: none;
  border-radius: 8px;
  box-shadow: 0px 0px 15px rgba(242,72,34,0.5);
  background-color: var(--bg-paper);
  color: var(--text-primary);
  padding: 24px;
  max-width: min(440px, calc(100% - 32px));
  margin: auto;
}
dialog.modal::backdrop {
  background-color: rgba(0,0,0,0.5);
}
dialog.modal h4 {
  margin-bottom: 12px;
}
dialog.modal p {
  margin-bottom: 20px;
  color: var(--text-primary);
}
dialog.modal .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── View-specific ── */

.options-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 8px;
}

.password-field {
  max-width: 300px;
  margin-top: 8px;
}

.submit-area {
  display: flex;
  justify-content: flex-start;
  padding: 16px 0 32px;
}

.secret-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.spacing-top { margin-top: 16px; }

/* ── Utility ── */

.hidden { display: none; }

/* ── Hover (pointer devices only) ── */

@media (hover: hover) {
  a:hover { color: inherit; }
  .logo-link:hover { opacity: 0.64; }
  .nav-pill:hover {
    background: var(--nav-bg-hover);
    color: var(--nav-color);
  }
  .nav-pill-active:hover {
    background: var(--brand);
    color: #FFFFFF;
    opacity: 0.8;
  }
  .mode-toggle:hover { opacity: 0.65; }
  .btn-primary:hover {
    background-color: var(--brand-hover);
    box-shadow: 0px 2px 4px rgba(0,0,0,0.2);
  }
  .btn-text:hover { color: var(--text-primary); }
  .text-field:hover { border-color: var(--input-border-hover); }
  .dropzone:hover {
    border-color: var(--brand);
    background-color: rgba(242,72,34,0.05);
  }
  .copy-btn:hover { color: var(--text-primary); }
}
