/* ═══════════════════════════════════════════════════════════
   WhoSpy — Domain Intelligence Tool — Stylesheet
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg:            #0f1117;
    --bg-card:       #1a1d27;
    --bg-card-hover: #22263a;
    --bg-input:      #141620;
    --border:        #2a2e3e;
    --border-hover:  #3a3f55;
    --text:          #e4e6ed;
    --text-muted:    #8b8fa3;
    --text-dim:      #5a5e72;
    --accent:        #6366f1;
    --accent-hover:  #818cf8;
    --accent-glow:   rgba(99, 102, 241, 0.25);
    --green:         #22c55e;
    --green-bg:      rgba(34, 197, 94, 0.1);
    --green-border:  rgba(34, 197, 94, 0.3);
    --yellow:        #eab308;
    --yellow-bg:     rgba(234, 179, 8, 0.1);
    --yellow-border: rgba(234, 179, 8, 0.3);
    --red:           #ef4444;
    --red-bg:        rgba(239, 68, 68, 0.1);
    --red-border:    rgba(239, 68, 68, 0.3);
    --blue:          #3b82f6;
    --blue-bg:       rgba(59, 130, 246, 0.1);
    --blue-border:   rgba(59, 130, 246, 0.3);
    --cyan:          #06b6d4;
    --cyan-bg:       rgba(6, 182, 212, 0.1);
    --orange:        #f97316;
    --orange-bg:     rgba(249, 115, 22, 0.1);
    --purple:        #a855f7;
    --purple-bg:     rgba(168, 85, 247, 0.1);
    --gray:          #6b7280;
    --gray-bg:       rgba(107, 114, 128, 0.1);
    --radius:        12px;
    --radius-sm:     8px;
    --radius-xs:     6px;
    --shadow:        0 4px 24px rgba(0,0,0,0.3);
    --transition:    0.2s ease;
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

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

/* ── Header ────────────────────────────────────────────── */
header {
    text-align: center;
    padding: 3rem 0 2rem;
}
.brand-logo {
    display: block;
    max-width: 250px;
    height: auto;
    margin: 0 auto 1.2rem;
}
header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
}
header p {
    color: var(--text-muted);
    font-size: 0.92rem;
    max-width: 600px;
    margin: 0 auto;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    transition: color 0.2s ease;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

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

/* ── Search ────────────────────────────────────────────── */
.search-section { margin-bottom: 1.5rem; }

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.input-wrapper {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

input[type="text"] {
    width: 100%;
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="text"]::placeholder { color: var(--text-dim); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 16px var(--accent-glow);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; border-radius: var(--radius-xs); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); background: var(--bg-card-hover); }

/* ── Recent Searches ──────────────────────────────────── */
.recent-searches {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}
.recent-label { font-size: 0.72rem; color: var(--text-dim); font-weight: 500; }
.recent-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.recent-tag {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.recent-tag:hover { color: var(--accent); border-color: var(--accent); }

/* ── Loading State ────────────────────────────────────── */
.loading-state { margin-bottom: 1rem; }
.loading-card { text-align: center; }
.loading-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}
.loading-header strong { color: var(--accent); }

.loading-steps {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.loading-step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    transition: color var(--transition);
}
.loading-step.active { color: var(--accent); }
.loading-step.done { color: var(--green); }

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background var(--transition);
}
.loading-step.active .step-dot { background: var(--accent); animation: pulse 1s infinite; }
.loading-step.done .step-dot { background: var(--green); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

/* ── Error State ──────────────────────────────────────── */
.card-error {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-color: var(--red-border);
    background: var(--red-bg);
}
.card-error .error-icon { color: var(--red); }
.card-error p { color: var(--red); font-size: 0.88rem; }

/* ── Summary Bar ──────────────────────────────────────── */
.summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
    overflow: hidden;
    margin-bottom: 1rem;
}
.summary-item {
    flex: 1;
    min-width: 130px;
    padding: 1rem 1.2rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.summary-item:last-child { border-right: none; }
.summary-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}
.summary-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
}
.summary-value.ok { color: var(--green); }
.summary-value.warning { color: var(--yellow); }
.summary-value.critical, .summary-value.expired, .summary-value.danger { color: var(--red); }

/* ── Toolbar ──────────────────────────────────────────── */
.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.toolbar-info { display: flex; align-items: center; gap: 0.6rem; }
.result-domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}
.result-time {
    font-size: 0.72rem;
    color: var(--text-dim);
}
.toolbar-actions { display: flex; gap: 0.4rem; }

/* ── Tabs ─────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 0.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}
.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.5rem 0.8rem;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.tab-btn:hover { color: var(--text-muted); background: var(--bg-card-hover); }
.tab-btn.active {
    color: var(--text);
    background: var(--accent);
    box-shadow: 0 1px 4px var(--accent-glow);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section Cards (inside panels) ────────────────────── */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}
.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}
.section-header:hover { background: var(--bg-card-hover); }
.section-header h3 {
    font-size: 0.88rem;
    font-weight: 600;
    flex: 1;
}
.section-header .section-icon { color: var(--text-dim); }
.section-header .badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}
.section-header .chevron {
    color: var(--text-dim);
    transition: transform var(--transition);
}
.section-card.collapsed .section-body { display: none; }
.section-card.collapsed .chevron { transform: rotate(-90deg); }

.section-body { padding: 1rem 1.2rem; }

