/* Domain Cleaner – nerdtricks.com
   No framework: tokens, light/dark themes, and a handful of components. */

:root {
  color-scheme: light dark;
  --brand-a: #667eea;
  --brand-b: #764ba2;
  --primary-gradient: linear-gradient(135deg, var(--brand-a) 0%, var(--brand-b) 100%);
  --bg: #f8f9fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #2d3748;
  --text-2: #718096;
  --text-3: #4a5568;
  --surface: #f7fafc;
  --surface-2: #edf2f7;
  --success: #48bb78;
  --danger: #f56565;
  --shadow-sm: 0 10px 40px rgba(0, 0, 0, .10);
  --shadow-md: 0 15px 50px rgba(0, 0, 0, .15);
  --shadow-button: 0 5px 20px rgba(102, 126, 234, .4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --focus: #667eea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --card: #171a23;
    --border: #2a2f3d;
    --text: #e6e8ef;
    --text-2: #9aa3b8;
    --text-3: #c3c9d8;
    --surface: #1e2230;
    --surface-2: #262b3b;
    --shadow-sm: 0 10px 40px rgba(0, 0, 0, .45);
    --shadow-md: 0 15px 50px rgba(0, 0, 0, .6);
    --focus: #8b9cf4;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -.125em;
  flex-shrink: 0;
}

/* ===== Layout ===== */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 40px;
  max-width: 600px;
  width: 100%;
  transition: transform .3s ease, box-shadow .3s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
  }
}

@media (max-width: 480px) {
  .card { padding: 28px 20px; }
}

.foot {
  margin: 18px 0 0;
  color: var(--text-2);
  font-size: .8rem;
  text-align: center;
}

/* ===== Header ===== */
.app-header {
  text-align: center;
  margin-bottom: 40px;
}

.app-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #fff;
  font-size: 40px;
}

.app-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.2;
}

.app-subtitle {
  color: var(--text-2);
  font-size: 1rem;
  margin: 0;
}

/* ===== Contact ===== */
.contact-info {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 0 0 30px;
  text-align: center;
  font-size: .875rem;
  color: var(--text-3);
}

.contact-info a {
  color: var(--brand-a);
  text-decoration: none;
  font-weight: 600;
}

.contact-info a:hover { text-decoration: underline; }

/* ===== Form ===== */
.field {
  position: relative;
  margin-bottom: 24px;
}

textarea,
input[type="text"],
select {
  font: inherit;
  color: var(--text);
  background: var(--card);
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px;
  font-size: 16px; /* keeps iOS from zooming on focus */
  transition: border-color .3s ease, box-shadow .3s ease;
}

textarea {
  display: block;
  resize: vertical;
  min-height: 120px;
  padding-right: 48px;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--brand-a);
  box-shadow: 0 0 0 .2rem rgba(102, 126, 234, .15);
}

textarea::placeholder,
input::placeholder { color: var(--text-2); opacity: 1; }

input[type="text"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 5px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background .2s ease, color .2s ease;
  font-size: 1.2rem;
  line-height: 1;
  z-index: 1;
}

.btn-clear:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-clear:active { transform: scale(.95); }

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions .btn-primary { flex: 1 1 260px; }
.actions .btn-secondary { flex: 0 1 auto; }

.hint {
  margin: 14px 0 0;
  text-align: center;
  color: var(--text-2);
  font-size: .8rem;
}

kbd {
  font-family: inherit;
  font-size: .85em;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-3);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease, background .3s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  padding: 15px 30px;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-button);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--text-2);
  padding: 15px 20px;
  font-size: 16px;
}

.btn-secondary:hover {
  background: var(--text-3);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(113, 128, 150, .3);
}

@media (prefers-color-scheme: dark) {
  .btn-secondary { background: #3a4152; }
  .btn-secondary:hover { background: #4a5368; }
}

/* ===== Stats ===== */
.stats {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid var(--border);
  text-align: center;
}

.stat-item { flex: 1; }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.stat-label {
  color: var(--text-2);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ===== TLD breakdown ===== */
.tld-breakdown {
  margin-top: 20px;
  text-align: center;
}

.tld-toggle {
  background: none;
  border: none;
  color: var(--brand-a);
  cursor: pointer;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 auto;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.tld-toggle:hover { text-decoration: underline; }

.tld-content {
  margin-top: 15px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 15px;
}

.tld-stat { text-align: center; }

.tld-name {
  display: block;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  font-size: 1.1rem;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.tld-count {
  display: block;
  color: var(--text-2);
  font-size: .875rem;
}

/* ===== Features ===== */
.features {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.feature-item {
  text-align: center;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-md);
  transition: background .3s ease, transform .3s ease;
}

.feature-item:hover {
  background: var(--surface-2);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 10px;
  color: var(--brand-a);
}

.feature-text {
  font-size: .875rem;
  color: var(--text-3);
  font-weight: 600;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: calc(100% - 40px);
  padding: 15px 25px;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-md);
  box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  animation: slideIn .3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.error .toast-icon { color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Settings dialog ===== */
dialog {
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog, dialog * { -webkit-tap-highlight-color: transparent; }

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
}

.dialog-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.dialog-footer .btn { padding: 10px 18px; font-size: 15px; }
.dialog-footer .btn-primary { text-transform: none; letter-spacing: 0; }

.dialog-body { padding: 28px 24px; }

.dialog-body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 1rem;
}

.dialog-body h3:first-child { margin-top: 0; }

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  line-height: 1;
}

.btn-close:hover { background: var(--surface); color: var(--text); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
  cursor: pointer;
}

.check input[type="checkbox"] {
  accent-color: var(--brand-a);
  width: 1.15em;
  height: 1.15em;
  margin: .2em 0 0;
  flex-shrink: 0;
}

.sub {
  margin: -5px 0 15px 1.9em;
}

.sub label {
  display: block;
  font-size: .9rem;
  color: var(--text-3);
  margin-bottom: 6px;
}

.sub select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

#tldFilter {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* ===== Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
