/* Theme and Customization Styles for Resume Builder */

/* Color Theme Variables */
:root {
    /* Default Blue Theme */
    --theme-primary: #2563eb;
    --theme-primary-light: #3b82f6;
    --theme-primary-dark: #1d4ed8;
    --theme-accent: #64748b;
    --theme-text: #1f2937;
    --theme-text-light: #6b7280;
    --theme-background: #ffffff;
    --theme-surface: #f8fafc;
    
    /* Font Variables */
    --font-family: 'Calibri', Arial, sans-serif;
    --font-size-base: 11pt;
    --font-size-large: 14pt;
    --font-size-small: 9pt;
    --line-height: 1.5;
    
    /* Spacing Variables */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Layout Variables */
    --margin-narrow: 0.5in;
    --margin-normal: 0.75in;
    --margin-wide: 1in;
    --section-spacing-compact: 12px;
    --section-spacing-normal: 20px;
    --section-spacing-spacious: 28px;
}

/* Color Themes */
.theme-blue {
    --theme-primary: #2563eb;
    --theme-primary-light: #3b82f6;
    --theme-primary-dark: #1d4ed8;
    --theme-accent: #64748b;
}

.theme-red {
    --theme-primary: #dc2626;
    --theme-primary-light: #ef4444;
    --theme-primary-dark: #b91c1c;
    --theme-accent: #6b7280;
}

.theme-green {
    --theme-primary: #059669;
    --theme-primary-light: #10b981;
    --theme-primary-dark: #047857;
    --theme-accent: #64748b;
}

.theme-purple {
    --theme-primary: #7c3aed;
    --theme-primary-light: #8b5cf6;
    --theme-primary-dark: #6d28d9;
    --theme-accent: #a855f7;
}

.theme-orange {
    --theme-primary: #ea580c;
    --theme-primary-light: #f97316;
    --theme-primary-dark: #c2410c;
    --theme-accent: #64748b;
}

.theme-teal {
    --theme-primary: #0d9488;
    --theme-primary-light: #14b8a6;
    --theme-primary-dark: #0f766e;
    --theme-accent: #64748b;
}

.theme-indigo {
    --theme-primary: #4f46e5;
    --theme-primary-light: #6366f1;
    --theme-primary-dark: #4338ca;
    --theme-accent: #8b5cf6;
}

.theme-pink {
    --theme-primary: #db2777;
    --theme-primary-light: #ec4899;
    --theme-primary-dark: #be185d;
    --theme-accent: #64748b;
}

.theme-gray {
    --theme-primary: #374151;
    --theme-primary-light: #4b5563;
    --theme-primary-dark: #1f2937;
    --theme-accent: #6b7280;
}

.theme-slate {
    --theme-primary: #475569;
    --theme-primary-light: #64748b;
    --theme-primary-dark: #334155;
    --theme-accent: #94a3b8;
}

/* Professional Color Schemes */
.theme-corporate {
    --theme-primary: #1e3a8a;
    --theme-primary-light: #3b82f6;
    --theme-primary-dark: #1e40af;
    --theme-accent: #64748b;
    --theme-text: #1f2937;
}

.theme-finance {
    --theme-primary: #065f46;
    --theme-primary-light: #059669;
    --theme-primary-dark: #064e3b;
    --theme-accent: #6b7280;
    --theme-text: #1f2937;
}

.theme-tech {
    --theme-primary: #7c3aed;
    --theme-primary-light: #8b5cf6;
    --theme-primary-dark: #6d28d9;
    --theme-accent: #a855f7;
    --theme-text: #1f2937;
}

.theme-healthcare {
    --theme-primary: #0369a1;
    --theme-primary-light: #0ea5e9;
    --theme-primary-dark: #0c4a6e;
    --theme-accent: #64748b;
    --theme-text: #1f2937;
}

.theme-creative {
    --theme-primary: #db2777;
    --theme-primary-light: #ec4899;
    --theme-primary-dark: #be185d;
    --theme-accent: #8b5cf6;
    --theme-text: #1f2937;
}

.theme-legal {
    --theme-primary: #374151;
    --theme-primary-light: #4b5563;
    --theme-primary-dark: #1f2937;
    --theme-accent: #6b7280;
    --theme-text: #111827;
}

.theme-education {
    --theme-primary: #0891b2;
    --theme-primary-light: #06b6d4;
    --theme-primary-dark: #0e7490;
    --theme-accent: #64748b;
    --theme-text: #1f2937;
}

.theme-marketing {
    --theme-primary: #ea580c;
    --theme-primary-light: #f97316;
    --theme-primary-dark: #c2410c;
    --theme-accent: #7c3aed;
    --theme-text: #1f2937;
}

/* Font Family Classes */
.font-calibri {
    --font-family: 'Calibri', Arial, sans-serif;
}

.font-arial {
    --font-family: 'Arial', sans-serif;
}

