/* ============================================================
   CV Generator — minimal CSS
   Tailwind handles UI layout/colors. This file covers ONLY:
   - Template color variables (CSS custom properties)
   - Accordion animation (max-height transition + ::after arrow)
   - A4 paper dimensions (mm units — cannot be done in Tailwind)
   - CV document formatting styles
   - JS-generated dynamic item styles
   - Modal overlay states
   - @keyframes
   ============================================================ */

/* ─── Scope ─────────────────────────────────────────────── */
.cv-generator-wrapper * { box-sizing: border-box; }

/* ─── Template color variables ──────────────────────────── */
.cv-generator-wrapper .cv-template-default,
.cv-generator-wrapper .cv-template-blue {
    --cv-primary: #3b82f6;
    --cv-primary-dark: #2563eb;
}
.cv-generator-wrapper .cv-template-green {
    --cv-primary: #10b981;
    --cv-primary-dark: #059669;
}
.cv-generator-wrapper .cv-template-purple {
    --cv-primary: #8b5cf6;
    --cv-primary-dark: #7c3aed;
}

/* ─── Template selector active state (toggled by JS) ─────── */
.cv-generator-wrapper .template-option.active {
    border-color: #3b82f6 !important;
    background-color: #3b82f6 !important;
    color: white !important;
}

/* ─── Accordion: section-title arrow ─────────────────────── */
.cv-generator-wrapper .section-title::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.3s;
    color: #94a3b8;
}
.cv-generator-wrapper .editor-section.collapsed .section-title::after {
    transform: rotate(-90deg);
}

/* ─── Accordion: section-content collapse animation ─────── */
.cv-generator-wrapper .section-content {
    max-height: 2000px;
    transition: max-height 0.3s ease-out, padding-top 0.3s ease-out, padding-bottom 0.3s ease-out;
}
.cv-generator-wrapper .editor-section.collapsed .section-content {
    max-height: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
}

/* ─── A4 Paper — uses mm units ───────────────────────────── */
.cv-generator-wrapper .cv-paper {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 15mm;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    color: #1e293b;
    font-family: 'Inter', sans-serif;
    /* Render off-screen — JS copies content for PDF */
    position: absolute;
    left: -9999px;
    visibility: hidden;
}
.cv-generator-wrapper .cv-page-preview {
    background: white;
    width: 210mm;
    height: 297mm;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.cv-generator-wrapper .cv-page-preview .cv-page-content {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    padding: 15mm;
    box-sizing: border-box;
    overflow: hidden;
}
.cv-generator-wrapper .cv-page-divider {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: #e0e0e0;
    border-top: 1px dashed #999;
    z-index: 10;
}
.cv-generator-wrapper .pdf-mode {
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    box-shadow: none !important;
}

/* ─── CV Document styles ─────────────────────────────────── */
.cv-generator-wrapper .cv-header-modern {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--cv-primary, #3b82f6);
}
.cv-generator-wrapper .cv-header-modern h1 {
    font-size: 2.2rem;
    margin: 0 0 5px 0;
    color: #111;
}
.cv-generator-wrapper .cv-header-modern h2 {
    font-size: 1.1rem;
    color: var(--cv-primary, #3b82f6);
    font-weight: 500;
    margin: 0 0 15px 0;
}
.cv-generator-wrapper .cv-summary-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #444;
    max-width: 400px;
    margin: 0;
}
.cv-generator-wrapper .cv-avatar {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    margin-left: 20px;
}
.cv-generator-wrapper .cv-avatar.hidden { display: none; }
.cv-generator-wrapper .cv-contact-list {
    text-align: right;
    font-size: 0.85rem;
    margin-top: 10px;
    line-height: 1.6;
}
.cv-generator-wrapper .cv-contact-list div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.cv-generator-wrapper .cv-contact-list a {
    color: #1e293b;
    text-decoration: none;
}
.cv-generator-wrapper .cv-body-grid {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 25px;
}
.cv-generator-wrapper .cv-heading {
    font-size: 1rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
    margin: 0 0 15px 0;
    letter-spacing: 1px;
}
.cv-generator-wrapper .cv-section { margin-bottom: 25px; }
.cv-generator-wrapper .cv-section.hidden { display: none; }
.cv-generator-wrapper .cv-item { margin-bottom: 15px; }
.cv-generator-wrapper .cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.cv-generator-wrapper .cv-item-title { font-weight: 700; font-size: 1rem; }
.cv-generator-wrapper .cv-item-title a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--cv-primary, #3b82f6);
}
.cv-generator-wrapper .cv-item-subtitle {
    font-weight: 600;
    color: var(--cv-primary, #3b82f6);
    font-size: 0.9rem;
}
.cv-generator-wrapper .cv-item-date { font-size: 0.8rem; color: #64748b; }
.cv-generator-wrapper .cv-item-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-line;
    color: #334155;
}
.cv-generator-wrapper .tags-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-generator-wrapper .tag {
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #334155;
}
.cv-generator-wrapper .cert-link a {
    color: #3b82f6;
    font-size: 0.8rem;
    text-decoration: none;
}
.cv-generator-wrapper .cert-link a:hover { text-decoration: underline; }
.cv-generator-wrapper .cv-rodo {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 30px;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}
.cv-generator-wrapper .cv-rodo.hidden { display: none; }

/* ─── JS-generated dynamic form items ───────────────────── */
.cv-generator-wrapper .dynamic-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}
.cv-generator-wrapper .remove-btn {
    position: absolute;
    top: 8px; right: 8px;
    background: none; border: none;
    color: #ef4444; cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
}
.cv-generator-wrapper .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.cv-generator-wrapper .full-width { grid-column: span 2; }
.cv-generator-wrapper .input-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #64748b;
}
.cv-generator-wrapper .input-group input,
.cv-generator-wrapper .input-group textarea,
.cv-generator-wrapper .input-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.cv-generator-wrapper .input-group input:focus,
.cv-generator-wrapper .input-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.cv-generator-wrapper .input-group textarea { resize: vertical; min-height: 60px; }

/* ─── Loader / Modal overlays ────────────────────────────── */
#pdf-loader.loader-overlay,
#newsletterModal.loader-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
/* hide state — scoped to these specific IDs, NOT global .hidden */
#pdf-loader.loader-overlay.hidden,
#newsletterModal.loader-overlay.hidden {
    display: none !important;
}

/* ─── Spinner ────────────────────────────────────────────── */
.spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cv-spin 0.8s infinite linear;
    margin-bottom: 12px;
}
@keyframes cv-spin {
    to { transform: rotate(360deg); }
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1000px) {
    .cv-generator-wrapper .app-container { flex-direction: column; }
    .cv-generator-wrapper .editor-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    .cv-generator-wrapper .preview-stage { padding: 10px !important; }
    .cv-generator-wrapper .cv-page-preview {
        width: 100%;
        height: auto;
        aspect-ratio: 210 / 297;
    }
}
