/* JD to CV & Cover Letter Generator - Notion-like UI */

:root {
    --font-sans: "Inter", sans-serif;
    --text-color: rgb(25, 25, 24);
    --bg-color: #fafafa;
    --border-color: rgba(55, 53, 47, 0.12);
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background: var(--bg-color);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-32) var(--space-24);
}

/* Header */
/* ========== APP HEADER ========== */
.app-header {
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0;
    padding-bottom: var(--space-16);
}

.app-header__title::after {
    content: "";
    display: block;
    width: 40%;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-16) auto 0;
}

/* Input Section */
.input-section {
    margin-bottom: 32px;
}

.input-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Form Steps */
.form-step {
    margin-bottom: 32px;
}

.form-step:last-of-type {
    margin-bottom: 24px;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2383E2;
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-title {
    font-size: 16px;
    font-weight: 600;
    color: rgb(25, 25, 24);
}

.ats-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
    padding: 5px 10px;
    border-radius: 6px;
}

.ats-badge svg {
    width: 14px;
    height: 14px;
}

/* Upload Area */
.upload-area {
    border: 1px dashed rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(55, 53, 47, 0.02);
}

.upload-area:hover {
    border-color: #2383E2;
    background: rgba(35, 131, 226, 0.04);
}

.upload-area.dragover {
    border-color: #2383E2;
    background: rgba(35, 131, 226, 0.08);
}

.upload-area.has-file {
    border-style: solid;
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.04);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: rgba(55, 53, 47, 0.4);
    margin-bottom: 12px;
}

.upload-text {
    font-size: 16px;
    font-weight: 500;
    color: rgb(25, 25, 24);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 14px;
    color: rgba(25, 25, 24, 0.5);
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.file-icon {
    width: 24px;
    height: 24px;
    color: #16a34a;
}

.file-info span {
    font-size: 14px;
    font-weight: 500;
    color: rgb(25, 25, 24);
}

.remove-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.remove-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}

.remove-btn svg {
    width: 16px;
    height: 16px;
    color: #dc2626;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.template-card {
    position: relative;
    border: 0.5px solid rgba(55, 53, 47, 0.12);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
}

.template-card:hover {
    border-color: rgba(55, 53, 47, 0.24);
}

.template-card.selected {
    border-color: #2383E2;
    background: rgba(35, 131, 226, 0.04);
}

.template-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.template-preview {
    width: 100%;
    aspect-ratio: 0.77;
    background: #ffffff;
    border-radius: 4px;
    margin-bottom: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    border: 0.5px solid rgba(55, 53, 47, 0.1);
    overflow: hidden;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Common template preview elements */
.tpl-name {
    font-size: 8px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 1px;
}

.tpl-name.large {
    font-size: 9px;
}

.tpl-name.white {
    color: white;
}

.tpl-contact {
    font-size: 5px;
    color: #666;
    margin-bottom: 4px;
}

.tpl-contact.light {
    color: #888;
}

.tpl-contact.white-subtle {
    color: rgba(255, 255, 255, 0.8);
}

.tpl-section {
    margin-bottom: 4px;
}

.tpl-section.spacious {
    margin-top: 4px;
}

.tpl-section-title {
    font-size: 5px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tpl-section-title.blue {
    color: #2563eb;
}

.tpl-section-title.light {
    color: #666;
    font-weight: 500;
}

.tpl-section-title.bold {
    color: #1a1a1a;
    font-weight: 700;
}

.tpl-line {
    height: 3px;
    background: rgba(55, 53, 47, 0.1);
    border-radius: 1px;
    margin-bottom: 2px;
}

.tpl-line.short {
    width: 65%;
}

.tpl-divider {
    height: 1px;
    background: rgba(55, 53, 47, 0.15);
    margin: 4px 0;
}

/* Classic template */
.classic-preview {
    padding: 10px 8px;
}

.classic-preview .tpl-name {
    text-align: center;
}

.classic-preview .tpl-contact {
    text-align: center;
    border-bottom: 0.5px solid rgba(55, 53, 47, 0.15);
    padding-bottom: 4px;
}

/* Modern template */
.modern-preview {
    padding: 0;
}

.tpl-header-bar {
    height: 6px;
    background: #2563eb;
    margin-bottom: 6px;
}

.modern-preview .tpl-name,
.modern-preview .tpl-contact,
.modern-preview .tpl-section {
    padding: 0 8px;
}

.tpl-pills {
    display: flex;
    gap: 3px;
}

.tpl-pill {
    width: 20px;
    height: 4px;
    background: rgba(37, 99, 235, 0.2);
    border-radius: 2px;
}

/* Minimalist template */
.minimalist-preview {
    padding: 10px 8px;
}

/* Executive template */
.executive-preview {
    padding: 0;
}

.tpl-dark-header {
    background: #1a1a1a;
    padding: 8px;
    margin-bottom: 4px;
}

.tpl-body {
    padding: 0 8px 8px;
}

.template-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgb(25, 25, 24);
    margin-bottom: 2px;
}

.template-desc {
    display: block;
    font-size: 11px;
    color: rgba(25, 25, 24, 0.5);
}

/* Textarea */
.input-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    min-height: 180px;
    padding: 16px;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    color: rgb(25, 25, 24);
    background: rgba(55, 53, 47, 0.04);
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, background 0.2s ease;
}

