/* ===================================
   LaTeX CV Builder - Styles
   =================================== */

/* Form Container */
.latex-cv-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.latex-cv-form-wrapper {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.latex-cv-form-wrapper h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 30px;
}

/* Template Selector */
.template-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.template-option {
    display: flex;
    flex-direction: column;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-option:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.template-option input[type="radio"] {
    margin-bottom: 8px;
}

.template-option input[type="radio"]:checked+.template-name {
    color: #3498db;
    font-weight: bold;
}

.template-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.template-desc {
    font-size: 13px;
    color: #7f8c8d;
}

/* Form Sections */
.form-section {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 1px solid #ecf0f1;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: #34495e;
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Repeater Fields */
.repeater-container {
    margin-bottom: 15px;
}

.repeater-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #3498db;
}

.repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.repeater-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.remove-item {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s ease;
}

.remove-item:hover {
    background: #c0392b;
}

.add-item {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.add-item:hover {
    background: #229954;
}

/* Action Buttons */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-info {
    background: #9b59b6;
    color: white;
}

.btn-info:hover {
    background: #8e44ad;
}

/* CV Preview Container */
.cv-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

.preview-header {
    max-width: 900px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.btn-close {
    background: #e74c3c;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* ===================================
   LaTeX-Style CV Templates
   =================================== */

.cv-preview {
    max-width: 210mm;
    /* A4 width */
    min-height: 297mm;
    /* A4 height */
    margin: 0 auto;
    background: white;
    padding: 2.5cm;
    /* Pro margin */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    /* Pro Fonts: EB Garamond priority */
    font-family: 'EB Garamond', 'Computer Modern Serif', 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
    direction: ltr;
    /* Force left-to-right text direction */
    text-align: left;
    /* Ensure text alignment is left */
}

/* LaTeX Typography */
/* Pro Typography */
.cv-preview h1 {
    font-family: 'Merriweather', 'EB Garamond', serif;
    /* Slightly heavier for name */
    font-size: 26pt;
    font-weight: 700;
    text-align: center;
    margin: 0 0 8pt 0;
    letter-spacing: 0.5pt;
    direction: ltr;
}

.cv-preview .contact-info {
    text-align: center;
    font-size: 10pt;
    margin-bottom: 15pt;
    direction: ltr;
    /* Ensure left-to-right text */
}

.cv-preview .contact-info a {
    color: #000;
    text-decoration: underline;
}

.cv-preview .project-link {
    font-size: 10pt;
    font-style: italic;
    margin-top: 2pt;
}

.cv-preview .project-link a {
    color: #000;
    text-decoration: underline;
}

.cv-preview .section-title {
    font-size: 12pt;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5pt;
    margin-top: 15pt;
    margin-bottom: 8pt;
    padding-bottom: 3pt;
    border-bottom: 1pt solid #000;
    direction: ltr;
    /* Ensure left-to-right section titles */
    text-align: left;
    /* Align section titles to left */
}

.cv-preview .entry {
    margin-bottom: 12pt;
    direction: ltr;
    /* Ensure left-to-right entry content */
}

.cv-preview .entry-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3pt;
    direction: ltr;
    /* Ensure left-to-right layout */
}

.cv-preview .entry-title {
    font-weight: bold;
}

/* ATS & Layout Improvements */

.cv-preview {
    /* Font Fallbacks for ATS */
    font-family: 'Computer Modern Serif', 'Times New Roman', Times, serif;
}

/* Date Formatting */
.cv-preview .entry-date {
    font-style: italic;
    font-size: 10pt;
    text-transform: capitalize;
    /* Ensure dates are capitalized */
}

/* Layout Adjustments */
.cv-preview .entry-subtitle {
    font-style: italic;
    font-size: 10pt;
    margin-bottom: 4pt;
    /* Added breathing room */
}

/* Skills Section - Pro Layout (Definition List) */
.skills-container dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4pt;
    margin: 0;
}

.cv-preview .skill-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    /* Fixed width for categories */
    gap: 10px;
    margin-bottom: 3pt;
    direction: ltr;
}

.cv-preview dt.skill-category {
    font-weight: 700;
    font-family: 'Merriweather', serif;
    font-size: 10.5pt;
    margin: 0;
}

.cv-preview dd.skill-list {
    margin: 0;
    font-family: 'EB Garamond', serif;
    flex-grow: 1;
}

/* Bullet Points Cleanup */
.cv-preview ul {
    margin: 4pt 0 8pt 0;
    padding-left: 15pt;
    list-style-type: none;
    direction: ltr;
}

.cv-preview ul li {
    position: relative;
    margin-bottom: 2pt;
    padding-left: 10pt;
    line-height: 1.3;
    /* Better readability */
    text-align: left;
    /* Ensure text doesn't justify weirdly */
}

.cv-preview ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    font-size: 8pt;
    line-height: 1.4;
}

/* Print Overrides */
@media print {
    @page {
        margin: 0;
        size: A4;
    }

    body {
        margin: 0;
        background: white;
    }

    .cv-preview {
        box-shadow: none;
        margin: 0;
        padding: 2cm;
        /* Strict print padding */
        width: 210mm;
        height: 297mm;
        page-break-after: always;
    }
}