/* ── Data Table ───────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table tr { border-bottom: 1px solid rgba(42, 46, 62, 0.5); }
.data-table tr:last-child { border-bottom: none; }
.data-table td {
    padding: 0.55rem 0;
    vertical-align: top;
    font-size: 0.83rem;
}
.data-table td:first-child {
    font-weight: 500;
    color: var(--text-dim);
    width: 140px;
    white-space: nowrap;
    padding-right: 1rem;
}
.data-table td:last-child {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

/* ── Record Table (DNS, etc.) ─────────────────────────── */
.record-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.record-table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
}
.record-table td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid rgba(42, 46, 62, 0.3);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    word-break: break-all;
}
.record-table tr:last-child td { border-bottom: none; }
.record-table tr:hover td { background: var(--bg-card-hover); }

/* ── Status Badges ────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
}
.badge-ok      { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-warning { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-danger  { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-info    { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }
.badge-neutral { background: var(--gray-bg); color: var(--gray); border: 1px solid rgba(107,114,128,0.3); }
.badge-lock    { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(168,85,247,0.3); }
.badge-cyan    { background: var(--cyan-bg); color: var(--cyan); border: 1px solid rgba(6,182,212,0.3); }

/* ── Status Dots ──────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.3rem;
}
.status-dot.ok { background: var(--green); }
.status-dot.warning { background: var(--yellow); }
.status-dot.danger { background: var(--red); }

/* ── Copy Button ──────────────────────────────────────── */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    color: var(--text-dim);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    transition: all var(--transition);
    font-family: inherit;
}
.copy-btn:hover { color: var(--accent); background: var(--accent-glow); }
.copy-btn.copied { color: var(--green); }

/* ── EPP Status List ──────────────────────────────────── */
.epp-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.epp-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    border: 1px solid rgba(42, 46, 62, 0.5);
}
.epp-item .epp-badge { flex-shrink: 0; }
.epp-item .epp-details { flex: 1; }
.epp-item .epp-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.epp-item .epp-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── TLD Grid ─────────────────────────────────────────── */
.tld-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}
.tld-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid rgba(42, 46, 62, 0.5);
    border-radius: var(--radius-xs);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}
.tld-item .tld-name { flex: 1; }
.tld-item.available { border-color: var(--green-border); }
.tld-item.available .tld-status { color: var(--green); font-weight: 600; }
.tld-item.registered .tld-status { color: var(--text-dim); }
.tld-item.error .tld-status { color: var(--yellow); }

/* ── SSL Chain ────────────────────────────────────────── */
.cert-chain {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.cert-chain-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-left: 2px solid var(--border);
    margin-left: 0.5rem;
    font-size: 0.8rem;
}
.cert-chain-item:first-child { border-left-color: var(--green); }
.cert-chain-item .depth {
    font-size: 0.68rem;
    color: var(--text-dim);
    font-weight: 600;
    min-width: 1.5rem;
}

/* ── Raw WHOIS ────────────────────────────────────────── */
.raw-whois {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 500px;
    overflow-y: auto;
}

/* ── DNS Sub-tabs ─────────────────────────────────────── */
.dns-tabs { display: flex; gap: 0.3rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.dns-tab {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
}
.dns-tab:hover { color: var(--text-muted); border-color: var(--border-hover); }
.dns-tab.active { color: var(--text); background: var(--accent); border-color: var(--accent); }
.dns-tab .count {
    font-size: 0.65rem;
    background: rgba(255,255,255,0.1);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    margin-left: 0.2rem;
}
.dns-tab.active .count { background: rgba(255,255,255,0.2); }

.dns-panel { display: none; }
.dns-panel.active { display: block; }

/* ── Expiry Bar ───────────────────────────────────────── */
.expiry-bar {
    margin-top: 0.6rem;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    overflow: hidden;
}
.expiry-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.expiry-bar-fill.ok { background: linear-gradient(90deg, var(--green), #4ade80); }
.expiry-bar-fill.warning { background: linear-gradient(90deg, var(--yellow), #fbbf24); }
.expiry-bar-fill.critical { background: linear-gradient(90deg, var(--red), #f87171); }
.expiry-bar-fill.expired { background: var(--red); }

/* ── Info box ─────────────────────────────────────────── */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 0.5rem;
}
.info-box.info { background: var(--blue-bg); border: 1px solid var(--blue-border); color: var(--blue); }
.info-box.warn { background: var(--yellow-bg); border: 1px solid var(--yellow-border); color: var(--yellow); }

/* ── Provider Tag ─────────────────────────────────────── */
.provider-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--cyan-bg);
    color: var(--cyan);
}

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* ── Overview Grid ────────────────────────────────────── */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

/* ── Footer ───────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.footer-icon { width: 20px; height: 20px; border-radius: 4px; }

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 700px) {
    .container { padding: 1rem; }
    header h1 { font-size: 1.6rem; }
    .summary-bar { flex-direction: column; }
    .summary-item { border-right: none; border-bottom: 1px solid var(--border); padding: 0.7rem 1rem; }
    .summary-item:last-child { border-bottom: none; }
    .tab-nav { gap: 0.15rem; padding: 0.2rem; }
    .tab-btn { padding: 0.4rem 0.6rem; font-size: 0.72rem; }
    .tab-btn svg { display: none; }
    .overview-grid { grid-template-columns: 1fr; }
    .tld-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .data-table td:first-child { width: 110px; font-size: 0.78rem; }
    .record-table th, .record-table td { padding: 0.4rem 0.5rem; font-size: 0.73rem; }
}
