/* ==========================================================
   CareerPilot ATS Checker
   ========================================================== */

:root {
    --ats-bg: #f4f7fb;
    --ats-surface: #ffffff;
    --ats-surface-soft: #f7f9fc;
    --ats-text: #101828;
    --ats-muted: #667085;
    --ats-border: #dbe3ef;
    --ats-primary: #2867e8;
    --ats-primary-hover: #1f57c8;
    --ats-success: #14866d;
    --ats-warning: #d98b12;
    --ats-danger: #d64545;
    --ats-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body.dark-mode {
    --ats-bg: #0d1729;
    --ats-surface: #131f33;
    --ats-surface-soft: #182438;
    --ats-text: #f8fafc;
    --ats-muted: #aebbd0;
    --ats-border: #30415a;
    --ats-primary: #2c6bed;
    --ats-primary-hover: #3f7cf2;
    --ats-shadow: none;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--ats-bg);
    color: var(--ats-text);
    font-family: Inter, Arial, sans-serif;
}

.ats-navbar {

position: sticky;
top: 0;
z-index: 1000;

    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 32px;
    background: var(--ats-surface);
    border-bottom: 1px solid var(--ats-border);
    box-shadow: 0 1px 0 var(--ats-border);
}

.ats-brand {
    color: var(--ats-text);
    font-size: 26px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.ats-nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
    flex: 1;
}

.ats-nav-links a {
    color: var(--ats-text);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.ats-nav-links a:hover {
    color: var(--ats-primary);
}

#themeToggle {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid var(--ats-border);
    border-radius: 12px;
    background: var(--ats-surface);
    color: var(--ats-text);
    font-weight: 700;
    cursor: pointer;
}

.ats-page {
    width: min(1480px, calc(100% - 48px));
    margin: 34px auto 70px;
}

.ats-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 34px;
    min-height: 300px;
    padding: 50px 56px;
    border: 1px solid var(--ats-border);
    border-radius: 28px;
    background:
        linear-gradient(
            110deg,
            rgba(44, 107, 237, 0.08),
            rgba(34, 197, 94, 0.06)
        ),
        var(--ats-surface);
    box-shadow: var(--ats-shadow);
}

.ats-hero > div {
    max-width: 900px;
}

.ats-eyebrow {
    margin: 0 0 14px;
    color: var(--ats-primary);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ats-hero h1 {
    max-width: 820px;
    margin: 0;
    font-size: clamp(42px, 5vw, 72px);
    line-height: 1.03;
    letter-spacing: -0.045em;
}

.ats-hero > div > p:last-child {
    max-width: 820px;
    margin: 24px 0 0;
    color: var(--ats-muted);
    font-size: 18px;
    line-height: 1.7;
}

.ats-primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 170px;
    min-height: 54px;
    padding: 14px 22px;
    border-radius: 12px;
    background: var(--ats-primary);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.ats-primary-link:hover {
    background: var(--ats-primary-hover);
}

.ats-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 0.85fr);
    gap: 26px;
    margin-top: 28px;
}

.ats-input-panel,
.ats-results-panel {
    min-width: 0;
    border: 1px solid var(--ats-border);
    border-radius: 24px;
    background: var(--ats-surface);
    box-shadow: var(--ats-shadow);
}

.ats-input-panel {
    padding: 34px;
}

.ats-results-panel {
    padding: 34px;
}

.ats-section-heading h2 {
    margin: 0;
    font-size: 30px;
}

.ats-section-heading > p:last-child {
    margin: 12px 0 30px;
    color: var(--ats-muted);
    font-size: 16px;
    line-height: 1.6;
}

.ats-field {
    margin-bottom: 22px;
}

.ats-field label {
    display: block;
    margin-bottom: 9px;
    font-size: 14px;
    font-weight: 800;
}

.ats-field input,
.ats-field select,
.ats-field textarea {
    width: 100%;
    border: 1px solid var(--ats-border);
    border-radius: 12px;
    background: var(--ats-surface-soft);
    color: var(--ats-text);
    font: inherit;
    outline: none;
}

.ats-field input,
.ats-field select {
    min-height: 52px;
    padding: 0 15px;
}

.ats-field textarea {
    min-height: 300px;
    padding: 15px;
    resize: vertical;
    line-height: 1.6;
}

.ats-field input:focus,
.ats-field select:focus,
.ats-field textarea:focus {
    border-color: var(--ats-primary);
    box-shadow: 0 0 0 3px rgba(44, 107, 237, 0.14);
}

