/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --available:     #16a34a;
  --available-bg:  #dcfce7;
  --available-border: #86efac;
  --taken:         #dc2626;
  --taken-bg:      #fee2e2;
  --taken-border:  #fca5a5;
  --bg:            #f0f4ff;
  --card-bg:       #ffffff;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --radius:        16px;
  --shadow:        0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #0a1628 0%, #0f2957 50%, #0a1628 100%);
  padding: 56px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 90% at 50% 120%, rgba(37,99,235,.3) 0%, transparent 70%);
}

.hero-inner { position: relative; max-width: 700px; margin: 0 auto; }

/* Logo */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -.3px;
}
.brand-logo svg { width: 36px; height: 36px; }

.hero h1 {
  color: #fff;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -.5px;
}
.hero p {
  color: rgba(255,255,255,.65);
  font-size: 1.05rem;
  margin-bottom: 36px;
}

/* ===== SEARCH FORM ===== */
.search-wrap {
  max-width: 560px;
  margin: 0 auto 18px;
}

.search-form {
  display: flex;
  background: #fff;
  border-radius: 50px;
  box-shadow: 0 8px 40px rgba(0,0,0,.3);
  overflow: hidden;
  padding: 6px 6px 6px 22px;
  gap: 0;
}

.search-form input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}
.search-form input::placeholder { color: #94a3b8; }

.search-form button {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 44px;
  padding: 13px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.search-form button:hover { background: var(--primary-dark); }
.search-form button:disabled { opacity: .6; cursor: not-allowed; }

.hint {
  color: rgba(255,255,255,.45);
  font-size: .83rem;
  margin-top: 10px;
}
.hint span {
  display: inline-block;
  background: rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 1px 10px;
  margin: 2px;
  cursor: pointer;
  transition: background .15s;
}
.hint span:hover { background: rgba(255,255,255,.2); color: rgba(255,255,255,.9); }

/* ===== MAIN ===== */
.main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.main-left  { min-width: 0; }
.main-right { min-width: 0; }

/* ===== LOADING ===== */
.loading-state {
  display: none;
  text-align: center;
  padding: 60px 24px;
}
.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { color: var(--text-muted); font-size: .95rem; }

/* ===== ERROR ===== */
.error-state {
  display: none;
  background: var(--card-bg);
  border: 1.5px solid var(--taken-border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--taken);
}
.error-state p { color: var(--text-muted); font-size: .9rem; margin-top: 6px; }

/* ===== RESULT CARD ===== */
.result-card {
  display: none;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Available */
.result-card.available {
  border: 2px solid var(--available-border);
}
.result-card.available .card-header {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

/* Taken */
.result-card.taken {
  border: 2px solid var(--border);
}
.result-card.taken .card-header {
  background: linear-gradient(135deg, #1e293b, #0f172a);
}

.card-header {
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.card-header-left { display: flex; flex-direction: column; gap: 6px; }

.domain-name {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.5px;
  word-break: break-all;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  width: fit-content;
}
.status-badge::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.status-badge.available { background: rgba(255,255,255,.2); color: #fff; }
.status-badge.taken     { background: rgba(220,38,38,.15);  color: #fca5a5; }

.btn-register {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--available);
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  white-space: nowrap;
}
.btn-register:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }

/* WHOIS Table */
.whois-body { padding: 0; }

.whois-table {
  width: 100%;
  border-collapse: collapse;
}
.whois-table tr { border-bottom: 1px solid var(--border); }
.whois-table tr:last-child { border-bottom: none; }

.whois-table td {
  padding: 14px 24px;
  font-size: .93rem;
  vertical-align: top;
}
.whois-table td:first-child {
  color: var(--text-muted);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  width: 160px;
}
.whois-table td:last-child {
  color: var(--text);
  word-break: break-word;
}

.ns-tag {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: .82rem;
  font-family: monospace;
  margin: 2px;
  color: var(--text);
}

.expiry-warning {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fef9c3;
  color: #854d0e;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: .82rem;
  font-weight: 600;
}

/* ===== LAST 10 .TJ ===== */
.last10-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  overflow: hidden;
}

.last10-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.last10-header h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.last10-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--available);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.last10-list { list-style: none; }
.last10-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  cursor: pointer;
  gap: 8px;
}
.last10-item:last-child { border-bottom: none; }
.last10-item:hover { background: #f8faff; }

.last10-domain {
  font-size: .88rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}
.last10-date {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.last10-skeleton {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .main {
    grid-template-columns: 1fr;
    padding: 24px 16px 60px;
    gap: 20px;
  }
  .main-right { order: -1; }
  .last10-list { display: grid; grid-template-columns: 1fr 1fr; }
  .last10-item { border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
  .hero { padding: 32px 16px 52px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p  { font-size: .92rem; margin-bottom: 24px; }

  .search-form {
    flex-direction: column;
    border-radius: 18px;
    padding: 12px;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
  }
  .search-form input  { font-size: .95rem; padding: 4px 0; }
  .search-form button { width: 100%; border-radius: 12px; padding: 13px; }

  .card-header { padding: 20px; }
  .domain-name { font-size: 1.3rem; }
  .btn-register { width: 100%; justify-content: center; }

  .whois-table td         { padding: 12px 16px; }
  .whois-table td:first-child { width: 100px; font-size: .75rem; }

  .last10-list { display: block; }
  .main { padding: 20px 12px 48px; gap: 16px; }
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg:         #0f172a;
  --card-bg:    #1e293b;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --border:     #334155;
}

[data-theme="dark"] .last10-item:hover { background: #273449; }
[data-theme="dark"] .ns-tag { background: #1e293b; color: #f1f5f9; }
[data-theme="dark"] .expiry-warning { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .skeleton-line {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}
