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

:root {
    --bg: #ffffff;
    --bg-light: #f8f8f8;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --text: #1a1a1a;
    --text-dim: #666666;
    --text-muted: #999999;
    --accent: #f26522;
    --accent-hover: #e05a1a;
    --accent-light: #fff3ec;
    --accent-glow: rgba(242, 101, 34, 0.1);
    --dark: #1a1a1a;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --yellow: #d97706;
    --yellow-bg: #fffbeb;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
}

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

/* Header */
.header {
    border-bottom: 1px solid var(--border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

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

.header-tag {
    font-size: 13px;
    color: var(--text-dim);
    background: var(--accent-light);
    border: 1px solid rgba(242, 101, 34, 0.15);
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 500;
}

/* Search Section */
.search-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 24px 40px;
}

.search-card {
    text-align: center;
}

.search-card h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 14px;
    color: var(--dark);
    line-height: 1.15;
}

.search-card h1 .highlight {
    color: var(--accent);
}

.subtitle {
    color: var(--text-dim);
    font-size: 16px;
    margin-bottom: 36px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.search-input-wrap {
    margin-bottom: 24px;
}

textarea {
    width: 100%;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    padding: 18px 20px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

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

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(242, 101, 34, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(242, 101, 34, 0.35);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: var(--text);
    border: 2px solid var(--border);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Progress */
.progress-section {
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 24px;
}

.progress-card {
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow-md);
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.progress-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-msg {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 28px;
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.3s;
}

.step.active {
    color: var(--accent);
}

.step.done {
    color: var(--green);
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}

.step.active .step-dot {
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.step.done .step-dot {
    background: var(--green);
}

/* Results */
.results-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.results-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
}

.results-actions {
    display: flex;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0;
}

.tab {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 22px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px;
}

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

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-count {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

/* Table */
.table-wrap {
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    background: var(--bg-light);
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

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

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

tbody td strong {
    color: var(--dark);
    font-weight: 700;
}

/* Confidence badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-high {
    background: var(--green-bg);
    color: var(--green);
}

.badge-medium {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge-low {
    background: var(--red-bg);
    color: var(--red);
}

/* Links in table */
.link-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.link-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: var(--accent-light);
    border: 1px solid rgba(242, 101, 34, 0.15);
    border-radius: 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.link-pill:hover {
    background: rgba(242, 101, 34, 0.15);
    border-color: var(--accent);
}

/* Email guesses */
.email-wrap {
    position: relative;
}

.email-main {
    font-weight: 600;
    color: var(--dark);
}

.email-guesses {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.email-guesses span {
    display: block;
    color: var(--text-dim);
    font-style: italic;
    font-weight: 600;
    margin-bottom: 2px;
}

.why-match {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    line-height: 1.4;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-dim);
}

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

/* Responsive */
@media (max-width: 768px) {
    .search-card h1 {
        font-size: 28px;
    }

    .header-tag {
        display: none;
    }

    .table-wrap {
        overflow-x: auto;
    }

    table {
        min-width: 700px;
    }

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