.ats-analyse-button {
    width: 100%;
    min-height: 56px;
    border: 0;
    border-radius: 12px;
    background: var(--ats-primary);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.ats-analyse-button:hover {
    background: var(--ats-primary-hover);
}

.ats-analyse-button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.ats-empty-state {
    min-height: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px;
    text-align: center;
}

.ats-empty-icon {
    font-size: 58px;
    margin-bottom: 18px;
}

.ats-empty-state h2 {
    margin: 0;
    font-size: 28px;
}

.ats-empty-state p {
    max-width: 470px;
    margin: 14px auto 0;
    color: var(--ats-muted);
    line-height: 1.65;
}

.ats-results[hidden] {
    display: none;
}

.ats-score-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    gap: 26px;
    padding: 24px;
    border: 1px solid var(--ats-border);
    border-radius: 20px;
    background: var(--ats-surface-soft);
}

.ats-score-ring {
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 14px solid rgba(44, 107, 237, 0.18);
    border-top-color: var(--ats-primary);
    border-radius: 50%;
    text-align: center;
}

.ats-score-ring strong {
    display: block;
    font-size: 36px;
}

.ats-score-ring span {
    margin-top: 4px;
    color: var(--ats-muted);
    font-size: 13px;
    font-weight: 700;
}

.ats-score-card h2 {
    margin: 0;
    font-size: 28px;
}

.ats-score-card p {
    margin: 12px 0 0;
    color: var(--ats-muted);
    line-height: 1.6;
}

.ats-result-section {
    margin-top: 22px;
    padding: 22px;
    border: 1px solid var(--ats-border);
    border-radius: 18px;
    background: var(--ats-surface-soft);
}

.ats-result-section h3 {
    margin: 0 0 16px;
    font-size: 20px;
}

.ats-keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ats-keyword {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 750;
}

.ats-keyword.matched {
    background: rgba(20, 134, 109, 0.14);
    color: var(--ats-success);
}

.ats-keyword.missing {
    background: rgba(217, 139, 18, 0.15);
    color: var(--ats-warning);
}

#atsRecommendations {
    margin: 0;
    padding-left: 22px;
    color: var(--ats-muted);
    line-height: 1.7;
}

#atsRecommendations li + li {
    margin-top: 8px;
}

@media (max-width: 1150px) {
    .ats-nav-links {
        gap: 15px;
    }

    .ats-nav-links a {
        font-size: 12px;
    }

    .ats-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 850px) {
    .ats-navbar {
        flex-wrap: wrap;
        padding: 18px;
    }

    .ats-nav-links {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .ats-page {
        width: min(100% - 24px, 1480px);
        margin-top: 18px;
    }

    .ats-hero {
        align-items: flex-start;
        flex-direction: column;
        min-height: auto;
        padding: 32px 24px;
        border-radius: 22px;
    }

    .ats-hero h1 {
        font-size: 42px;
    }

    .ats-input-panel,
    .ats-results-panel {
        padding: 22px;
    }

    .ats-score-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}

/* ==========================================================
   ATS Detailed Breakdown
   ========================================================== */

.ats-breakdown-card {
    margin-top: 22px;
    padding: 24px;
    border: 1px solid var(--ats-border);
    border-radius: 18px;
    background: var(--ats-surface-soft);
}

.ats-breakdown-card > h3 {
    margin: 0 0 22px;
    font-size: 21px;
}

.ats-breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 18px;
    font-size: 15px;
    font-weight: 750;
}

.ats-breakdown-item:first-of-type {
    margin-top: 0;
}

.ats-breakdown-item strong {
    color: var(--ats-primary);
    font-size: 15px;
}

.ats-breakdown-card .progress,
.ats-breakdown-grid .progress {
    width: 100%;
    height: 10px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.28);
}

.ats-breakdown-card .progress-fill,
.ats-breakdown-grid .progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--ats-primary);
    transition:
        width 900ms ease,
        background-color 300ms ease;
}

.ats-breakdown-card .progress-fill.score-high,
.ats-breakdown-grid .progress-fill.score-high {
    background: #16a085;
}

.ats-breakdown-card .progress-fill.score-medium,
.ats-breakdown-grid .progress-fill.score-medium {
    background: #f59e0b;
}

.ats-breakdown-card .progress-fill.score-low,
.ats-breakdown-grid .progress-fill.score-low {
    background: #ef4444;
}

.ats-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ats-breakdown-grid .ats-breakdown-card {
    margin-top: 0;
    min-width: 0;
}

.ats-breakdown-grid .ats-breakdown-card > span {
    display: block;
    color: var(--ats-muted);
    font-size: 14px;
    font-weight: 750;
}

.ats-breakdown-grid .ats-breakdown-card > strong {
    display: block;
    margin-top: 8px;
    color: var(--ats-text);
    font-size: 28px;
}