.font-times {
    --font-family: 'Times New Roman', serif;
}

.font-inter {
    --font-family: 'Inter', Arial, sans-serif;
}

.font-georgia {
    --font-family: 'Georgia', serif;
}

.font-helvetica {
    --font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* Font Size Classes */
.font-small {
    --font-size-base: 10pt;
    --font-size-large: 12pt;
    --font-size-small: 8pt;
}

.font-medium {
    --font-size-base: 11pt;
    --font-size-large: 14pt;
    --font-size-small: 9pt;
}

.font-large {
    --font-size-base: 12pt;
    --font-size-large: 16pt;
    --font-size-small: 10pt;
}

/* Line Height Classes */
.line-height-compact {
    --line-height: 1.3;
}

.line-height-normal {
    --line-height: 1.5;
}

.line-height-relaxed {
    --line-height: 1.7;
}

/* Margin Classes */
.margin-narrow {
    --margin-size: var(--margin-narrow);
}

.margin-normal {
    --margin-size: var(--margin-normal);
}

.margin-wide {
    --margin-size: var(--margin-wide);
}

/* Section Spacing Classes */
.spacing-compact {
    --section-spacing: var(--section-spacing-compact);
}

.spacing-normal {
    --section-spacing: var(--section-spacing-normal);
}

.spacing-spacious {
    --section-spacing: var(--section-spacing-spacious);
}

/* Apply Theme Variables to Resume Document */
.resume-document {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--theme-text);
    background-color: var(--theme-background);
}

.template-container {
    padding: var(--margin-size, var(--margin-normal));
}

/* Apply Colors to All Elements */
.resume-document .full-name,
.resume-document .section-title,
.resume-document .job-title,
.resume-document .degree {
    color: var(--theme-primary);
}

.resume-document .company-name,
.resume-document .institution {
    color: var(--theme-primary-light);
}

.resume-document .contact-item i,
.resume-document .timeline-marker,
.resume-document .timeline-dot {
    color: var(--theme-primary);
    background-color: var(--theme-primary);
}

.resume-document .skill-item {
    border-left-color: var(--theme-primary);
    background-color: var(--theme-surface);
}

.resume-document .section-title::before,
.resume-document .section-title::after {
    background-color: var(--theme-primary);
}

.resume-document .date-range {
    color: var(--theme-text-light);
}

.resume-document .location {
    color: var(--theme-text-light);
}

.resume-document .job-description,
.resume-document .education-details,
.resume-document .project-description {
    color: var(--theme-text);
}

/* Section Spacing */
.resume-section {
    margin-bottom: var(--section-spacing, var(--section-spacing-normal));
}

/* Template-specific Theme Overrides */

/* Classic Template with Theme */
.template-classic.theme-applied .resume-header {
    border-bottom-color: var(--theme-primary);
}

.template-classic.theme-applied .section-title {
    border-bottom-color: var(--theme-primary);
}

/* Modern Template with Theme */
.template-modern.theme-applied .modern-header {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-light));
}

.template-modern.theme-applied .timeline-marker {
    background-color: var(--theme-primary);
    box-shadow: 0 0 0 4px rgba(var(--theme-primary-rgb), 0.1);
}

/* Executive Template with Theme */
.template-executive.theme-applied .executive-header {
    border-bottom-color: var(--theme-primary);
}

.template-executive.theme-applied .section-title {
    border-top-color: var(--theme-primary);
}

/* Creative Template with Theme */
.template-creative.theme-applied .creative-header {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
}

.template-creative.theme-applied .timeline-dot {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
}

.template-creative.theme-applied .timeline-line {
    background: linear-gradient(to bottom, var(--theme-primary), transparent);
}

.template-creative.theme-applied .section-title::after {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
}

/* Minimalist Template with Theme */
.template-minimalist.theme-applied .section-title {
    border-bottom-color: var(--theme-primary);
}

/* High Contrast Themes */
.theme-high-contrast {
    --theme-primary: #000000;
    --theme-primary-light: #333333;
    --theme-primary-dark: #000000;
    --theme-accent: #666666;
    --theme-text: #000000;
    --theme-text-light: #333333;
    --theme-background: #ffffff;
    --theme-surface: #f5f5f5;
}

.theme-high-contrast-dark {
    --theme-primary: #ffffff;
    --theme-primary-light: #cccccc;
    --theme-primary-dark: #ffffff;
    --theme-accent: #999999;
    --theme-text: #ffffff;
    --theme-text-light: #cccccc;
    --theme-background: #000000;
    --theme-surface: #1a1a1a;
}

/* Accessibility Enhancements */
@media (prefers-contrast: high) {
    .resume-document {
        --theme-primary: #000000;
        --theme-text: #000000;
        --theme-background: #ffffff;
    }
    
    .skill-item,
    .language-item,
    .hobby-item {
        border-width: 2px;
        border-color: #000000;
    }
    
    .section-title {
        border-bottom-width: 2px;
    }
}

