/* ==================== PRINT STYLES ==================== */
@media print {
    /* Hide non-print elements */
    .no-print,
    .page-controls {
        display: none !important;
    }

    /* Page setup */
    @page {
        size: letter;
        margin: 0.5in;
    }

    /* Reset body for print */
    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    /* Resume container adjustments */
    .resume-container {
        max-width: 100%;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    /* Typography adjustments for print */
    .resume-header h1 {
        font-size: 2rem;
        color: #1e40af;
    }

    .resume-header .title {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.25rem;
        color: #1e40af;
        page-break-after: avoid;
    }

    /* Prevent page breaks inside elements */
    .resume-section,
    .experience-entry,
    .competency-category,
    .education-entry,
    .achievement-stat {
        page-break-inside: avoid;
    }

    /* Ensure headings don't get orphaned */
    h1, h2, h3, h4 {
        page-break-after: avoid;
    }

    /* Adjust spacing for print */
    .resume-section {
        margin-bottom: 1.5rem;
    }

    .experience-entry {
        margin-bottom: 1.25rem;
        padding-bottom: 1.25rem;
    }

    /* Compact grids for print */
    .competencies-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .education-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .achievements-summary {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.75rem;
    }

    /* Smaller stat boxes for print */
    .achievement-stat {
        padding: 1rem 0.5rem;
        background: #e0e7ff;
        color: #1e40af;
    }

    .stat-number {
        font-size: 1.5rem;
        color: #1e40af;
    }

    .stat-label {
        font-size: 0.65rem;
        color: #1e40af;
    }

    /* Adjust font sizes for print readability */
    .summary-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .role-summary {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .achievements li {
        font-size: 0.85rem;
        line-height: 1.6;
        padding: 0.3rem 0 0.3rem 1.5rem;
    }

    .competency-category li,
    .tech-category p {
        font-size: 0.8rem;
    }

    /* Ensure borders and backgrounds print */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Links should show as normal text in print */
    a {
        text-decoration: none;
        color: inherit;
    }

    /* Compact contact info */
    .contact-info {
        gap: 1rem;
        font-size: 0.85rem;
    }

    /* Reduce padding on colored backgrounds */
    .competency-category,
    .education-entry,
    .tech-category {
        padding: 0.75rem;
    }

    /* Ensure tech grid is compact */
    .tech-grid {
        gap: 0.75rem;
    }

    /* Adjust header spacing */
    .resume-header {
        padding-bottom: 1rem;
        margin-bottom: 1.25rem;
    }
}

/* ==================== PRINT OPTIMIZATION FOR MULTI-PAGE ==================== */
@media print {
    /* Keep related content together */
    .experience-header,
    .position-info {
        page-break-inside: avoid;
        page-break-after: avoid;
    }

    /* Prevent awkward breaks in achievement lists */
    .achievements {
        orphans: 3;
        widows: 3;
    }

    .achievements li {
        page-break-inside: avoid;
    }

    /* Start major sections on new area if needed */
    .resume-section {
        orphans: 2;
        widows: 2;
    }
}