@media (max-width: 700px) {
    .ats-breakdown-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   ATS Results Layout Improvement
   ========================================================== */

.ats-results {
    display: block;
}

.ats-score-card {
    margin-bottom: 22px;
}

.ats-breakdown-card {
    width: 100%;
}

.ats-results > .ats-breakdown-card {
    margin-bottom: 22px;
}

.ats-result-section {
    width: 100%;
}

.ats-breakdown-item {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.ats-breakdown-card .progress {
    margin-bottom: 14px;
}

@media (min-width: 1000px) {
    .ats-results > .ats-breakdown-card {
        padding: 26px 30px;
    }

    .ats-results > .ats-breakdown-card .ats-breakdown-item {
        grid-template-columns: minmax(180px, 1fr) auto;
    }
}

/* ==========================================================
   Final ATS Report Layout Fix
   ========================================================== */

#atsResults {
    display: flex !important;
    flex-direction: column !important;
    gap: 22px;
    width: 100%;
}

#atsResults > * {
    width: 100%;
    max-width: none;
    grid-column: 1 / -1;
}

#atsResults > .ats-breakdown-card {
    width: 100%;
    box-sizing: border-box;
}

#atsResults > .ats-breakdown-card .ats-breakdown-item {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    align-items: center;
    gap: 20px;
}

#atsResults > .ats-breakdown-card .progress {
    width: 100%;
    margin-bottom: 16px;
}

#atsResults > .ats-result-section {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 700px) {
    #atsResults > .ats-breakdown-card .ats-breakdown-item {
        grid-template-columns: 1fr auto;
    }
}

.ats-breakdown-item strong {
    display: inline-block !important;
    min-width: 48px;
    text-align: right;
    color: var(--ats-primary);
    font-size: 15px;
    font-weight: 800;
}

/* ==========================================================
   Final Detailed ATS Breakdown Layout
   ========================================================== */

#atsResults .ats-breakdown-card {
    display: block !important;
    width: 100%;
    box-sizing: border-box;
}

#atsResults .ats-breakdown-card > h3 {
    margin: 0 0 24px;
}

#atsResults .ats-breakdown-item {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    margin-top: 18px;
}

#atsResults .ats-breakdown-item span {
    flex: 1;
    min-width: 0;
}

#atsResults .ats-breakdown-item strong {
    display: block !important;
    flex: 0 0 auto;
    min-width: 48px;
    text-align: right;
    color: var(--ats-primary);
    font-size: 15px;
    font-weight: 800;
}

#atsResults .ats-breakdown-card .progress {
    width: 100%;
    margin-top: 9px;
    margin-bottom: 16px;
}

/* Keep the main result content from overlapping */
#atsResults,
#atsResults > *,
.ats-result-section {
    position: relative;
    min-width: 0;
}

@media (max-width: 700px) {
    #atsResults .ats-breakdown-item {
        gap: 10px;
    }

    #atsResults .ats-breakdown-item strong {
        min-width: 42px;
    }
}

/* ==========================================================
   ATS Risk Meter
   ========================================================== */

.ats-risk-card {
    width: 100%;
    box-sizing: border-box;
    padding: 26px;
    border: 1px solid var(--ats-border);
    border-radius: 18px;
    background: var(--ats-surface-soft);
}

.ats-risk-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.ats-risk-eyebrow {
    margin: 0 0 8px;
    color: var(--ats-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.09em;
}

.ats-risk-header h3 {
    margin: 0;
    font-size: 22px;
}

.ats-risk-badge {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.22);
    color: var(--ats-text);
    font-size: 13px;
    font-weight: 800;
}

.ats-risk-meter {
    position: relative;
    width: 100%;
    height: 14px;
    margin-top: 24px;
    overflow: hidden;
    border-radius: 999px;
    background:
        linear-gradient(
            90deg,
            #16a085 0%,
            #16a085 33.33%,
            #f59e0b 33.33%,
            #f59e0b 66.66%,
            #ef4444 66.66%,
            #ef4444 100%
        );
}

.ats-risk-meter::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    background: rgba(15, 23, 42, 0.72);
}

.ats-risk-meter-fill {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    border-right: 4px solid #ffffff;
    transition: width 900ms ease;
}

.ats-risk-scale {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 9px;
    color: var(--ats-muted);
    font-size: 12px;
    font-weight: 700;
}

.ats-risk-scale span:nth-child(2) {
    text-align: center;
}

.ats-risk-scale span:last-child {
    text-align: right;
}

.ats-risk-summary {
    margin: 20px 0 0;
    color: var(--ats-muted);
    line-height: 1.6;
}

.ats-risk-factors {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.ats-risk-factors li {
    padding: 12px 14px;
    border: 1px solid var(--ats-border);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.18);
    line-height: 1.5;
}

.ats-risk-card.is-low .ats-risk-badge {
    background: rgba(22, 160, 133, 0.18);
    color: #34d399;
}

.ats-risk-card.is-medium .ats-risk-badge {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}

.ats-risk-card.is-high .ats-risk-badge {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

@media (max-width: 700px) {
    .ats-risk-header {
        flex-direction: column;
    }
}

/* ==========================================================
   Keep ATS input panel visible while reviewing results
   ========================================================== */

.ats-workspace {
    align-items: start;
}

@media (min-width: 1000px) {
    .ats-input-panel {
        position: sticky;
        top: 96px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}