/* Base styles for the CV wrapper */
.cv-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-family: Arial, sans-serif;
    background-color: #f9f9f9; /* Light background for the overall container */
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); /* Soft shadow for depth */
    max-width: 1200px; /* Max width for the whole tool */
    margin: 20px auto; /* Center the tool */
}

/* Sidebar navigation styles */
.cv-sidebar {
    width: 100%;
    max-width: 250px;
    border-right: 1px solid #e0e0e0;
    padding-right: 15px;
}
.cv-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.cv-sidebar ul li {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s ease, font-weight 0.3s ease;
    border-radius: 5px;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.95em;
}
.cv-sidebar ul li:hover {
    background: #e9e9e9;
    color: #333;
}
.cv-sidebar ul li.active {
    background: #e0e0e0;
    font-weight: bold;
    color: #0073aa; /* Accent color for active state */
}

/* Content input area styles */
.cv-content-wrapper {
    flex: 1;
    max-width: 600px; /* Optimal width for form inputs */
    padding-left: 20px; /* Space from sidebar */
}
.cv-content {
    display: none; /* Hidden by default, activated by JS */
    padding: 0; /* Padding handled by section-block */
}
.cv-content.active {
    display: block;
}

/* CV Preview Area Styles */
.cv-preview {
    flex: 1;
    border: 1px solid #ddd;
    padding: 25px;
    background: #ffffff; /* White background for the CV itself */
    max-width: 400px; /* Standard CV width */
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto; /* Enable scrolling if CV content is too long */
    max-height: 800px; /* Limit preview height, adjust as needed */
    position: sticky; /* Keeps preview visible while scrolling form */
    top: 20px; /* Distance from top of viewport */
}

/* Form Group Styles */
.cv-form-group {
    margin-bottom: 18px;
}
.cv-form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #333;
    font-size: 1em;
}
.cv-form-group input, .cv-form-group textarea, .cv-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1rem;
    color: #333;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.cv-form-group input:focus, .cv-form-group textarea:focus, .cv-form-group select:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.25);
    outline: none;
}
.cv-form-group input[type="date"] {
    /* Specific styling for date inputs if needed */
}

/* Photo preview in form */
#photo_preview_display { /* Specific ID for the form photo preview */
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #e0e0e0;
    margin-top: 15px;
    margin-bottom: 20px;
    background-size: cover;
    background-position: center;
    border: 3px solid #0073aa;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Styling for each section block in the input area */
.section-block {
    margin-bottom: 35px;
    border-top: 1px dashed #ddd;
    padding-top: 25px;
}
.section-block:first-child {
    border-top: none;
    padding-top: 0;
}
.section-block h3 {
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.6rem;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
    display: inline-block; /* Makes border-bottom only as wide as text */
}

/* Dynamic entry styling (for repeatable sections like experience, education) */
.dynamic-entry {
    position: relative;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    background-color: #fcfcfc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.remove-entry {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 5px 8px;
    border-radius: 50%;
    background-color: #ffebeb;
    line-height: 1;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.remove-entry:hover {
    background-color: #e74c3c;
    color: #fff;
}

/* Add button styling */
.add-button {
    background: #0073aa;
    color: white;
    padding: 10px 18px;
    border: none;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 5px;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.add-button:hover {
    background: #005a87;
    transform: translateY(-1px);
}

/* Export options styling */
.export-options {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
    text-align: center;
}
.export-options select, .export-options button {
    padding: 10px 18px;
    margin: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 1rem;
    cursor: pointer;
    background-color: #fefefe;
    transition: all 0.3s ease;
}
.export-options button {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}
.export-options button:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
}
.export-options select:focus, .export-options button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.25);
}

/* Preview section styling for the "Default Template" */
.cv-preview .resume-title {
    text-align: center;
    font-size: 2.2em;
    color: #0073aa;
    margin-bottom: 25px;
    font-weight: bold;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}
.cv-preview .resume-title span {
    color: #333;
}

.cv-preview .template-default {
    display: flex; /* For browser preview, will be overwritten by float in mPDF CSS */
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.cv-preview .cv-header-section {
    background-color: #f8f8f8;
    padding: 20px;
    display: flex; /* For browser preview, will be overwritten by float in mPDF CSS */
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.cv-preview .profile-photo-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #0073aa;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cv-preview #final-photo-preview { /* The actual photo div in HTML */
    width: 100%;
    height: 100%;
    background-size: cover; /* For browser */
    background-position: center; /* For browser */
    border-radius: 50%;
    background-color: #ccc; /* Placeholder */
    /* For mPDF, the actual <img> tag inside this div will be rendered */
}
.cv-preview #final-photo-preview img { /* Specific style for img tag inside final-photo-preview */
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cv-preview .header-content {
    flex-grow: 1;
}

.cv-preview .cv-name {
    font-size: 1.8em;
    margin: 0 0 5px 0;
    color: #333;
    font-weight: bold;
}

.cv-preview .cv-designation {
    font-size: 1.1em;
    color: #555;
    margin: 0;
}

.cv-preview .cv-body-section {
    display: flex; /* For browser preview, will be overwritten by float in mPDF CSS */
    flex-wrap: wrap;
    padding: 0;
}

.cv-preview .cv-left-column {
    flex: 1; /* For browser preview */
    padding-right: 15px;
    border-right: 1px solid #f0f0f0;
    min-width: 150px;
}

.cv-preview .cv-right-column {
    flex: 2; /* For browser preview */
    padding-left: 20px;
    min-width: 250px;
}

.cv-preview .preview-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #eee;
}
.cv-preview .preview-section:last-child {
    border-bottom: none;
}
.cv-preview .preview-section h3 {
    font-size: 1.2em;
    color: #0073aa;
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
    display: inline-block;
}
.cv-preview .preview-section p,
.cv-preview .preview-section ul {
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 8px;
    color: #444;
}
.cv-preview .preview-section ul {
    list-style: none;
    padding: 0;
    margin-left: 0;
}
.cv-preview .preview-section ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 5px;
}
.cv-preview .preview-section ul li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: #0073aa;
    font-weight: bold;
}
.cv-preview .preview-section strong {
    color: #333;
}

/* Specific style for address checkbox label alignment */
.address-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    margin-bottom: 15px;
}
.address-checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cv-wrapper {
        flex-direction: column;
        padding: 15px;
    }
    .cv-sidebar, .cv-content-wrapper, .cv-preview {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
        border-right: none;
    }
    .cv-sidebar ul {
        flex-direction: column;
        border-bottom: 1px solid #eee;
        margin-bottom: 20px;
    }
    .cv-sidebar ul li {
        text-align: left;
        border-right: none;
        border-radius: 5px;
        margin-bottom: 5px;
    }
    .cv-sidebar ul li:last-child {
        border-bottom: 1px solid #f0f0f0;
    }
    .cv-content-wrapper {
        padding-left: 0;
    }
    .cv-preview {
        margin-top: 20px;
        position: relative;
        top: auto;
        max-height: none;
    }
    .cv-preview .cv-body-section {
        flex-direction: column;
    }
    .cv-preview .cv-left-column,
    .cv-preview .cv-right-column {
        border-right: none;
        padding-right: 0;
        padding-left: 0;
        min-width: 100%;
    }
    .cv-preview .cv-left-column {
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
        margin-bottom: 15px;
    }
    .export-options {
        flex-direction: column;
    }
    .export-options select, .export-options button {
        width: 100%;
        margin: 5px 0;
    }
}