textarea:focus {
    border-color: #2383E2;
    background: white;
}

textarea::placeholder {
    color: rgba(25, 25, 24, 0.4);
}

.char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: rgba(25, 25, 24, 0.4);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    gap: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 0.5px solid rgba(55, 53, 47, 0.24);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input:checked+.checkbox-custom {
    background: #2383E2;
    border-color: #2383E2;
}

.checkbox-label input:checked+.checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    font-size: 15px;
    font-weight: 500;
    color: rgb(25, 25, 24);
}

/* Buttons */
.button-row {
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 50px;
    background: #000000;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    background: #1a1a1a;
}

.btn-primary:active:not(:disabled) {
    background: #333333;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 48px 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.spinner-container {
    margin-bottom: 24px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid rgba(35, 131, 226, 0.2);
    border-top-color: #2383E2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: rgb(25, 25, 24);
    margin-bottom: 16px;
}

.loading-steps {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.loading-steps .step {
    font-size: 13px;
    color: rgba(25, 25, 24, 0.5);
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(55, 53, 47, 0.04);
    transition: all 0.3s ease;
}

.loading-steps .step.active {
    color: #2383E2;
    background: rgba(35, 131, 226, 0.1);
    font-weight: 500;
}

.loading-steps .step.done {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 32px 24px;
    background: #fef2f2;
    border: 0.5px solid #fecaca;
    border-radius: 12px;
    margin-top: 24px;
}

.error-icon {
    color: #dc2626;
    margin-bottom: 12px;
}

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

.error-text {
    font-size: 16px;
    color: #991b1b;
    margin-bottom: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #2383E2;
    background: white;
    border: 0.5px solid #2383E2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: rgba(35, 131, 226, 0.08);
}

/* Result Section */
.result-section {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

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

.result-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 0.5px solid rgba(55, 53, 47, 0.09);
}

.result-title {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: rgb(25, 25, 24);
    margin-bottom: 4px;
}

.result-subtitle {
    font-size: 14px;
    color: rgba(25, 25, 24, 0.6);
}

.result-subtitle span {
    font-weight: 500;
    color: rgb(25, 25, 24);
}

.template-badge {
    font-size: 13px;
    font-weight: 500;
    color: #2383E2;
    padding: 6px 12px;
    background: rgba(35, 131, 226, 0.1);
    border-radius: 6px;
    text-transform: capitalize;
}

/* Preview Tabs */
.preview-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    background: transparent;
    border: 0.5px solid rgba(55, 53, 47, 0.12);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(55, 53, 47, 0.04);
}

.tab-btn.active {
    color: #2383E2;
    background: rgba(35, 131, 226, 0.08);
    border-color: rgba(35, 131, 226, 0.3);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

/* Preview Container */
.preview-container {
    background: #fafafa;
    border: 0.5px solid rgba(55, 53, 47, 0.09);
    border-radius: 8px;
    padding: 24px;
    min-height: 200px;
    margin-bottom: 24px;
}

.preview-content {
    display: none;
}

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

.preview-placeholder {
    text-align: center;
}

.preview-name {
    font-size: 20px;
    font-weight: 600;
    color: rgb(25, 25, 24);
    margin-bottom: 12px;
}

.preview-summary {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(25, 25, 24, 0.7);
    max-width: 500px;
    margin: 0 auto;
}

.cover-preview-text {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(25, 25, 24, 0.8);
    white-space: pre-wrap;
}

/* Download Actions */
.download-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.8);
    background: white;
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: rgba(55, 53, 47, 0.08);
    border-color: rgba(55, 53, 47, 0.24);
}

.btn-download svg {
    width: 18px;
    height: 18px;
}

.btn-download.primary {
    background: #2383E2;
    border-color: #2383E2;
    color: white;
}

.btn-download.primary:hover {
    background: #1B6DC1;
    border-color: #1B6DC1;
}

/* New Generation */
.new-generation {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 0.5px solid rgba(55, 53, 47, 0.09);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.8);
    background: white;
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(55, 53, 47, 0.08);
    border-color: rgba(55, 53, 47, 0.24);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 24px 16px;
    }

    .page-title {
        font-size: 36px;
    }

    .subtitle {
        font-size: 16px;
    }

    .input-card,
    .result-card {
        padding: 24px;
    }

    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    textarea {
        font-size: 16px;
    }

    .result-header {
        flex-direction: column;
        gap: 12px;
    }

    .result-title {
        font-size: 22px;
    }

    .download-actions {
        flex-direction: column;
    }

    .btn-download {
        width: 100%;
        justify-content: center;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 12px;
    }

    .preview-tabs {
        flex-direction: column;
    }

    .tab-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 32px;
    }

    .loading-steps {
        flex-direction: column;
        gap: 8px;
    }

    .step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ats-badge {
        margin-left: 0;
        margin-top: 4px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--space-24) var(--space-16);
    }

    .app-header {
        padding: var(--space-12) var(--space-16);
        margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-20);
    }

    .app-header__title {
        font-size: 28px;
    }
}