:root {
    --primary-blue: #0061f2;
    --dark-gray: #212529;
    --light-bg: #f8f9fa;
    --paper-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

body.light-mode { background-color: #f4f7f6; color: var(--dark-gray); }
body.dark-mode { background-color: #1a1a1a; color: #ffffff; }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

/* Ad Placeholders */
.ad-placeholder {
    background: #e9ecef;
    border: 1px dashed #adb5bd;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}
.leaderboard { height: 90px; width: 100%; max-width: 728px; margin: 0 auto; }
.responsive-ad { height: 100px; width: 100%; }
.sidebar-ad { height: 250px; width: 300px; }

/* CV Preview Container (A4 Simulation) */
.preview-canvas {
    background-color: #525659;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    max-height: 80vh;
    border-radius: 8px;
}

/* Fix for the top alignment */
#cv-render {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 15mm; /* Reduced slightly for better university standard layout */
    box-shadow: var(--paper-shadow);
    transform-origin: top center;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box; /* Ensures padding doesn't increase width */
}

/* Remove default browser margins from the first element in the CV */
#cv-render header:first-child,
#cv-render h1:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Ensure sections stay together and don't break awkwardly */
section {
    page-break-inside: avoid;
    margin-bottom: 15px;
}

/* A4 Print Optimization */
@media print {
    #cv-render {
        margin: 0;
        padding: 15mm;
        box-shadow: none;
    }
}

/* Templates Styling */
.modern-blue h1 { color: var(--primary-blue); font-family: 'Inter', sans-serif; border-bottom: 2px solid var(--primary-blue); padding-bottom: 10px; }
.modern-blue .section-title { color: var(--primary-blue); font-weight: bold; text-transform: uppercase; font-size: 1rem; border-bottom: 1px solid #ddd; margin-top: 15px; margin-bottom: 10px;}

.minimal-black h1 { font-family: 'Playfair Display', serif; text-align: center; border-bottom: 3px double #000; }
.minimal-black .section-title { font-weight: 900; background: #000; color: #fff; padding: 2px 10px; margin-top: 15px; }

/* Dynamic Entry Styling */
.dynamic-entry {
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}
.remove-btn { position: absolute; top: 10px; right: 10px; color: #dc3545; cursor: pointer; }

/* UI Elements */
.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: var(--primary-blue);
    font-weight: 600;
}

/* PDF Print Correction */
@media print {
    body * { visibility: hidden; }
    #cv-render, #cv-render * { visibility: visible; }
    #cv-render { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; }
}

/* Responsiveness */
@media (max-width: 1200px) {
    #cv-render { transform: scale(0.8); }
}
@media (max-width: 992px) {
    #cv-render { transform: scale(0.6); }
    .preview-canvas { max-height: 500px; }
}