.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.site-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 3.5rem;
  gap: 1.5rem;
}

.site-logo {
  justify-self: start;
}

.site-logo img {
  display: block;
  height: 1.6rem;
  width: auto;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  cursor: pointer;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0;
  box-shadow: var(--shadow);
  min-width: 10rem;
  z-index: 100;
  list-style: none;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.nav-dropdown-menu li a:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.nav-toggle {
  display: none;
  justify-self: end;
  background: none;
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

@media (max-width: 48rem) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    gap: 0.5rem;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-dropdown-menu {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .nav-links a {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    background: #f8fafc;
  }
}

/* Card & Typography Components */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

/* Page title & section headers */
.tool-heading {
  margin: 0 0 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.content-header {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.25rem;
}

.content-header-line {
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 0.875rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 0.85rem;
  line-height: 1.15;
  height: 2rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-light);
}

.btn--outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

.btn--outline:hover {
  background: var(--bg-main);
}

.btn--danger {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn--danger:hover {
  filter: brightness(0.95);
}

.btn--pill {
  border-radius: 999px;
  height: 2rem;
  padding-inline: 1.25rem;
}

.btn--small {
  height: 1.75rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

.btn--wide {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Undo button (used by Dedup and Clean URL) */
.undo-button-container {
  margin-block: 0.5rem;
}

.undo-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.undo-btn:hover:not(:disabled) {
  border-color: var(--primary);
}

.undo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Form controls =====
   A single polished appearance for every input type across all tool pages.
   Scoped to the page content so the header/footer stay untouched.
   Bare (non-classed) controls are normalized too so pages that use
   plain <select>, <input> or <textarea> inherit the same look. */
.select-field,
.page-shell select,
.page-shell input[type='text'],
.page-shell input[type='number'],
.page-shell input[type='email'],
.page-shell input[type='tel'],
.page-shell input[type='url'] {
  width: 100%;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: #fff;
  color: var(--text-main);
  font: inherit;
  font-size: 0.85rem;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.page-shell select {
  padding-right: 1.75rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1rem) center,
    calc(100% - 0.75rem) center;
  background-repeat: no-repeat;
  background-size: 0.25rem 0.25rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.page-shell select:focus,
.page-shell input:focus,
.page-shell textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60, 72, 107, 0.1);
}

/* File inputs: replace the plain widget with a bordered control. */
.page-shell input[type='file'] {
  width: 100%;
  padding: 0.375rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background-color: #fff;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.page-shell input[type='file']::file-selector-button {
  margin-right: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-main);
  color: var(--text-main);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Field labels: consistent weight and spacing. */
.page-shell label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Buttons */
.page-shell button {
  font: inherit;
}

/* Data-entry workspace: coloured header bar + textarea + footer row.
   Shared by the Split, Compare and Clean URL tools. */
.data-entry {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.data-entry__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.375rem;
  color: #fff;
  background: var(--primary);
  border: 2px solid var(--primary);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.data-entry__bar select {
  height: 1.75rem;
  padding: 0 0.375rem;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  background-color: #f0f0f0;
  border: 0;
  border-radius: 4px;
}

.data-entry__textarea {
  display: block;
  width: 100%;
  height: 150px;
  padding: 0.5rem;
  resize: vertical;
  border: 2px solid var(--primary);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--text-main);
}

.data-entry__textarea:focus {
  outline: none;
}

.data-entry__footer {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.5rem;
}

.data-entry__footer--spread {
  justify-content: space-between;
}

.data-entry__file {
  flex: 1;
}

.data-entry__count {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Generic form rows for options/separators */
.field-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

/* ===== Result & statistics tables =====
   Tables belong to the same family as the .data-entry workspaces:
   a primary-coloured header bar over a clean, bordered body. */
.data-table,
.domain-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table th,
.domain-table th {
  padding: 0.5rem 0.625rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--primary);
}

.data-table td,
.domain-table td {
  padding: 0.5rem 0.625rem;
  text-align: left;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.data-table tbody tr:nth-child(even),
.domain-table tbody tr:nth-child(even) {
  background-color: var(--bg-main);
}

/* Scrollable table wrapper */
.domain-table-wrapper {
  max-height: 250px;
  overflow-y: auto;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.domain-table-wrapper .domain-table {
  border: 0;
}

/* Table cell helpers */
.wrap-cell {
  white-space: normal;
  word-break: break-word;
}

/* Tool help/guide box */
.tool-guide {
  width: 100%;
  padding: 1rem;
  margin-top: 4rem;
  color: var(--text-main);
  font-size: 0.9rem;
  text-align: left;
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tool-guide h2 {
  margin-top: 0;
  text-align: center;
}

.tool-guide h3 {
  margin-top: 1rem;
  color: var(--primary);
}

.tool-guide ol,
.tool-guide ul {
  margin-block: 1rem;
  text-align: left;
}

.tool-guide li {
  margin-bottom: 0.5rem;
}

.tool-guide li::marker {
  color: var(--primary);
}
