/* ─── subrecon Web UI — Dark Theme ─────────────────────────────────────── */

:root {
    --bg: #0a0a1a;
    --surface: #111128;
    --card: #161633;
    --card-hover: #1a1a3e;
    --border: #1e1e3f;
    --text: #d4d4e8;
    --text-muted: #7a7a9a;
    --accent: #00d4aa;
    --accent-dim: rgba(0, 212, 170, 0.1);
    --accent2: #0088ff;
    --gold: #ffd700;
    --orange: #ff8800;
    --red: #ef4444;
    --green: #00ff88;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* ── Top Bar ──────────────────────────────────────────────────────────── */

.top-bar {
    background: linear-gradient(135deg, var(--surface), var(--card));
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
}

.logo {
    font-family: var(--mono);
    font-size: 14px;
    letter-spacing: 3px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.logo span { color: #fff; }

.nav-links {
    display: flex;
    gap: 24px;
    list-style: none;
}

.nav-links a {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s;
    padding: 4px 0;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

/* ── Container ─────────────────────────────────────────────────────────── */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

/* ── Scan Form ─────────────────────────────────────────────────────────── */

.scan-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 32px;
    margin-bottom: 24px;
}

.scan-card h2 {
    font-size: 18px;
    color: #fff;
    margin-bottom: 6px;
    font-weight: 600;
}

.scan-card p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.form-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 6px;
    padding: 12px 28px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 18px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-secondary:hover {
    background: var(--accent-dim);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: 6px;
    padding: 8px 18px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ── Progress ──────────────────────────────────────────────────────────── */

.progress-container {
    display: none;
    margin-top: 20px;
}

.progress-container.active {
    display: block;
}

.progress-bar-track {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    transition: width 0.5s ease;
    animation: progress-glow 1.5s ease-in-out infinite;
}

@keyframes progress-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}

/* ── Results ───────────────────────────────────────────────────────────── */

.results-container {
    display: none;
}

.results-container.active {
    display: block;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* ── Table ─────────────────────────────────────────────────────────────── */

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    background: var(--surface);
    position: sticky;
    top: 0;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(30, 30, 63, 0.4);
}

tbody tr:hover td {
    background: rgba(0, 212, 170, 0.02);
}

.hostname {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 12px;
    word-break: break-all;
}

.ip-addr {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
}

.status-200 { background: rgba(0, 255, 136, 0.1); color: var(--green); }
.status-301, .status-302, .status-307, .status-308 { background: rgba(0, 136, 255, 0.1); color: var(--accent2); }
.status-401, .status-403 { background: rgba(255, 136, 0, 0.1); color: var(--orange); }
.status-404 { background: rgba(123, 123, 154, 0.1); color: var(--text-muted); }
.status-500, .status-502, .status-503 { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.status-other { background: rgba(255, 215, 0, 0.1); color: var(--gold); }

.tech-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    background: rgba(0, 212, 170, 0.06);
    border: 1px solid rgba(0, 212, 170, 0.12);
    color: var(--text);
    margin: 1px;
    white-space: nowrap;
}

.page-title {
    color: var(--text-muted);
    font-size: 11px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Scan section ──────────────────────────────────────────────────────── */

.scan-section {
    margin-bottom: 32px;
}

.scan-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.scan-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.scan-section-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* ── Source grid ───────────────────────────────────────────────────────── */

.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.source-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}

.source-card:hover {
    border-color: var(--accent);
}

.source-name {
    font-family: var(--mono);
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}

.source-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
}

/* ── History list ──────────────────────────────────────────────────────── */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--accent);
    background: var(--card-hover);
}

.history-domain {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
}

.history-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    font-family: var(--mono);
}

.history-stat {
    color: var(--text-muted);
}

.history-stat span {
    color: var(--accent);
    font-weight: 600;
}

/* ── Empty state ───────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ── Error ─────────────────────────────────────────────────────────────── */

.error-container {
    text-align: center;
    padding: 80px 20px;
}

.error-container h1 {
    font-size: 48px;
    color: var(--red);
    font-family: var(--mono);
    margin-bottom: 12px;
}

.error-container p {
    color: var(--text-muted);
    font-size: 16px;
    margin-bottom: 24px;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 32px 32px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer span { color: var(--accent); }

.footer .footer-warn {
    color: var(--gold);
    opacity: 0.85;
}

/* ── Disclaimer (authorized-use notice) ────────────────────────────────── */

.disclaimer {
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--gold);
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.18);
    border-radius: 6px;
    padding: 8px 12px;
}

/* ── Toast notifications ───────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 20px;
    color: var(--text);
    font-size: 13px;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    border-color: var(--red);
}

.toast.success {
    border-color: var(--accent);
}

.toast .toast-title {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .container { padding: 16px; }
    .top-bar { padding: 0 16px; }
    .form-row { flex-direction: column; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .history-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .history-stats { flex-wrap: wrap; }
}
