/* ===== RESET & VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --success-color: #10b981;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --white: #ffffff;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--white);
}

.header h1 {
    font-size: 42px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 18px;
    opacity: 0.9;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab-btn {
    padding: 15px 40px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tab-btn.active {
    background: var(--white);
    color: var(--primary-color);
    border-color: var(--white);
}

/* ===== TAB PANELS ===== */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== GRID ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* ===== FORM SECTION ===== */
.form-section {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.form-section h2 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 25px;
}

.form-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-card h3 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

select.form-input {
    cursor: pointer;
}

/* ===== COLOR PICKER ===== */
.color-picker-group {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 10px;
    align-items: center;
}

.color-input {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.color-text {
    text-transform: uppercase;
}

.help-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
    font-weight: 400;
}

/* ===== FILE UPLOAD ===== */
.logo-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input {
    display: none;
}

.file-label {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
}

.file-label:hover {
    background: var(--primary-dark);
}

.btn-small {
    padding: 8px 15px;
    font-size: 13px;
}

.logo-preview,
.photo-preview {
    margin-top: 10px;
    display: none;
}

.logo-preview img,
.photo-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

/* ===== TEMPLATES ===== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.template-option {
    text-align: center;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.template-option:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.template-option.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.template-preview {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.template-modern {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.template-classic {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

.template-creative {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.template-option span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

/* ===== POSITION BUTTONS ===== */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.position-btn {
    padding: 10px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.position-btn:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.position-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* ===== CHECKBOX ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===== INVOICE / EXPERIENCE / EDUCATION / PROJECTS ITEMS ===== */
.invoice-item,
.experience-item,
.education-item,
.project-item {
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
}

.invoice-item-header,
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.invoice-item-header h4,
.item-header h4 {
    font-size: 15px;
    color: var(--text-dark);
}

.btn-delete {
    background: #ef4444;
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-delete:hover {
    background: #dc2626;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-large {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    margin-top: 20px;
}

/* ===== PREVIEW SECTION ===== */
.preview-section {
    position: sticky;
    top: 20px;
}

.preview-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.preview-header-bar h2 {
    font-size: 24px;
    color: var(--white);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preview-box {
    background: var(--white);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    min-height: 600px;
    overflow-y: auto;
    max-height: 80vh;
}

/* ===== INVOICE PREVIEW ===== */
.preview-content {
    font-size: 13px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary-color);
    transition: border-color 0.3s;
}

.preview-logo-section {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.preview-logo {
    display: none;
}

.preview-logo img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.preview-header h1 {
    font-size: 22px;
    color: var(--primary-color);
    margin-bottom: 5px;
    transition: color 0.3s;
}

.preview-invoice-title h2 {
    font-size: 28px;
    color: var(--text-dark);
    text-align: right;
}

.preview-invoice-title p {
    text-align: right;
    color: var(--text-light);
    margin-top: 5px;
}

/* ===== OBJET ET CLIENT SUR MÊME LIGNE ===== */
.preview-subject-client-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.preview-subject-box,
.preview-client-box {
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.preview-subject-box p:first-child,
.preview-client-box p:first-child {
    font-weight: 600;
    margin-bottom: 5px;
}

/* ===== TABLEAU ===== */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.preview-table th {
    background: var(--primary-color);
    color: var(--white);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    transition: background-color 0.3s;
}

.preview-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.preview-table tr:last-child td {
    border-bottom: none;
}

/* ===== TOTAUX ===== */
.preview-total {
    text-align: right;
    font-size: 15px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.preview-total p {
    margin-bottom: 8px;
}

.preview-total-ttc {
    font-size: 18px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--border-color);
}

.preview-total-ttc span {
    transition: color 0.3s;
}

/* ===== SIGNATURE ===== */
.preview-signature {
    margin-top: 40px;
    text-align: right;
}

.preview-signature p {
    font-size: 13px;
    margin-bottom: 10px;
}

#preview-signature-image {
    display: inline-block;
    margin-top: 10px;
}

#preview-signature-image img {
    max-width: 150px;
    max-height: 80px;
}

/* ===== CV ATS OPTIMISÉ ===== */
.cv-preview-content-ats {
    font-size: 11pt;
    line-height: 1.5;
    color: #000000;
    font-family: 'Helvetica', Arial, sans-serif;
}

.cv-ats-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #2c3e50;
    transition: border-color 0.3s;
}

.cv-ats-header h1 {
    font-size: 24pt;
    font-weight: bold;
    margin-bottom: 5px;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.cv-ats-header h2 {
    font-size: 14pt;
    font-weight: normal;
    color: #555555;
    margin-bottom: 10px;
}

.cv-ats-contact {
    font-size: 10pt;
    color: #333333;
    margin-bottom: 5px;
}

.cv-ats-links {
    font-size: 10pt;
    color: #0066cc;
}

.cv-photo-container-ats {
    display: none;
    margin-bottom: 15px;
    text-align: center;
}

.cv-photo-container-ats img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2c3e50;
    transition: border-color 0.3s;
}

.cv-ats-section {
    margin-bottom: 20px;
}

.cv-ats-section-title {
    font-size: 13pt;
    font-weight: bold;
    color: #2c3e50;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #cccccc;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

.cv-ats-item {
    margin-bottom: 15px;
    page-break-inside: avoid;
}

.cv-ats-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.cv-ats-item-title {
    font-size: 12pt;
    font-weight: bold;
    color: #000000;
}

.cv-ats-item-period {
    font-size: 10pt;
    color: #666666;
    font-style: italic;
}

.cv-ats-item-subtitle {
    font-size: 11pt;
    color: #333333;
    margin-bottom: 5px;
}

.cv-ats-item-description {
    font-size: 10pt;
    color: #000000;
    line-height: 1.6;
    margin-left: 0;
}

.cv-ats-item-description ul {
    margin: 5px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.cv-ats-item-description li {
    margin-bottom: 3px;
}

.cv-ats-item-description strong {
    font-weight: 600;
    color: #2c3e50;
}

.cv-ats-skills-grid {
    display: grid;
    gap: 8px;
}

.cv-ats-skill-category {
    margin-bottom: 8px;
}

.cv-ats-skill-category strong {
    font-size: 10pt;
    color: #2c3e50;
    font-weight: 600;
}

.cv-ats-skill-category span {
    font-size: 10pt;
    color: #000000;
}

/* Responsive CV */
@media (max-width: 768px) {
    .cv-ats-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cv-ats-item-period {
        margin-top: 3px;
    }
}


/* ===== FULLSCREEN MODAL ===== */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.fullscreen-modal.active {
    display: flex;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.1);
}

.fullscreen-header h2 {
    color: var(--white);
    font-size: 24px;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.fullscreen-content {
    flex: 1;
    overflow: auto;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.fullscreen-content .preview-content,
.fullscreen-content .cv-preview-content {
    background: var(--white);
    padding: 60px;
    border-radius: 10px;
    max-width: 900px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .preview-section {
        position: static;
    }
    
    .preview-subject-client-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .preview-box {
        padding: 20px;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .position-grid {
        grid-template-columns: 1fr;
    }
    
    .fullscreen-content .preview-content,
    .fullscreen-content .cv-preview-content {
        padding: 30px;
    }
}