/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #1f497d;
    --blue-light: #e8f0fe;
    --blue-mid: #3a6ea8;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --gray: #6b7280;
    --gray-light: #f9fafb;
    --border: #d1d5db;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,.08);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font);
    background: #f0f4f8;
    color: #1e293b;
    min-height: 100vh;
}

/* ===== Header ===== */
.app-header {
    background: var(--blue);
    color: #fff;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.app-header .logo-icon {
    font-size: 28px;
}
.app-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.app-header p {
    font-size: .82rem;
    opacity: .8;
    margin-top: 2px;
}

/* ===== Layout ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 16px;
}
.container-wide {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px;
}

/* ===== Card ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    margin-bottom: 24px;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--blue-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Form ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid .full {
    grid-column: 1 / -1;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
label {
    font-size: .85rem;
    font-weight: 600;
    color: #374151;
}
label .required {
    color: var(--red);
    margin-left: 2px;
}
input[type="text"],
input[type="email"],
input[type="url"],
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: .9rem;
    color: #1e293b;
    transition: border-color .2s, box-shadow .2s;
    resize: vertical;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(31,73,125,.12);
}
.hint {
    font-size: .76rem;
    color: var(--gray);
    margin-top: 2px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .18s, transform .1s;
}
.btn:active { transform: scale(.97); }

.btn-primary {
    background: var(--blue);
    color: #fff;
}
.btn-primary:hover { background: var(--blue-mid); }

.btn-success {
    background: var(--green);
    color: #fff;
}
.btn-success:hover { background: #15803d; }

.btn-outline {
    background: transparent;
    color: var(--blue);
    border: 2px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-light); }

/* ===== Validation ===== */
.field-error {
    font-size: .8rem;
    color: var(--red);
    margin-top: 3px;
}
.field-error-highlight {
    border-color: var(--red) !important;
}
.global-error {
    background: var(--red-bg);
    border: 1px solid #fca5a5;
    color: var(--red);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: .88rem;
}

/* ===== ATS Score ===== */
.score-card {
    text-align: center;
    padding: 24px;
}
.score-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 8px solid var(--blue);
    margin-bottom: 12px;
    background: var(--blue-light);
}
.score-number {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--blue);
    line-height: 1;
}
.score-label {
    font-size: .8rem;
    color: var(--gray);
}
.score-descriptor {
    font-size: 1rem;
    font-weight: 600;
    color: var(--blue);
}
.score-ring.score-high { border-color: var(--green); background: var(--green-bg); }
.score-ring.score-high .score-number { color: var(--green); }
.score-ring.score-medium { border-color: #d97706; background: #fef3c7; }
.score-ring.score-medium .score-number { color: #92400e; }
.score-ring.score-low { border-color: var(--red); background: var(--red-bg); }
.score-ring.score-low .score-number { color: var(--red); }

/* ===== Keyword pills ===== */
.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}
.pill-green {
    background: var(--green-bg);
    color: #15803d;
    border: 1px solid #86efac;
}
.pill-red {
    background: var(--red-bg);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
.keyword-empty {
    font-size: .85rem;
    color: var(--gray);
    font-style: italic;
}

/* ===== Resume preview ===== */
.resume-preview {
    background: var(--gray-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px 24px;
    font-family: 'Courier New', monospace;
    font-size: .82rem;
    white-space: pre-wrap;
    line-height: 1.65;
    max-height: 420px;
    overflow-y: auto;
    color: #1e293b;
}

/* ===== Result layout ===== */
.result-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}
.result-sidebar {}
.result-main {}

/* ===== Error page ===== */
.error-box {
    text-align: center;
    padding: 60px 24px;
}
.error-icon { font-size: 56px; margin-bottom: 16px; }
.error-box h2 { font-size: 1.4rem; color: var(--red); margin-bottom: 10px; }
.error-box p { color: var(--gray); font-size: .95rem; margin-bottom: 24px; }

/* ===== Skill tag input ===== */
.skill-tag-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: text;
    min-height: 42px;
    transition: border-color .2s, box-shadow .2s;
}
.skill-tag-input:focus-within {
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(31,73,125,.12);
}
.skill-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--blue-light);
    color: var(--blue);
    border: 1px solid #93b4d9;
    border-radius: 20px;
    padding: 3px 8px 3px 12px;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}
.chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--blue-mid); /* replaces var(--blue)+opacity:.55 which gave 2.7:1; --blue-mid gives 4.7:1 */
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    transition: color .15s;
    display: inline-flex;
    align-items: center;
}
.chip-remove:hover { color: var(--blue); }
.skill-tag-input input[type="text"] {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 140px;
    padding: 3px 4px;
    font-size: .9rem;
    background: transparent;
    color: #1e293b;
}
kbd {
    background: #f0f4f8;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: .73rem;
    padding: 1px 5px;
    font-family: monospace;
    color: #374151;
}

/* ===== Action row ===== */
.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ===== Cover Letter ===== */
.cl-hint {
    font-size: .85rem;
    color: var(--gray);
    margin-bottom: 14px;
}
.cl-status {
    font-size: .85rem;
    padding: 9px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
}
.cl-status--info    { background: var(--blue-light);  color: var(--blue); }
.cl-status--error   { background: var(--red-bg);      color: var(--red); }
.cl-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: .88rem;
    line-height: 1.7;
    color: #1e293b;
    resize: vertical;
}
.cl-textarea:focus {
    outline: none;
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(31,73,125,.12);
}
.cl-copied {
    font-size: .85rem;
    color: var(--green);
    font-weight: 600;
}

/* ===== Character counters ===== */
.field-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-top: 3px;
}
.char-counter {
    font-size: .76rem;
    color: var(--gray);
    white-space: nowrap;
    flex-shrink: 0;
}
.char-counter.warn   { color: #d97706; }
.char-counter.danger { color: var(--red); font-weight: 600; }

/* ===== Import card ===== */
.import-card {
    border: 2px dashed var(--border);
    background: var(--gray-light);
    box-shadow: none;
}
.import-badge {
    font-size: .72rem;
    font-weight: 600;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 20px;
    padding: 2px 10px;
    margin-left: 4px;
    vertical-align: middle;
}
.import-hint {
    font-size: .85rem;
    color: var(--gray);
    margin-bottom: 14px;
}
.import-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.file-pick-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: .88rem;
    color: #374151;
    transition: border-color .18s;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-pick-label:hover { border-color: var(--blue-mid); }
.parse-status {
    margin-top: 12px;
    font-size: .85rem;
    padding: 9px 14px;
    border-radius: 6px;
}
.parse-status--info    { background: var(--blue-light);  color: var(--blue); }
.parse-status--success { background: var(--green-bg);    color: #15803d; }
.parse-status--error   { background: var(--red-bg);      color: var(--red); }
.parse-status--warn    { background: #fffbeb; color: #92400e; border: 1px solid #fbbf24; }
.parse-status a        { color: inherit; font-weight: 600; text-decoration: underline; }
.parse-warn            { border-color: #d97706 !important; }

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .result-grid { grid-template-columns: 1fr; }
    .card { padding: 18px 14px; }
    .style-picker { grid-template-columns: 1fr; }
}

/* ===== Style Picker ===== */
.style-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 4px;
}
.style-option {
    cursor: pointer;
    position: relative;
}
.style-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.style-option-body {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    transition: border-color .18s, box-shadow .18s;
    background: var(--gray-light);
}
.style-option input[type="radio"]:checked + .style-option-body {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(31,73,125,.12);
    background: var(--blue-light);
}
.style-option:hover .style-option-body {
    border-color: var(--blue-mid);
}
.style-label {
    font-weight: 700;
    font-size: .95rem;
    color: var(--blue);
    margin-top: 10px;
}
.style-desc {
    font-size: .75rem;
    color: var(--gray);
    margin-top: 3px;
}

/* ===== Style Previews (mini resume thumbnails) ===== */
.style-preview {
    border-radius: 4px;
    height: 90px;
    overflow: hidden;
    font-size: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    gap: 3px;
}

/* Classic preview */
.classic-preview { background: #fff; border: 1px solid var(--border); }
.sp-name { font-size: 7px; font-weight: 800; color: var(--blue); text-align: center; letter-spacing: .05em; }
.sp-line { height: 1.5px; background: var(--blue); margin: 2px 0; border-radius: 1px; }
.sp-section { font-size: 6px; font-weight: 700; color: var(--blue); }
.sp-tag-row { display: flex; gap: 3px; margin-top: 2px; }
.sp-tag { font-size: 5px; background: var(--blue-light); color: var(--blue); padding: 1px 4px; border-radius: 3px; border: .5px solid var(--blue); }

/* Modern preview */
.modern-preview { background: #fff; border: 1px solid var(--border); flex-direction: row; padding: 0; gap: 0; }
.sp-sidebar { background: #1e293b; width: 34%; padding: 5px 4px; display: flex; flex-direction: column; gap: 2px; }
.sp-sidebar-name { font-size: 5px; font-weight: 800; color: #fff; }
.sp-sidebar-label { font-size: 5px; font-weight: 700; color: #63b3ed; margin-top: 3px; }
.sp-sidebar-text { font-size: 5px; color: #e2e8f0; line-height: 1.4; }
.sp-main { flex: 1; padding: 5px 5px; display: flex; flex-direction: column; gap: 2px; }
.sp-section.dark { font-size: 6px; font-weight: 700; color: #1e293b; }
.sp-line.dark { height: 1px; background: #cbd5e1; }
.sp-body-text { font-size: 5px; color: #374151; line-height: 1.4; }

/* Minimal preview */
.minimal-preview { background: #fff; border: 1px solid var(--border); }
.sp-name-plain { font-size: 7px; font-weight: 700; color: #000; }
.sp-line-plain { height: .5px; background: #000; margin: 2px 0; }
.sp-section-plain { font-size: 6px; font-weight: 700; color: #000; }
.sp-body-plain { font-size: 5px; color: #333; line-height: 1.5; margin-top: 1px; }

/* ===== Footer ===== */
.app-footer {
    background: var(--blue);
    color: rgba(255,255,255,.85);
    text-align: center;
    padding: 18px 24px;
    font-size: .82rem;
    margin-top: 40px;
}
.app-footer a {
    color: #93c5fd;
    text-decoration: none;
}
.app-footer a:hover { text-decoration: underline; }
.app-footer .footer-note {
    margin-top: 6px;
    font-size: .76rem;
    color: rgba(255,255,255,0.65); /* explicit color avoids opacity stacking; gives ~4.9:1 on --blue */
}

/* ===== Data notice (above submit) ===== */
.data-notice {
    font-size: .78rem;
    color: var(--gray);
    text-align: center;
    margin-top: 10px;
    line-height: 1.5;
}
.data-notice a { color: var(--blue-mid); text-decoration: underline; }

/* ===== Legal pages ===== */
.legal-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 36px 20px;
}
.legal-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 6px;
}
.legal-container .legal-meta {
    font-size: .82rem;
    color: #4b5563; /* darkened from --gray (#6b7280); gives 6.9:1 on page background */
    margin-bottom: 28px;
}
.legal-container a:not(.btn) {
    text-decoration: underline;
}
.legal-container h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 24px 0 8px;
}
.legal-container p, .legal-container li {
    font-size: .9rem;
    line-height: 1.75;
    color: #374151;
}
.legal-container ul {
    padding-left: 20px;
    margin: 8px 0;
}
.legal-container .legal-highlight {
    background: var(--blue-light);
    border-left: 3px solid var(--blue-mid);
    padding: 10px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 14px 0;
    font-size: .88rem;
    color: #1e293b;
}