/* Print Optimizations for Themes */
@media print {
    .resume-document {
        --theme-background: #ffffff;
        color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    .template-modern .modern-header,
    .template-creative .creative-header {
        background: var(--theme-primary) !important;
        color: white !important;
    }
    
    .timeline-marker,
    .timeline-dot {
        background-color: var(--theme-primary) !important;
    }
    
    .skill-item {
        border-left-color: var(--theme-primary) !important;
    }
    
    .section-title {
        color: var(--theme-primary) !important;
        border-bottom-color: var(--theme-primary) !important;
    }
}

/* Custom Color Picker Integration */
.custom-color {
    --theme-primary: var(--custom-primary-color);
    --theme-primary-light: var(--custom-primary-light);
    --theme-primary-dark: var(--custom-primary-dark);
    --theme-accent: var(--custom-accent-color);
}

/* Dynamic Theme Classes for JavaScript Integration */
.dynamic-theme {
    transition: all 0.3s ease;
}

.dynamic-theme .full-name,
.dynamic-theme .section-title,
.dynamic-theme .job-title,
.dynamic-theme .degree,
.dynamic-theme .company-name,
.dynamic-theme .institution {
    transition: color 0.3s ease;
}

.dynamic-theme .skill-item {
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.dynamic-theme .section-title::before,
.dynamic-theme .section-title::after {
    transition: background-color 0.3s ease;
}

.dynamic-theme .timeline-marker,
.dynamic-theme .timeline-dot {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Industry-specific Color Psychology */
.industry-conservative {
    --theme-primary: #1e3a8a;
    --theme-accent: #64748b;
}

.industry-creative {
    --theme-primary: #db2777;
    --theme-accent: #8b5cf6;
}

.industry-tech {
    --theme-primary: #7c3aed;
    --theme-accent: #06b6d4;
}

.industry-finance {
    --theme-primary: #065f46;
    --theme-accent: #374151;
}

.industry-healthcare {
    --theme-primary: #0369a1;
    --theme-accent: #059669;
}

.industry-education {
    --theme-primary: #0891b2;
    --theme-accent: #7c2d12;
}

.industry-legal {
    --theme-primary: #374151;
    --theme-accent: #6b7280;
}

.industry-nonprofit {
    --theme-primary: #059669;
    --theme-accent: #ea580c;
}

/* Theme Validation Classes */
.theme-valid {
    opacity: 1;
}

.theme-invalid {
    opacity: 0.7;
    position: relative;
}

.theme-invalid::after {
    content: '⚠️ Poor contrast';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fbbf24;
    color: #92400e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 8pt;
    font-weight: 600;
    z-index: 10;
}

/* ATS-Friendly Theme Markers */
.ats-friendly {
    position: relative;
}

.ats-friendly::before {
    content: '✓ ATS Friendly';
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 8pt;
    font-weight: 600;
    z-index: 10;
}

/* Color Blind Accessibility */
@media (prefers-color-scheme: no-preference) {
    .colorblind-friendly {
        --theme-primary: #1f77b4;
        --theme-accent: #ff7f0e;
    }
}

/* Mobile Theme Adjustments */
@media (max-width: 768px) {
    .resume-document {
        --margin-size: 0.25in;
        --section-spacing: var(--section-spacing-compact);
    }
    
    .dynamic-theme {
        transition: none;
    }
}

/* Theme Persistence Classes */
.theme-applied {
    /* Marker class for themes that have been applied */
}

.theme-default {
    /* Reset to default theme */
    --theme-primary: #2563eb;
    --theme-primary-light: #3b82f6;
    --theme-primary-dark: #1d4ed8;
    --theme-accent: #64748b;
    --theme-text: #1f2937;
    --theme-text-light: #6b7280;
    --theme-background: #ffffff;
    --theme-surface: #f8fafc;
}

/* Gradient Themes (Optional Premium Feature) */
.theme-gradient-blue {
    --theme-primary: linear-gradient(135deg, #2563eb, #3b82f6);
    --theme-accent: #64748b;
}

.theme-gradient-purple {
    --theme-primary: linear-gradient(135deg, #7c3aed, #a855f7);
    --theme-accent: #8b5cf6;
}

.theme-gradient-sunset {
    --theme-primary: linear-gradient(135deg, #ea580c, #f97316);
    --theme-accent: #dc2626;
}

/* Theme Export Compatibility */
.export-ready {
    /* Ensure all theme variables are properly applied for export */
    color: var(--theme-text) !important;
    background: var(--theme-background) !important;
}

.export-ready .full-name,
.export-ready .section-title {
    color: var(--theme-primary) !important;
}

.export-ready .skill-item {
    border-left-color: var(--theme-primary) !important;
}

/* Performance Optimizations */
.theme-optimized {
    contain: style layout;
    will-change: color, background-color, border-color;
}