/* Print Styles for Portfolio */

@page {
    size: A4;
    margin: 0.8cm;
}

@media print {
    /* Hide elements not needed for print */
    .d-print-none,
    header button,
    footer,
    .btn,
    .navbar-toggler,
    .social-icon,
    .social-links-container,
    .profile-image-container .profile-socials,
    .print-message {
        display: none !important;
    }
    
    /* Ensure everything with print-visible class is shown */
    .print-visible {
        display: block !important;
        visibility: visible !important;
        height: auto !important;
        overflow: visible !important;
        opacity: 1 !important;
    }
    
    /* General Print Settings */
    body, body.is-printing, body.preparing-for-print {
        font-size: 10pt !important;
        line-height: 1.3 !important;
        background: #fff !important;
        color: #000 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Fix for blank space at end of document */
    html, body {
        height: auto !important;
    }
    
    /* Container that holds all main content */
    main.container {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Adjust main container */
    .container, .row, .col-md-10, .col-md-8, .col-md-6, .col-md-4, .col-md-3, .col-md-9 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Force all sections to display */
    section {
        display: block !important;
        visibility: visible !important;
        overflow: visible !important;
        margin-bottom: 0.1cm !important; /* Minimal space between sections */
        page-break-inside: auto !important; /* Allow page breaks within sections */
        break-inside: auto !important;
    }
    
    /* Remove shadows and borders for cleaner print */
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        margin-bottom: 0.2cm !important; /* Reduce space between cards */
        page-break-inside: auto !important; /* CRITICAL: Allow page breaks within cards */
        break-inside: auto !important;
        background-color: #fff !important;
    }
    
    .card-header {
        background: #f8f9fa !important;
        color: #000 !important;
        border-bottom: 1px solid #ddd !important;
        padding: 0.1cm 0.2cm !important; /* Reduce padding */
        margin-bottom: 0.1cm !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }
    
    .card-header::before {
        display: none !important;
    }
    
    .card-body {
        padding: 0.1cm 0.2cm !important; /* Reduce padding */
    }
    
    /* Compressing profile section */
    #profile .row {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
    }
    
    #profile .col-md-3 {
        width: 25% !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
        padding-right: 0.3cm !important;
    }
    
    #profile .col-md-9 {
        width: 75% !important;
        flex: 0 0 75% !important;
        max-width: 75% !important;
    }
    
    #profile .card-title {
        display: block !important;
        font-size: 16pt !important;
        font-weight: bold !important;
        margin-bottom: 0.1cm !important;
    }
    
    #profile h4.text-muted {
        font-size: 11pt !important; /* Reduce font size */
        margin-bottom: 0.2cm !important;
    }
    
    #profile .lead {
        font-size: 10pt !important;
        margin-bottom: 0.2cm !important;
    }
    
    .profile-image-container {
        max-width: 2.5cm !important; /* Smaller image */
        margin: 0 auto !important;
        border-radius: 8px !important;
    }
    
    .profile-img {
        max-width: 100% !important;
        height: auto !important;
        border: 1px solid #ccc !important;
        padding: 2px !important;
        border-radius: 8px !important;
    }
    
    /* Fix contact grid in print */
    .contact-info-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.1cm !important; /* Reduce gap */
        margin-bottom: 0.2cm !important;
    }
    
    .contact-item {
        width: 48% !important;
        padding: 0.1cm !important;
        background: none !important;
        margin-bottom: 0.1cm !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .contact-icon {
        margin-right: 0.2cm !important;
        color: #555 !important;
    }
    
    /* Fix links in print */
    a.print-link {
        color: #000 !important;
        text-decoration: none !important;
        font-weight: normal !important;
    }
    
    a.print-link:after {
        content: " (" attr(href) ")" !important;
        font-size: 8pt !important;
        color: #666 !important;
    }
    
    /* Adjust skills section */
    #skills .card-body {
        columns: 2 !important;
        column-gap: 0.8cm !important;
    }
    
    .skill-category-title {
        font-size: 11pt !important; /* Reduce font size */
        margin-top: 0.2cm !important;
        margin-bottom: 0.2cm !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
        font-weight: bold !important;
    }
    
    .skill-item {
        margin-bottom: 0.15cm !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    
    .progress {
        height: 6px !important; /* Smaller progress bars */
        margin-bottom: 0.15cm !important;
        background-color: #eee !important;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
    
    .progress-bar {
        background-color: #007bff !important;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
    
    /* Adjust badges */
    .badge {
        font-size: 8pt !important;
        padding: 0.08rem 0.15rem !important; /* Smaller padding */
        margin: 0.03cm !important; /* Smaller margin */
        border: 1px solid #999 !important;
        background-color: #f8f9fa !important;
        color: #000 !important;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
    
    /* Ensures colors are printed */
    .badge.bg-primary {
        background-color: #cfe2ff !important;
        border-color: #0d6efd !important;
    }
    
    .badge.bg-secondary {
        background-color: #e2e3e5 !important;
        border-color: #6c757d !important;
    }
    
    .badge.bg-success {
        background-color: #d1e7dd !important;
        border-color: #198754 !important;
    }
    
    .badge.bg-danger {
        background-color: #f8d7da !important;
        border-color: #dc3545 !important;
    }
    
    .badge.bg-warning {
        background-color: #fff3cd !important;
        border-color: #ffc107 !important;
    }
    
    .badge.bg-info {
        background-color: #cff4fc !important;
        border-color: #0dcaf0 !important;
    }
    
    .badge.bg-dark {
        background-color: #d3d3d4 !important;
        border-color: #212529 !important;
    }
    
    /* Adjust timeline items */
    .timeline-item {
        padding-left: 0.4cm !important;
        margin-bottom: 0.2cm !important;
        border-left: 2px solid #007bff !important;
        break-inside: auto !important; /* Allow breaks */
        page-break-inside: auto !important;
    }
    
    .timeline-item::before {
        width: 8px !important;
        height: 8px !important;
        left: -5px !important;
        background-color: #007bff !important;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
    
    .timeline-title {
        font-size: 11pt !important;
        margin-bottom: 0.1cm !important;
        font-weight: bold !important;
    }
    
    .timeline-subtitle {
        font-size: 10pt !important;
        font-weight: normal !important;
    }
    
    .timeline-date, .timeline-location {
        font-size: 9pt !important;
        display: inline-block !important;
        margin-right: 0.3cm !important;
    }
    
    .timeline-content ul {
        margin: 0.1cm 0 !important;
        padding-left: 0.6cm !important;
    }
    
    .timeline-content li {
        font-size: 9pt !important;
        margin-bottom: 0.03cm !important;
        line-height: 1.3 !important;
    }
    
    /* Ensure all sections are shown and properly spaced */
    #profile, #experience, #education, #skills, #achievements, #projects {
        display: block !important;
        visibility: visible !important;
        margin-bottom: 0.1cm !important; /* Minimal margins */
        page-break-inside: auto !important;
        break-inside: auto !important;
    }
    
    /* Allow page breaks between and within major sections */
    #education, #experience, #skills, #achievements, #projects {
        page-break-before: auto !important;
        break-before: auto !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
    }
    
    /* Ensure headers are visible */
    header {
        display: none !important;
    }
    
    .navbar-brand {
        color: #000 !important;
        font-size: 12pt !important;
    }
    
    .navbar-nav {
        display: none !important;
    }
    
    /* Project section specific fixes - COMPLETE REDESIGN */
    #projects .card-header {
        margin-bottom: 0 !important;
    }
    
    #projects .card-body {
        padding: 0 !important;
    }
    
    /* Remove original card styling */
    #projects .project-card {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Convert projects to table-like layout */
    #projects .row {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    #projects .col-md-6, 
    #projects .col-lg-4 {
        display: inline-block !important;
        width: 50% !important; /* Two columns layout */
        max-width: 50% !important;
        float: left !important;
        padding: 0 0.1cm !important;
        margin: 0 !important;
        border-bottom: 1px dotted #ddd !important;
        height: auto !important;
        vertical-align: top !important;
    }
    
    /* Compact project content */
    #projects .card-body {
        display: block !important;
        padding: 0.05cm !important;
        text-align: left !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    /* Horizontal layout for project titles */
    #projects .project-icon {
        display: none !important; /* Hide icons to save space */
    }
    
    #projects h5.project-title {
        display: block !important;
        font-size: 9pt !important;
        font-weight: bold !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.1 !important;
    }
    
    #projects .project-description {
        display: block !important;
        font-size: 8pt !important;
        margin: 0.02cm 0 !important;
        padding: 0 !important;
        line-height: 1.1 !important;
        color: #333 !important;
    }
    
    /* Hide buttons in print */
    #projects .btn, 
    #projects .d-flex {
        display: none !important;
    }
    
    /* Make tags more compact */
    #projects .project-tags {
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
    }
    
    #projects .badge {
        font-size: 7pt !important;
        padding: 0 0.05cm !important;
        margin: 0 0.02cm 0 0 !important;
        border: none !important;
        background: none !important;
        color: #555 !important;
    }
    
    #projects .badge:after {
        content: "," !important;
    }
    
    #projects .badge:last-child:after {
        content: "" !important;
    }
    
    /* Fix any element that might be causing page breaks */
    * {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }
    
    /* Fix the last element to avoid extra space at the end */
    main > section:last-child {
        margin-bottom: 0 !important;
    }
    
    /* General typography improvements for print */
    h3 {
        font-size: 12pt !important;
        margin-bottom: 0.2cm !important;
        color: #000 !important;
    }
    
    h4 {
        font-size: 11pt !important;
        margin-bottom: 0.1cm !important;
        color: #000 !important;
    }
    
    p {
        margin-bottom: 0.15cm !important;
    }
    
    /* Fix any floating elements */
    .clearfix::after {
        content: "" !important;
        display: table !important;
        clear: both !important;
    }
    
    /* Hide About Me text but keep name visible */
    #profile .card-header,
    #profile .card-header h3,
    .about-me-title,
    .about-section-title {
        display: none !important;
    }
    
    /* If the about text is in a paragraph with a specific class */
    #profile .lead:first-of-type,
    #profile .about-me-description,
    #profile .about-text {
        margin-top: 0 !important;
    }
    
    /* Ensure profile section still has proper spacing after removing header */
    #profile {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    /* Achievements & Conferences section specific fixes */
    #achievements .card-body {
        padding: 0.1cm !important;
    }
    
    #achievements .row {
        display: block !important;
        flex-direction: column !important;
    }
    
    #achievements .col-md-6, 
    #achievements .col-lg-4,
    #achievements .col-md-4,
    #achievements .col {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        float: none !important;
        display: block !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
        margin-bottom: 0.1cm !important;
    }
    
    #achievements .achievement-item,
    #achievements .conference-item {
        margin-bottom: 0.15cm !important;
        padding: 0.1cm !important;
        border-bottom: 1px dotted #ccc !important;
    }
    
    #achievements .achievement-item:last-child,
    #achievements .conference-item:last-child {
        border-bottom: none !important;
    }
    
    #achievements h5, 
    #achievements h6, 
    #achievements .item-title {
        font-size: 10pt !important;
        margin-bottom: 0.05cm !important;
        font-weight: bold !important;
    }
    
    #achievements p, 
    #achievements .item-description {
        font-size: 9pt !important;
        margin-bottom: 0.05cm !important;
    }
    
    #achievements .item-date,
    #achievements .item-location {
        font-size: 8pt !important;
        color: #555 !important;
    }
} 