:root {
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* make all form inputs fill their container up to a sensible max-width */
.form-group input {
  width: 100%;
  max-width: 400px;    /* you can tweak this to taste */
  box-sizing: border-box; /* include padding/border in the width */
}

/* once we’re on tablet or larger, revert to the original ~35% width */
@media screen and (min-width: 768px) {
  .form-group input {
    width: 35%;
    max-width: none;
  }
}


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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
}

.cv-creator-wrapper {
    min-height: 100vh;
}



/* Main CV Creator Interface */
.cv-creator-main {
    background: var(--background-color);
}

.cv-form-panel {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    position: relative;
}

.form-panel-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Progress Header */
.progress-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stage-indicator {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#current-stage {
    color: var(--primary-color);
    font-weight: 700;
}

.progress-bar-container {
    margin-bottom: 1rem;
}

.progress {
    height: 0.5rem;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.autosave-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.autosave-status i {
    color: var(--success-color);
}

/* Form Content */
.form-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.form-stage {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-stage:first-child {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.stage-header {
    margin-bottom: 2rem;
}

.stage-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stage-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.section-group {
    margin-bottom: 2.5rem;
}

.section-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}



/* Sections Grid */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.section-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    overflow: hidden;
}

.section-toggle:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.section-toggle.required {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05), rgba(59, 130, 246, 0.05));
}

.section-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.section-toggle label {
    display: flex;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    position: relative;
    width: 100%;
    margin: 0;
    user-select: none;
}

.section-toggle label i {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.section-toggle input:checked + label {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1), rgba(59, 130, 246, 0.1));
}

.section-toggle input:disabled + label {
    cursor: not-allowed;
    opacity: 0.7;
}

.required-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary-color);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.required {
    color: var(--danger-color);
}

.form-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: var(--surface-color);
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-input.is-invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Photo Upload */
.photo-upload-area {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e9ecef;
    transition: all 0.3s ease;
}

.photo-upload-area:hover {
    border-color: #007bff;
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.3);
}

/* Photo Options */
.photo-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.photo-options .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
}

.photo-options .form-check:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.photo-options .form-check-input:checked + .form-check-label {
    color: var(--primary-color);
    font-weight: 600;
}

.photo-options .form-check-label {
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #6c757d;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
}

.upload-placeholder i {
    font-size: 24px;
    margin-bottom: 8px;
    color: #007bff;
}

.upload-placeholder p {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

.upload-placeholder span {
    font-size: 10px;
    color: #adb5bd;
    margin-top: 4px;
    display: block;
}

.photo-preview {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #f8f9fa;
}

.photo-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}



/* Loading state */
.photo-upload-area.loading {
    pointer-events: none;
}

.photo-upload-area.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-upload-area.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007bff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Preview panel profile photo */
.cv-preview .profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 0 auto 20px;
    display: block;
}

.cv-preview .profile-photo-container {
    text-align: center;
    margin-bottom: 30px;
}

/* Template Selector in Preview Header */
.template-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.template-selector-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.template-options {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.template-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 60px;
}

