/* ── Reset & Vars ──────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0d17;
  --surface: #141827;
  --surface2: #1c2032;
  --border: #2a2e40;
  --text: #e2e4ec;
  --text-muted: #878ba0;
  --accent: #7c8aff;
  --accent2: #5ce0b8;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ───────────────────────────────── */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Header ───────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo .tld {
  color: var(--accent);
}

.tagline {
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-size: 0.95rem;
}

.badges {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  font-weight: 500;
}

.badge.intl {
  background: #1e3a5f33;
  border: 1px solid #3b6cb4;
  color: #93b4f5;
}

.badge.id {
  background: #7c3aed22;
  border: 1px solid #7c3aed;
  color: #c4b5fd;
}

/* ── Card ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

textarea {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent);
}

textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────── */
.btn {
  padding: 0.6rem 1.3rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font);
}

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

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

.btn.primary:hover:not(:disabled) {
  background: #6b7ef0;
}

.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ── Progress ─────────────────────────────── */
.progress {
  margin-top: 1.5rem;
}

.progress-bar {
  height: 5px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}

#progressText {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Results ──────────────────────────────── */
.results {
  margin-top: 2rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.results-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.filter-row {
  display: flex;
  gap: 0.3rem;
}

.filter-chip {
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Registrar Filter ─────────────────────── */
.registrar-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.reg-filter-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.reg-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  min-width: 180px;
  outline: none;
  transition: border-color 0.15s;
}

.reg-select:focus {
  border-color: var(--accent);
}

/* ── Premium badge ────────────────────────── */
.premium-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #92400e33;
  border: 1px solid #f59e0b;
  color: #fbbf24;
}

/* ── Table ────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 70vh;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 900px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

thead th {
  background: var(--surface2);
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface2);
}

/* ── Lifecycle badges ──────────────────────── */
.lifecycle-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
}

.lifecycle-active  { background: #16653433; color: var(--green); border: 1px solid var(--green); }
.lifecycle-expired { background: #7f1d1d33; color: var(--red);   border: 1px solid var(--red); }
.lifecycle-available { background: #1e293b66; color: var(--text-muted); border: 1px solid var(--border); }

/* ── EPP chips ─────────────────────────────── */
.epp-chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 500;
  margin: 0.1rem 0;
  line-height: 1.7;
}

.epp-restrict { background: #7c3aed22; color: #c4b5fd; border: 1px solid #7c3aed44; }
.epp-info     { background: #0f766e22; color: #5eead4; border: 1px solid #0f766e44; }

/* ── Nameserver chips ──────────────────────── */
.ns-chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 400;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin: 0.1rem 0;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  line-height: 1.7;
}

/* deprecated — keep for old code refs */
td .status-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-ok { background: #16653433; color: var(--green); }
.status-active { background: #16653433; color: var(--green); }
.status-hold { background: #78350f33; color: var(--yellow); }
.status-prohibited { background: #7c3aed22; color: #c4b5fd; }
.status-expired { background: #7f1d1d33; color: var(--red); }

.row-error td {
  color: var(--red);
}

.row-error td:first-child {
  color: var(--red);
}

.no-data {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Footer ───────────────────────────────── */
.footer {
  text-align: center;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s, text-decoration 0.2s;
}

.footer a:hover {
  color: var(--accent2);
  text-decoration: underline;
}

/* ── Utility ──────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Tabs nav ─────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.9rem;
}

.tab {
  padding: 0.45rem 1.2rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  font-weight: 500;
}

.tab:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Drive Tabs ───────────────────────────── */
.drive-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.drive-tab {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.15s;
}

.drive-tab:hover {
  color: var(--text);
}

.drive-tab.active {
  background: var(--accent2);
  border-color: var(--accent2);
  color: var(--bg);
}

/* ── Drive Panel ──────────────────────────── */
.drive-panel {
  padding: 1rem 1.5rem;
}

.drive-breadcrumb {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.breadcrumb-item {
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.breadcrumb-item:hover {
  background: var(--surface2);
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
  user-select: none;
}

.drive-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.drive-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
}

.tree-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.tree-toggle input {
  accent-color: var(--accent);
}

/* ── Drive List ───────────────────────────── */
.drive-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  max-height: 60vh;
  overflow-y: auto;
}

.drive-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.drive-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.drive-item:last-child {
  border-bottom: none;
}

.drive-item:hover {
  background: var(--surface);
}

.drive-item-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.drive-item-name {
  flex: 1;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  gap: 1rem;
}

.drive-item-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.drive-icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.12s;
}

.drive-icon-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface);
}

.drive-icon-btn.danger:hover {
  color: var(--red);
  border-color: var(--red);
}

/* ── Tree items ───────────────────────────── */
.tree-item {
  padding-left: 0 !important;
}

.tree-indent {
  padding-left: 1.2rem;
}

.tree-toggle-icon {
  width: 16px;
  text-align: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.tree-toggle-icon.open {
  transform: rotate(90deg);
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 640px) {
  .app {
    padding: 1.2rem 0.8rem 2rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .card {
    padding: 1rem;
  }

  textarea {
    font-size: 0.8rem;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .reg-select {
    min-width: 0;
    width: 100%;
  }

  .table-wrap {
    max-height: 50vh;
  }
}
