/* ==============================================
   Resume Auto-Matcher — style.css (v4)
   Dark mode, categories, frequency, suggestions
   Keyword highlighting in resume textarea
============================================== */

:root {
    --bg: #0a0e14;
    --bg2: #0f1520;
    --surface: #141c28;
    --surface2: #1a2436;
    --border: #232f42;
    --border2: #2d3c52;
    --text: #e8edf4;
    --text-muted: #8b9ab5;
    --text-dim: #5a6a82;
    --primary: #f72585;
    --primary2: #ff4d9a;
    --primary-bg: rgba(247, 37, 133, 0.12);
    --purple: #7209b7;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #fca311;
    --warning-bg: rgba(252, 163, 17, 0.1);
    --error: #ef4444;
    --blue: #4cc9f0;
    --blue-bg: rgba(76, 201, 240, 0.15);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --grad: linear-gradient(135deg, #f72585 0%, #7209b7 100%);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    animation: fadeIn 0.5s ease-out;
}

/* ── Header ──────────────────────────────── */
header {
    text-align: center;
    margin-bottom: 28px;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.icon-circle {
    width: 48px;
    height: 48px;
    background: var(--grad);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(247, 37, 133, 0.4);
}

.icon-circle svg {
    width: 28px;
    height: 28px;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.badge-free {
    display: inline-block;
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    vertical-align: middle;
    margin-left: 4px;
}

/* ── Grid Layout ─────────────────────────── */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Cards ────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.card-subtitle {
    color: var(--text-dim);
    font-size: 12px;
    margin-bottom: 12px;
}

.input-card {
    margin-bottom: 0;
}

/* ── Textareas ───────────────────────────── */
textarea {
    flex: 1;
    min-height: 200px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: var(--text);
    resize: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: normal;
    word-spacing: normal;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea::placeholder {
    color: var(--text-dim);
}

/* ── Highlighted Preview (after analysis) ── */
.highlight-preview {
    margin-top: 10px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    background: var(--bg2);
    overflow: hidden;
}

.highlight-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(34, 197, 94, 0.1);
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
}

.btn-close-hl {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.btn-close-hl:hover {
    background: var(--error);
    color: #fff;
}

.highlight-body {
    padding: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-muted);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.highlight-body mark.kw-match {
    background: rgba(34, 197, 94, 0.3);
    color: var(--success);
    font-weight: 700;
    border-radius: 3px;
    padding: 1px 3px;
}

/* ── Upload Button ───────────────────────── */
.upload-btn {
    cursor: pointer;
    background: var(--primary-bg);
    color: var(--primary2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(247, 37, 133, 0.25);
    transition: var(--transition);
}

.upload-btn:hover {
    background: rgba(247, 37, 133, 0.2);
    border-color: var(--primary);
}

.file-info-bar {
    padding: 8px 12px;
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 6px;
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ── Action Area ─────────────────────────── */
.action-area {
    text-align: center;
    margin-bottom: 24px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--grad);
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 18px rgba(247, 37, 133, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Score Card ──────────────────────────── */
.score-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin-bottom: 20px;
    padding: 24px;
    background: var(--primary-bg);
    border-radius: var(--radius);
    border: 1px solid rgba(247, 37, 133, 0.2);
}

.score-ring {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.circular-chart {
    display: block;
    max-width: 100%;
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke: var(--primary);
    stroke-linecap: round;
    animation: progress 1s ease-out forwards;
    transition: stroke-dasharray 0.8s ease, stroke 0.5s ease;
}

.percentage {
    fill: var(--text);
    font-family: 'Outfit', sans-serif;
    font-weight: bold;
    font-size: 0.5em;
    text-anchor: middle;
}

@keyframes progress {
    0% {
        stroke-dasharray: 0 100;
    }
}

.score-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    margin-bottom: 4px;
}

.score-info p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Stats Row ───────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stat-card.warn {
    border-color: rgba(252, 163, 17, 0.3);
    background: var(--warning-bg);
}

.stat-number {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.stat-card.warn .stat-number {
    color: var(--warning);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Keywords Grid ───────────────────────── */
.keywords-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.result-card {
    min-height: 120px;
}

.result-card.warning {
    border-color: rgba(252, 163, 17, 0.3);
    background: var(--warning-bg);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    max-height: 220px;
    overflow-y: auto;
}

.tag {
    background: var(--blue-bg);
    color: var(--blue);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
}

.tag.missing {
    background: var(--warning-bg);
    color: var(--warning);
}

.no-keywords {
    color: var(--text-dim);
    font-size: 13px;
    font-style: italic;
}

/* ── Category Tabs ───────────────────────── */
.categories-card h3 {
    margin-bottom: 12px;
}

.category-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.cat-tab {
    padding: 8px 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.cat-tab.active {
    background: var(--primary-bg);
    color: var(--primary2);
    border-color: rgba(247, 37, 133, 0.3);
}

.cat-tab:hover:not(.active) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.cat-section {
    margin-bottom: 14px;
}

.cat-section h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-muted);
}

/* ── Frequency Table ─────────────────────── */
.freq-table-wrap {
    max-height: 350px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.freq-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.freq-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.freq-table th {
    background: var(--bg2);
    color: var(--text-muted);
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.freq-table td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(35, 47, 66, 0.5);
    color: var(--text);
}

.freq-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.freq-table tr.freq-missing td {
    color: var(--text-muted);
}

.freq-word {
    font-weight: 600;
}

.freq-num {
    font-variant-numeric: tabular-nums;
    text-align: center !important;
}

.status-found {
    color: var(--success);
    font-weight: 600;
    font-size: 12px;
}

.status-missing {
    color: var(--error);
    font-weight: 600;
    font-size: 12px;
}

/* ── Suggestions ─────────────────────────── */
.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid var(--border);
    background: var(--bg2);
}

.suggestion-item.critical {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.06);
}

.suggestion-item.warning {
    border-color: rgba(252, 163, 17, 0.3);
    background: var(--warning-bg);
}

.suggestion-item.tip {
    border-color: rgba(76, 201, 240, 0.3);
    background: var(--blue-bg);
}

.suggestion-item.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: var(--success-bg);
}

.sug-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Export Row ───────────────────────────── */
.export-row {
    text-align: center;
    margin-top: 20px;
}

/* ── Toast ────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 22px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.35s ease;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: var(--error);
    color: var(--error);
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

/* ── SEO Content ─────────────────────────── */
.seo-content {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.seo-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text);
    position: relative;
}

.seo-content h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--grad);
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: middle;
}

.seo-content h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 18px 0 8px;
    color: var(--text);
}

.seo-content article {
    margin-bottom: 32px;
}

.seo-content p,
.seo-content li {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
}

.seo-content ul,
.seo-content ol {
    padding-left: 20px;
}

.seo-content li {
    margin-bottom: 6px;
}

.seo-content strong {
    color: var(--text);
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
    transition: var(--transition);
}

.faq-item[open] {
    border-color: var(--primary);
}

.faq-item summary {
    padding: 14px 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    list-style: none;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}

.faq-item[open] summary::after {
    content: '−';
    color: var(--primary);
}

.faq-item p {
    padding: 0 18px 14px;
}

/* ── Footer ──────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 28px 0 12px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 40px;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary);
}

.footer-note {
    margin-top: 6px;
    font-size: 12px;
}

/* ── Hidden ──────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Animations ──────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        padding: 16px 14px 40px;
    }

    h1 {
        font-size: 22px;
    }

    .grid-layout {
        grid-template-columns: 1fr;
    }

    .keywords-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-number {
        font-size: 22px;
    }

    .score-card {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    textarea {
        min-height: 150px;
    }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .cat-tab {
        white-space: nowrap;
    }

    .freq-table {
        font-size: 12px;
    }

    .freq-table th,
    .freq-table td {
        padding: 6px 8px;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}