.template-option-btn:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.template-option-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05), rgba(59, 130, 246, 0.05));
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.template-option-btn i {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.template-option-btn span {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Color Theme Selector */
.color-theme-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.theme-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.color-options {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-option.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--primary-color), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.color-option::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.color-option.active::after {
    opacity: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .photo-upload-area {
        width: 100px;
        height: 100px;
    }
    
    .upload-placeholder i {
        font-size: 20px;
    }
    
    .upload-placeholder p {
        font-size: 11px;
    }
    
    .upload-placeholder span {
        font-size: 9px;
    }
    
    .cv-preview .profile-photo {
        width: 100px;
        height: 100px;
    }

    .template-selector {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .template-selector-label {
        font-size: 0.75rem;
    }

    .template-option-btn {
        min-width: 50px;
        padding: 0.4rem 0.6rem;
    }

    .template-option-btn i {
        font-size: 0.875rem;
    }

    .template-option-btn span {
        font-size: 0.7rem;
    }

    .color-theme-selector {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .theme-label {
        font-size: 0.75rem;
    }

    .color-option {
        width: 28px;
        height: 28px;
    }
}


/* Navigation */
.form-navigation {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-width: 120px;
    justify-content: center;
    user-select: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background-color);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    min-width: auto;
}

/* Preview Panel */
.cv-preview-panel {
    background: var(--background-color);
    position: relative;
}

.preview-panel-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.preview-header {
    padding: 2rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.preview-title h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.preview-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}



.download-btn {
    margin-left: auto;
}

/* Preview Content */
.preview-content {
    flex: 1;
    /* padding: 2rem; */
    overflow: auto;
    background: #f1f5f9;
}

.cv-preview-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    min-height: 1000px;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    
    /* Default theme colors */
    --theme-primary: #1e40af;
    --theme-primary-light: #3b82f6;
    --theme-primary-dark: #1e3a8a;
    --theme-accent: #eff6ff;
}

/* Color Theme Variations */
.cv-preview-container.theme-blue {
    --theme-primary: #1e40af;
    --theme-primary-light: #3b82f6;
    --theme-primary-dark: #1e3a8a;
    --theme-accent: #eff6ff;
}

.cv-preview-container.theme-green {
    --theme-primary: #059669;
    --theme-primary-light: #10b981;
    --theme-primary-dark: #047857;
    --theme-accent: #ecfdf5;
}

.cv-preview-container.theme-purple {
    --theme-primary: #7c3aed;
    --theme-primary-light: #8b5cf6;
    --theme-primary-dark: #6d28d9;
    --theme-accent: #f3e8ff;
}

.cv-preview-container.theme-red {
    --theme-primary: #dc2626;
    --theme-primary-light: #ef4444;
    --theme-primary-dark: #b91c1c;
    --theme-accent: #fef2f2;
}

.cv-preview-container.theme-orange {
    --theme-primary: #ea580c;
    --theme-primary-light: #f97316;
    --theme-primary-dark: #c2410c;
    --theme-accent: #fff7ed;
}

.cv-preview-container.theme-teal {
    --theme-primary: #0d9488;
    --theme-primary-light: #14b8a6;
    --theme-primary-dark: #0f766e;
    --theme-accent: #f0fdfa;
}

.cv-preview-container.theme-indigo {
    --theme-primary: #4338ca;
    --theme-primary-light: #6366f1;
    --theme-primary-dark: #3730a3;
    --theme-accent: #eef2ff;
}

.cv-preview-container.theme-gray {
    --theme-primary: #374151;
    --theme-primary-light: #4b5563;
    --theme-primary-dark: #1f2937;
    --theme-accent: #f9fafb;
}

/* Empty State */
.preview-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    width: 120px;
    height: 120px;
    background: var(--background-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.empty-icon i {
    font-size: 3rem;
    color: var(--text-secondary);
}

.preview-empty-state h4 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.preview-empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 400px;
}

.preview-features {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.feature i {
    color: var(--primary-color);
}

/* Ensure all clickable elements are properly styled */
button, .btn, input[type="checkbox"], input[type="file"], .template-card, .section-toggle label {
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

/* Remove any conflicting styles */
.template-selection .template-option {
    pointer-events: auto;
    cursor: pointer;
}

.sections-selection .section-toggle {
    pointer-events: auto;
}

.sections-selection .section-toggle label {
    pointer-events: auto;
    cursor: pointer;
}

/* Responsive Design */


@media (max-width: 992px) {
    .cv-creator-main .row {
        flex-direction: column;
    }
    
    .cv-form-panel,
    .cv-preview-panel {
        height: auto;
        min-height: 50vh;
    }
    
    .form-panel-content,
    .preview-panel-content {
        height: auto;
    }
}

@media (max-width: 768px) {
    .progress-header,
    .form-content,
    .form-navigation,
    .preview-header,
    .preview-content {
        padding: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .sections-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-controls {
        width: 100%;
        justify-content: center;
        flex-direction: column;
        gap: 0.75rem;
    }
    

}

@media (max-width: 576px) {
    .progress-header,
    .form-content,
    .form-navigation,
    .preview-header,
    .preview-content {
        padding: 1rem;
    }
    
    .form-navigation {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .preview-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .download-btn {
        margin-left: 0;
        margin-top: 1rem;
    }
}

/* CV Template Styles (Keep your existing template styles here) */
/* Modern Template */
.cv-template-modern {
    font-family: 'Inter', Arial, sans-serif;
    color: #333;
    line-height: 1.5;
    background-color: white;
    padding: 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

.cv-template-modern .cv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.cv-template-modern .cv-header-text {
    flex: 1;
}

.cv-template-modern .cv-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: #2c3e50;
}

.cv-template-modern .cv-title {
    font-size: 1.2rem;
    color: var(--theme-primary);
    margin: 5px 0 15px;
}

.cv-template-modern .cv-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.cv-template-modern .cv-contact-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.cv-template-modern .cv-contact-item i {
    margin-right: 5px;
    color: var(--theme-primary);
}

.cv-template-modern .cv-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--theme-primary, #1e40af);
    margin-left: 30px;
    flex-shrink: 0;
    display: block;
    background-color: #f8f9fa;
}

.cv-template-modern .cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-template-modern .cv-section {
    margin-bottom: 25px;
}

.cv-template-modern .cv-section-title {
    font-size: 1.3rem;
    color: var(--theme-primary-dark);
    border-bottom: 2px solid var(--theme-primary);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.cv-template-modern .cv-entry {
    margin-bottom: 15px;
}

.cv-template-modern .cv-entry-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.cv-template-modern .cv-entry-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #34495e;
    margin: 0;
}

.cv-template-modern .cv-entry-subtitle {
    color: #7f8c8d;
    font-style: italic;
    margin: 0;
}

.cv-template-modern .cv-entry-date {
    color: #95a5a6;
    font-size: 0.9rem;
}

.cv-template-modern .cv-entry-description {
    color: #555;
    font-size: 0.95rem;
    text-align: justify;
}

.cv-template-modern .cv-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cv-template-modern .cv-skill {
    background-color: #f1f3f5;
    color: #495057;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

.cv-template-modern .cv-skill-level {
    background-color: #e9ecef;
    color: #495057;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-left: 8px;
}

.cv-template-modern .cv-languages {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cv-template-modern .cv-language {
    background-color: #edf2ff;
    color: #4263eb;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

.cv-template-modern .cv-language-level {
    color: #5c7cfa;
    font-size: 0.8rem;
}



/* Continue with other template styles... */
/* Classic Template Styles */
.cv-template-classic {
    font-family: 'Times New Roman', Times, serif;
    color: #333;
    line-height: 1.6;
    background-color: white;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    font-size: 14px;
}

.cv-template-classic .cv-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px double var(--theme-primary);
}

.cv-template-classic .cv-name {
    font-size: 2.2rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    color: #000;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.cv-template-classic .cv-title {
    font-size: 1.1rem;
    color: #666;
    margin: 0 0 20px 0;
    font-style: italic;
    font-weight: normal;
}

.cv-template-classic .cv-contact {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.9rem;
}

.cv-template-classic .cv-contact-item {
    color: #555;
    font-weight: normal;
}

.cv-template-classic .cv-photo {
    width: 100px;
    height: 100px;
    border-radius: 0;
    overflow: hidden;
    border: 2px solid #333;
    margin: 0 auto 20px;
    display: block;
    background-color: #f8f9fa;
}

.cv-template-classic .cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-template-classic .cv-section {
    margin-bottom: 35px;
}

.cv-template-classic .cv-section-title {
    font-size: 1.2rem;
    color: var(--theme-primary-dark);
    border-bottom: 1px solid var(--theme-primary);
    padding-bottom: 5px;
    margin-bottom: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cv-template-classic .cv-entry {
    margin-bottom: 25px;
    padding-bottom: 15px;
}

.cv-template-classic .cv-entry:not(:last-child) {
    border-bottom: 1px dotted #ccc;
}

.cv-template-classic .cv-entry-header {
    margin-bottom: 8px;
}

.cv-template-classic .cv-entry-title {
    font-weight: bold;
    font-size: 1rem;
    color: #000;
    margin: 0 0 5px 0;
}

.cv-template-classic .cv-entry-subtitle {
    color: #666;
    font-style: italic;
    margin: 0 0 5px 0;
    font-size: 0.95rem;
}

.cv-template-classic .cv-entry-date {
    color: #888;
    font-size: 0.85rem;
    font-weight: normal;
    margin-bottom: 8px;
    display: block;
}

.cv-template-classic .cv-entry-description {
    color: #444;
    font-size: 0.9rem;
    text-align: justify;
    margin-top: 8px;
}

.cv-template-classic .cv-summary {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
    text-align: justify;
    font-style: italic;
}

.cv-template-classic .cv-skills {
    columns: 2;
    column-gap: 30px;
    list-style: none;
    padding: 0;
}

.cv-template-classic .cv-skill {
    display: block;
    margin-bottom: 8px;
    break-inside: avoid;
    padding: 5px 0;
    border-bottom: 1px dotted #ddd;
}

.cv-template-classic .cv-skill-name {
    font-weight: bold;
    color: #333;
}

.cv-template-classic .cv-skill-level {
    float: right;
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

.cv-template-classic .cv-languages {
    columns: 2;
    column-gap: 30px;
}

.cv-template-classic .cv-language {
    display: block;
    margin-bottom: 8px;
    break-inside: avoid;
    padding: 5px 0;
    border-bottom: 1px dotted #ddd;
}

.cv-template-classic .cv-language-name {
    font-weight: bold;
    color: #333;
}

.cv-template-classic .cv-language-level {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

.cv-template-classic .cv-interests {
    text-align: center;
}

.cv-template-classic .cv-interest {
    display: inline;
    color: #555;
    font-style: italic;
}

.cv-template-classic .cv-interest:not(:last-child):after {
    content: " • ";
    color: #999;
}

.cv-template-classic .cv-reference {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    background-color: #fafafa;
}

.cv-template-classic .cv-reference-name {
    font-weight: bold;
    color: #000;
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.cv-template-classic .cv-reference-position {
    color: #666;
    margin: 0 0 8px 0;
    font-style: italic;
}

.cv-template-classic .cv-reference-contact {
    font-size: 0.85rem;
    color: #555;
}

.cv-template-classic .cv-reference-contact span {
    display: block;
    margin-bottom: 3px;
}

.cv-template-classic .cv-project-url,
.cv-template-classic .cv-cert-url {
    margin: 5px 0;
    font-size: 0.85rem;
}

.cv-template-classic .cv-project-url a,
.cv-template-classic .cv-cert-url a {
    color: #333;
    text-decoration: underline;
}

.cv-template-classic .cv-cert-id {
    font-size: 0.8rem;
    color: #666;
    margin: 5px 0;
    font-style: italic;
}

/* Classic template responsive */
@media (max-width: 768px) {
    .cv-template-classic {
        padding: 20px;
        font-size: 13px;
    }
    
    .cv-template-classic .cv-skills,
    .cv-template-classic .cv-languages {
        columns: 1;
    }
    
    .cv-template-classic .cv-contact {
        flex-direction: column;
        gap: 10px;
    }

    .cv-template-classic .cv-photo {
        width: 80px;
        height: 80px;
    }

    .cv-template-modern .cv-header {
        flex-direction: column;
        text-align: center;
    }

    .cv-template-modern .cv-photo {
        margin: 20px auto 0;
        width: 120px;
        height: 120px;
    }
}

@media print {
    .cv-template-classic {
        padding: 20px;
        font-size: 12px;
    }
}
/* Creative Template Styles */
.cv-template-creative {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    line-height: 1.5;
    background-color: white;
    display: flex;
    min-height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.cv-template-creative .cv-sidebar {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-dark) 100%);
    color: white;
    padding: 30px 25px;
    width: 300px;
    flex-shrink: 0;
    position: relative;
}

.cv-template-creative .cv-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    z-index: 1;
}

.cv-template-creative .cv-sidebar > * {
    position: relative;
    z-index: 2;
}

.cv-template-creative .cv-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255,255,255,0.3);
    margin: 0 auto 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.cv-template-creative .cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv-template-creative .cv-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cv-template-creative .cv-title {
    font-size: 1rem;
    color: rgba(255,255,255,0.9);
    margin: 0 0 25px 0;
    text-align: center;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.cv-template-creative .cv-contact {
    margin-bottom: 30px;
}

.cv-template-creative .cv-contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.95);
}

.cv-template-creative .cv-contact-item i {
    width: 18px;
    text-align: center;
    margin-right: 12px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.cv-template-creative .cv-sidebar-section {
    margin-bottom: 30px;
}

.cv-template-creative .cv-sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 8px;
}

.cv-template-creative .cv-sidebar-section {
    margin-bottom: 25px;
    display: block;
}

.cv-template-creative .cv-skills-sidebar {
    display: block;
    width: 100%;
}

.cv-template-creative .cv-skills-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cv-template-creative .cv-skills-sidebar .cv-skill {
    background-color: #f1f3f5;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.cv-template-creative .cv-skills-sidebar .cv-skill-name {
    color: #333333;
    font-weight: 500;
}

.cv-template-creative .cv-skill-level {
    background-color: #e9ecef;
    color: #495057;
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 0.7rem;
    margin-left: 4px;
}

.cv-template-creative .cv-languages-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
}

.cv-template-creative .cv-languages-sidebar .cv-language {
    background-color: #f1f3f5;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.cv-template-creative .cv-languages-sidebar .cv-language-name {
    color: #333333;
    font-weight: 500;
}

.cv-template-creative .cv-language-level {
    background-color: #e9ecef;
    color: #495057;
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 0.7rem;
    margin-left: 4px;
}

.cv-template-creative .cv-interests-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cv-template-creative .cv-interest-tag {
    background-color: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(255,255,255,0.3);
    font-weight: 500;
}

.cv-template-creative .cv-main {
    flex: 1;
    padding: 40px 35px;
    background-color: #fafbfc;
}

.cv-template-creative .cv-main .cv-section {
    margin-bottom: 35px;
}

.cv-template-creative .cv-main .cv-section-title {
    font-size: 1.4rem;
    color: #2d3748;
    margin-bottom: 20px;
    font-weight: 600;
    position: relative;
    padding-left: 20px;
}

.cv-template-creative .cv-main .cv-section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
    border-radius: 2px;
}

.cv-template-creative .cv-entry {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #e2e8f0;
    transition: all 0.2s ease;
}

.cv-template-creative .cv-entry:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-left-color: var(--theme-primary);
}

.cv-template-creative .cv-entry-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2d3748;
    margin: 0 0 5px 0;
}

.cv-template-creative .cv-entry-subtitle {
    color: var(--theme-primary);
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.cv-template-creative .cv-entry-date {
    color: #a0aec0;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 10px;
    display: inline-block;
    background-color: #edf2f7;
    padding: 2px 8px;
    border-radius: 12px;
}

.cv-template-creative .cv-entry-description {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.6;
}

.cv-template-creative .cv-summary {
    font-size: 1rem;
    line-height: 1.7;
    color: #4a5568;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #48bb78;
}

.cv-template-creative .cv-skills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.cv-template-creative .cv-skill {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    border-top: 3px solid #667eea;
}

.cv-template-creative .cv-skill-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.cv-template-creative .cv-skill-level {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.cv-template-creative .cv-languages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.cv-template-creative .cv-language {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    border-top: 3px solid #48bb78;
}

.cv-template-creative .cv-language-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.cv-template-creative .cv-language-level {
    background: linear-gradient(90deg, #48bb78, #38a169);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.cv-template-creative .cv-interests {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cv-template-creative .cv-interest {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    color: #2d3748;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cv-template-creative .cv-reference-creative {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #ed8936;
}

.cv-template-creative .cv-reference-name {
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.cv-template-creative .cv-reference-position {
    color: #ed8936;
    margin: 0 0 10px 0;
    font-weight: 500;
}

.cv-template-creative .cv-reference-contact {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.cv-template-creative .cv-reference-contact span {
    display: flex;
    align-items: center;
    color: #4a5568;
}

.cv-template-creative .cv-reference-contact i {
    margin-right: 5px;
    color: #667eea;
}

.cv-template-creative .cv-project-url,
.cv-template-creative .cv-cert-url {
    margin: 8px 0;
}

.cv-template-creative .cv-project-url a,
.cv-template-creative .cv-cert-url a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.cv-template-creative .cv-project-url a:hover,
.cv-template-creative .cv-cert-url a:hover {
    text-decoration: underline;
}

.cv-template-creative .cv-cert-id {
    font-size: 0.8rem;
    color: #a0aec0;
    margin: 5px 0;
    font-style: italic;
}

/* Creative template responsive */
@media (max-width: 1024px) {
    .cv-template-creative {
        flex-direction: column;
    }
    
    .cv-template-creative .cv-sidebar {
        width: 100%;
        background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    }
    
    .cv-template-creative .cv-sidebar .cv-contact {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
    }
    
    .cv-template-creative .cv-sidebar .cv-contact-item {
        margin-bottom: 0;
    }
    
    .cv-template-creative .cv-name,
    .cv-template-creative .cv-title {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .cv-template-creative .cv-main {
        padding: 20px;
    }
    
    .cv-template-creative .cv-sidebar {
        padding: 20px;
    }
    
    .cv-template-creative .cv-skills,
    .cv-template-creative .cv-languages {
        grid-template-columns: 1fr;
    }
    
    .cv-template-creative .cv-reference-contact {
        flex-direction: column;
        gap: 8px;
    }
}

@media print {
    .cv-template-creative {
        box-shadow: none;
        display: block;
    }
    
    .cv-template-creative .cv-sidebar {
        background: #f7f9fc !important;
        color: #333 !important;
        page-break-inside: avoid;
    }
    
    .cv-template-creative .cv-sidebar * {
        color: #333 !important;
    }
}
/* Template Switching Utilities */
.template-modern .cv-template-classic,
.template-modern .cv-template-creative {
    display: none;
}

.template-classic .cv-template-modern,
.template-classic .cv-template-creative {
    display: none;
}

.template-creative .cv-template-modern,
.template-creative .cv-template-classic {
    display: none;
}



/* Print Styles for All Templates */
@media print {
    .cv-template-modern,
    .cv-template-classic,
    .cv-template-creative {
        box-shadow: none;
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 15mm;
    }
    
    .cv-template-modern .cv-section,
    .cv-template-classic .cv-section,
    .cv-template-creative .cv-section {
        page-break-inside: avoid;
    }
    
    .cv-template-modern .cv-entry,
    .cv-template-classic .cv-entry,
    .cv-template-creative .cv-entry {
        page-break-inside: avoid;
    }
}



/* Animation for template switching */
.cv-preview-container {
    transition: all 0.3s ease;
}

/* Custom scrollbar for preview */
.preview-content::-webkit-scrollbar {
    width: 8px;
}

.preview-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.preview-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.preview-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ============ PDF GENERATION OPTIMIZATIONS ============ */

/* Enhanced print styles for better PDF generation */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .cv-template-modern,
    .cv-template-classic,
    .cv-template-creative {
        color: #333 !important;
        background: white !important;
        font-family: Arial, sans-serif !important;
        line-height: 1.4 !important;
    }
    
    /* Enhanced page break controls */
    .cv-section {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 20px !important;
        orphans: 3 !important;
        widows: 3 !important;
    }
    
    .cv-section-title {
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 10px !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    .cv-entry {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 15px !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    .cv-header {
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 20px !important;
    }
    
    /* Protect all entry types from breaking */
    .experience-entry,
    .education-entry,
    .project-entry,
    .certification-entry,
    .volunteer-entry,
    .reference-entry {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 15px !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    /* Ensure entry headers stay with content */
    .cv-entry-header {
        page-break-after: avoid !important;
        break-after: avoid !important;
        orphans: 2 !important;
    }
    
    /* Skills and languages grid protection */
    .cv-skills,
    .cv-languages {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    .cv-skill,
    .cv-language {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* Interests section protection */
    .cv-interests {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    /* References protection */
    .cv-reference,
    .cv-reference-creative {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 15px !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    .cv-photo img {
        max-width: 120px !important;
        max-height: 120px !important;
    }
}

/* PDF-specific optimizations (applied via JavaScript) */
.pdf-optimized {
    width: 794px !important;
    max-width: 794px !important;
    margin: 0 !important;
    padding: 15px !important;
    background: white !important;
    font-family: Arial, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #333 !important;
    overflow: visible !important;
}

.pdf-optimized * {
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
    animation: none !important;
    transform: none !important;
}

/* Enhanced container protection */
.pdf-optimized .cv-section {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 20px;
    orphans: 3;
    widows: 3;
}

.pdf-optimized .cv-entry {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 15px;
    orphans: 2;
    widows: 2;
}

.pdf-optimized .experience-entry,
.pdf-optimized .education-entry,
.pdf-optimized .project-entry,
.pdf-optimized .certification-entry,
.pdf-optimized .volunteer-entry,
.pdf-optimized .reference-entry {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 15px;
    orphans: 2;
    widows: 2;
    min-height: 60px; /* Ensure minimum content size */
}

.pdf-optimized .cv-section-title {
    color: var(--primary-color, #1e40af) !important;
    page-break-after: avoid;
    break-after: avoid;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 10px;
    orphans: 2;
    widows: 2;
}

.pdf-optimized .cv-header {
    page-break-after: avoid;
    break-after: avoid;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 20px;
    min-height: 100px; /* Ensure header has sufficient content */
}

.pdf-optimized .cv-entry-header {
    page-break-after: avoid;
    break-after: avoid;
    orphans: 2;
}

.pdf-optimized .cv-entry-description {
    orphans: 3;
    widows: 3;
}

.pdf-optimized img {
    max-width: 100% !important;
    height: auto !important;
}

/* Enhanced styling for better PDF appearance with fuller pages */
.cv-template-modern.pdf-optimized {
    font-size: 14px;
    padding: 12px; /* Reduced padding for fuller pages */
}

.cv-template-modern.pdf-optimized .cv-name {
    font-size: 28px !important;
    margin-bottom: 5px !important;
}

.cv-template-modern.pdf-optimized .cv-title {
    font-size: 16px !important;
    margin-bottom: 15px !important;
}

.cv-template-modern.pdf-optimized .cv-section-title {
    font-size: 18px !important;
    margin-bottom: 8px !important;
    padding-bottom: 3px !important;
    border-bottom: 2px solid var(--primary-color, #1e40af) !important;
}

.cv-template-modern.pdf-optimized .cv-entry-title {
    font-size: 16px !important;
    margin-bottom: 3px !important;
}

.cv-template-modern.pdf-optimized .cv-entry-subtitle {
    font-size: 14px !important;
    margin-bottom: 5px !important;
}

.cv-template-modern.pdf-optimized .cv-entry-date {
    font-size: 12px !important;
}

.cv-template-modern.pdf-optimized .cv-contact-item {
    font-size: 13px !important;
    margin-bottom: 3px !important;
}

/* Classic template PDF optimizations */
.cv-template-classic.pdf-optimized {
    padding: 12px; /* Reduced padding for fuller pages */
}

.cv-template-classic.pdf-optimized .cv-name {
    font-size: 26px !important;
    margin-bottom: 5px !important;
}

.cv-template-classic.pdf-optimized .cv-section-title {
    font-size: 16px !important;
    margin-bottom: 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

/* Creative template PDF optimizations */
.cv-template-creative.pdf-optimized {
    display: flex !important;
    flex-direction: row !important;
    padding: 10px !important; /* Reduced padding for fuller pages */
    gap: 0 !important;
}

.cv-template-creative.pdf-optimized .cv-sidebar {
    width: 35% !important;
    background: var(--primary-color, #1e40af) !important;
    color: white !important;
    padding: 15px !important;
    margin-right: 0 !important;
    flex-shrink: 0 !important;
}

.cv-template-creative.pdf-optimized .cv-main {
    width: 65% !important;
    padding: 15px !important;
    flex-grow: 1 !important;
}

.cv-template-creative.pdf-optimized .cv-sidebar-section {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 20px;
}

/* Ensure proper spacing and alignment for all templates */
.pdf-optimized .cv-skills {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    page-break-inside: avoid;
    break-inside: avoid;
}

.pdf-optimized .cv-languages {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    page-break-inside: avoid;
    break-inside: avoid;
}

.pdf-optimized .cv-interests {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    page-break-inside: avoid;
    break-inside: avoid;
}

.pdf-optimized .cv-interest {
    display: inline-block !important;
    background: var(--primary-light, #3b82f6) !important;
    color: white !important;
    padding: 3px 6px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
}

.pdf-optimized .cv-skill-level,
.pdf-optimized .cv-language-level {
    background: var(--primary-light, #3b82f6) !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    font-size: 10px !important;
}

/* Additional protection for card-based entries */
.pdf-optimized .card-body {
    page-break-inside: avoid;
    break-inside: avoid;
    orphans: 2;
    widows: 2;
}

/* Ensure skill and language entries don't break awkwardly */
.pdf-optimized .skill-entry,
.pdf-optimized .language-entry {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 8px;
}

/* Protect form entries in case they're still visible */
.pdf-optimized .form-group {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* Color theme variables for PDF */
.cv-preview-container.theme-blue.pdf-optimized {
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --accent-color: #60a5fa;
}

.cv-preview-container.theme-green.pdf-optimized {
    --primary-color: #059669;
    --primary-light: #10b981;
    --primary-dark: #047857;
    --accent-color: #34d399;
}

.cv-preview-container.theme-purple.pdf-optimized {
    --primary-color: #7c3aed;
    --primary-light: #8b5cf6;
    --primary-dark: #6d28d9;
    --accent-color: #a78bfa;
}

.cv-preview-container.theme-red.pdf-optimized {
    --primary-color: #dc2626;
    --primary-light: #ef4444;
    --primary-dark: #b91c1c;
    --accent-color: #f87171;
}

.cv-preview-container.theme-orange.pdf-optimized {
    --primary-color: #ea580c;
    --primary-light: #f97316;
    --primary-dark: #c2410c;
    --accent-color: #fb923c;
}

.cv-preview-container.theme-teal.pdf-optimized {
    --primary-color: #0d9488;
    --primary-light: #14b8a6;
    --primary-dark: #0f766e;
    --accent-color: #5eead4;
}

.cv-preview-container.theme-indigo.pdf-optimized {
    --primary-color: #4338ca;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --accent-color: #818cf8;
}

.cv-preview-container.theme-gray.pdf-optimized {
    --primary-color: #374151;
    --primary-light: #4b5563;
    --primary-dark: #1f2937;
    --accent-color: #9ca3af;
}
