/* General Resets and Typography */
body {
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
    /* Hide main body scroll, components scroll independently */
    background-color: #f8f9fa;
}

.workspace-container {
    height: calc(100vh - 60px);
    /* Changed to min-height so content can expand */
}

/* Editor Panel Styling */
.editor-panel {
    border-right: 1px solid #dee2e6;
}

.form-scroll-area {
    scroll-behavior: smooth;
}

.accordion-button:not(.collapsed) {
    background-color: #f0f7ff;
    color: #0d6efd;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .125);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0, 0, 0, .125);
}

/* Dynamic Item Styling */
.dynamic-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-remove-item {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Right Panel - Live Preview Area */
.preview-panel {
    background-color: #e9ecef;
    overflow-y: auto;
    padding: 20px;
    height: 100%;
}

/* Ensure the wrapper can scroll down far enough to show scaled content */
.preview-panel::-webkit-scrollbar {
    width: 8px;
}

.preview-panel::-webkit-scrollbar-thumb {
    background-color: #adb5bd;
    border-radius: 4px;
}

/* 
 * The CV Page Itself (A4 Aspect Ratio) 
 * 210mm x 297mm -> Aspect ratio 1:1.414
 */
.cv-page {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    font-family: 'Merriweather', serif;
    /* Professional serif font for the CV */
    color: #333;
    transition: all 0.3s ease;
    transform-origin: top center;
}

/* Responsive Scaling for the Preview on Smaller Screens */
@media (max-width: 1400px) {
    .cv-page {
        transform: scale(0.85);
        margin-bottom: -15%;
    }
}

@media (max-width: 1200px) {
    .cv-page {
        transform: scale(0.7);
        margin-bottom: -30%;
    }
}

@media (max-width: 991px) {
    body {
        overflow: auto;
        height: auto;
    }

    .workspace-container {
        height: auto;
    }

    .editor-panel {
        border-right: none;
        margin-bottom: 2rem;
    }

    .cv-page {
        transform: scale(0.6);
        margin-bottom: -40%;
    }

    .form-scroll-area {
        max-height: 60vh;
    }
}

@media (max-width: 576px) {
    .cv-page {
        transform: scale(0.45);
        margin-bottom: -55%;
        margin-left: -5%;
    }
}

/* CV Internal Styling */
.cv-header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
}

.cv-name {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cv-headline {
    font-size: 16px;
    color: #555;
    font-weight: 400;
    margin: 0 0 10px 0;
    font-style: italic;
}

.cv-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    color: #444;
}

.cv-contact-list li {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cv-section {
    margin-bottom: 20px;
}

.cv-section-title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    color: #222;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    page-break-after: avoid;
    break-after: avoid;
}

.cv-summary-text {
    font-size: 13.5px;
    line-height: 1.6;
    text-align: justify;
}

/* CV Lists (Experience & Education) */
.cv-item {
    margin-bottom: 15px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}

.cv-item-title {
    font-weight: 700;
    font-size: 15px;
    margin: 0;
}

.cv-item-subtitle {
    font-style: italic;
    font-size: 14px;
    color: #555;
    margin: 0;
}

.cv-item-date {
    font-size: 13px;
    color: #666;
    font-family: 'Inter', sans-serif;
}

.cv-item-desc {
    font-size: 13.5px;
    line-height: 1.5;
    margin-top: 5px;
}

/* Skills */
.cv-skill-group {
    margin-bottom: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    page-break-inside: avoid;
    break-inside: avoid;
}

.cv-skill-name {
    font-weight: 700;
    margin-right: 5px;
}