/* Improve page flow for printing */
@page {
    margin: 1.5cm;
    size: A4;
}

/* Reset background colors and shadows for printing */
body, .section, header, footer {
    background: none !important;
    color: black !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide decorative elements */
.car, .road, .road-line, .theme-toggle {
    display: none !important;
}

/* Hide profile photo on print */
.profilepic {
    display: none !important;
}

/* Adjust header for print */
header {
    border-bottom: 1px solid #000;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ensure text is black for better printing */
h1, h2, h3, p, li {
    color: black !important;
}

/* Adjust section spacing for better page flow */
.section {
    break-inside: auto;
    page-break-inside: auto;
    margin: 10px 0 !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #eee;
}

/* Optimize section headings */
.section h2 {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px !important;
}

/* Adjust introduction section */
.introduction.section {
    margin-bottom: 5px !important;
}

/* Make certifications more compact */
.certifications.section {
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

.certifications.section ul.bullets {
    margin-top: 5px !important;
    margin-bottom: 5px !important;
    columns: 2;
}

/* Ensure experience section starts on first page */
.experience.section {
    margin-top: 10px !important;
    page-break-before: avoid !important;
}

/* Fix company logos for print */
.company-logo {
    max-width: 50px !important;
    height: auto !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

/* Consolidate img[data-src] rules */
img[data-src] {
    visibility: visible !important;
}

/* Fix for lazy-loaded images in print */
@media print {
    /* Force logos to load their actual images */
    .company-logo[src^="data:image/svg+xml"] {
        visibility: visible !important;
    }
    
    /* Ensure all company logos are visible */
    .title-and-logo img {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Position styling */
.position {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid #eee;
}

.position:last-child {
    border-bottom: none;
}

.position h3 {
    margin-top: 0 !important;
    margin-bottom: 3px !important;
    font-size: 13pt !important;
}

.position p em {
    color: #666 !important;
    font-style: italic !important;
    font-size: 10pt !important;
}

/* Optimize list spacing */
ul.bullets {
    padding-left: 20px !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

li {
    margin-bottom: 3px !important;
    font-size: 10pt !important;
    line-height: 1.3 !important;
}

/* Compact tools section */
.position p strong {
    display: inline !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    color: #333 !important;
    font-size: 10pt !important;
    vertical-align: baseline !important;
}

/* Make tools text appear on the same line with proper alignment */
.position p:has(strong) {
    display: block !important;
    line-height: 1.5 !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

/* Add a small space after "Tools:" text */
.position p strong:after {
    content: " " !important;
}

/* Make education and other sections more compact */
.education.section, .extracurriculars.section, .skill.section, .awards.section {
    margin-top: 5px !important;
    margin-bottom: 5px !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

/* Optimize font sizes for print */
h1 { font-size: 20pt !important; }
h2 { font-size: 14pt !important; }
h3 { font-size: 12pt !important; }
p, li { font-size: 10pt !important; line-height: 1.3 !important; }

/* Show full URLs for links */
a[href]:after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #666;
}

/* Ensure footer stays at bottom */
footer {
    position: static !important;
    margin-top: 15px !important;
    border-top: 1px solid #000;
    padding-top: 10px !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
}

/* Remove animations and transitions */
* {
    animation: none !important;
    transition: none !important;
}

/* Ensure dark mode doesn't affect printing */
@media print {
    /* Force light mode for printing */
    :root, [data-theme="dark"] {
        --primary-color: #000000 !important;
        --secondary-color: #000000 !important;
        --text-color: #000000 !important;
        --background-color: #ffffff !important;
    }
    
    /* Override dark mode text colors */
    [data-theme="dark"] p,
    [data-theme="dark"] li,
    [data-theme="dark"] h1,
    [data-theme="dark"] h2,
    [data-theme="dark"] h3 {
        color: #000000 !important;
    }
    
    /* Override dark mode link colors */
    [data-theme="dark"] a {
        color: #000000 !important;
    }
    
    /* Remove watermark */
    body::after {
        content: none !important;
    }
    
    /* Force all lazy-loaded images to display */
    img[data-src] {
        visibility: visible !important;
    }
    
    /* Replace placeholder SVGs with actual images */
    img[src^="data:image/svg+xml"][data-src] {
        content: attr(data-src);
    }
}

/* Make title-and-logo more compact */
.title-and-logo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px !important;
}

/* Two-column layout for skills and extracurriculars */
@media print {
    .skill.section ul.bullets,
    .extracurriculars.section ul.bullets {
        columns: 2;
        column-gap: 20px;
    }
}

/* Hide LinkedIn contact in print version */
.profile-content a[href^="https://www.linkedin.com"] {
    display: none !important;
}

/* Remove LinkedIn URL display */
a[href^="https://www.linkedin.com"]:after {
    content: none !important;
}

/* Prevent page breaks before footer */
.awards.section {
    page-break-after: avoid !important;
}

/* Hide Contact Me line in print version */
.profile-content p b, 
.profile-content p:has(b) {
    display: none !important;
}

/* Hide Major Projects section during printing */
.projects.section {
    display: none !important;
}