/* ================================================================
   SkillMatch — Design System
   Facebook-inspired minimalist aesthetic
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

/* =================== TOKENS =================== */
:root {
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --bg-hover: #f2f3f5;
    --accent: #0866ff;
    --accent-hover: #0551cc;
    --accent-light: #e7f3ff;
    --text-primary: #050505;
    --text-secondary: #65676b;
    --text-muted: #8a8d91;
    --border: #ccd0d5;
    --border-light: #e4e6eb;
    --green: #31a24c;
    --green-light: #e6f4ea;
    --orange: #e8850c;
    --red: #e4423f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;
    --max-width: 720px;
    --header-h: 56px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: 0.15s ease;
}

/* =================== BASE =================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =================== HEADER =================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    height: var(--header-h);
    display: flex;
    align-items: center;
}

.header-inner {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
    user-select: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.header-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* =================== LAYOUT =================== */
.main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 16px 80px;
}

/* =================== HERO =================== */
.hero {
    text-align: center;
    padding: 40px 0 28px;
}

.hero h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.hero p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
}

/* =================== HOW IT WORKS =================== */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.step {
    text-align: center;
    padding: 20px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.step:hover {
    box-shadow: var(--shadow-md);
}

.step-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: var(--accent-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.step h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.step p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Step connector arrows (desktop only) */
.step-arrow {
    display: none;
}

/* =================== CARD =================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* =================== UPLOAD SECTION =================== */
.upload-card {
    margin-bottom: 24px;
}

.upload-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
}

.upload-tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color var(--transition);
    font-family: var(--font);
}

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

.upload-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
}

.upload-tab:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.upload-body {
    padding: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* =================== DROPZONE =================== */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.dropzone-icon {
    margin-bottom: 12px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.dropzone.drag-over .dropzone-icon {
    color: var(--accent);
}

.dropzone-icon svg {
    width: 40px;
    height: 40px;
}

.dropzone-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.dropzone-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.dropzone-browse {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

/* =================== FILE INFO =================== */
.file-info {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--accent-light);
    border-radius: var(--radius);
    margin-top: 16px;
}

.file-info.visible {
    display: flex;
}

.file-info-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.file-info-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info-size {
    font-size: 12px;
    color: var(--text-muted);
}

.file-info-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius);
    font-size: 16px;
    line-height: 1;
    transition: background var(--transition), color var(--transition);
}

.file-info-remove:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

/* =================== TEXTAREA =================== */
.cv-textarea {
    width: 100%;
    min-height: 200px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    resize: vertical;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg-card);
}

.cv-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(8, 102, 255, 0.12);
}

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

/* =================== BUTTONS =================== */
.upload-footer {
    padding: 0 24px 24px;
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.99);
}

.btn-primary:disabled {
    background: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

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

/* =================== LOADING =================== */
.loading-section {
    display: none;
}

.loading-section.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

.loading-card {
    padding: 40px 24px;
    text-align: center;
}

.loading-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.pipelines-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 360px;
    margin: 0 auto;
}

.pipeline-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: left;
}

.pipeline-indicator {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.pipeline-check svg {
    width: 20px;
    height: 20px;
    color: var(--green);
}

.pipeline-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-sublabel {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* =================== RESULTS =================== */
.results-section {
    display: none;
}

.results-section.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.results-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.results-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* =================== PIPELINE TABS =================== */
.pipeline-tabs {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    overflow: hidden;
}

.pipeline-tab {
    flex: 1;
    padding: 14px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
    font-family: var(--font);
}

.pipeline-tab.active {
    color: var(--accent);
    background: var(--accent-light);
}

.pipeline-tab:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* =================== PIPELINE DESCRIPTION =================== */
.pipeline-desc {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    line-height: 1.5;
}

/* =================== JOB LIST =================== */
.job-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.job-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    opacity: 0;
    transform: translateY(6px);
    animation: cardIn 0.3s ease forwards;
}

.job-card:hover {
    box-shadow: var(--shadow-md);
}

@keyframes cardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================== JOB RANK =================== */
.job-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.job-rank.top-3 {
    color: var(--accent);
    background: var(--accent-light);
}

/* =================== JOB INFO =================== */
.job-info {
    flex: 1;
    min-width: 0;
}

.job-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-company {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.job-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.skill-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 10px;
    white-space: nowrap;
}

/* =================== JOB SCORE =================== */
.job-score {
    text-align: right;
    flex-shrink: 0;
    min-width: 72px;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.score-bar {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    width: 72px;
    margin-top: 6px;
}

.score-fill {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width 0.6s ease;
    background: var(--accent);
}

.score-fill.high {
    background: var(--green);
}

.score-fill.medium {
    background: var(--orange);
}

.score-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =================== FOOTER =================== */
.footer {
    text-align: center;
    padding: 40px 16px 32px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.footer-acronym {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 460px;
    margin: 0 auto;
}

.footer-acronym span {
    font-weight: 700;
    color: var(--accent);
}

/* =================== SECTION TRANSITIONS =================== */
.section-fade-out {
    animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* =================== ERROR STATE =================== */
.error-msg {
    padding: 12px 16px;
    background: #fef0ef;
    color: var(--red);
    border-radius: var(--radius);
    font-size: 14px;
    margin-top: 12px;
    display: none;
}

.error-msg.visible {
    display: block;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 640px) {
    .hero {
        padding: 28px 0 20px;
    }

    .hero h1 {
        font-size: 22px;
    }

    .hero p {
        font-size: 14px;
    }

    .steps {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .step {
        display: flex;
        align-items: center;
        text-align: left;
        gap: 14px;
        padding: 14px 16px;
    }

    .step-icon {
        margin: 0;
        flex-shrink: 0;
    }

    .step h3 {
        margin-bottom: 2px;
    }

    .dropzone {
        padding: 32px 16px;
    }

    .job-card {
        flex-wrap: wrap;
        padding: 14px 16px;
        gap: 10px;
    }

    .job-info {
        flex: 1 1 calc(100% - 48px);
    }

    .job-score {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }

    .score-bar {
        flex: 1;
    }

    .score-value {
        font-size: 16px;
        min-width: 50px;
    }

    .score-label {
        display: none;
    }

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

    .pipeline-tabs {
        border-radius: var(--radius);
    }

    .pipeline-tab {
        font-size: 13px;
        padding: 12px;
    }

    .upload-body {
        padding: 16px;
    }

    .upload-footer {
        padding: 0 16px 16px;
    }
}

@media (max-width: 380px) {
    .header-nav {
        display: none;
    }

    .hero h1 {
        font-size: 20px;
    }
}
