/* A4 Print & CV View Optimization */

/* ========== Page Setup for Printing ========== */
@page {
    size: A4;
    margin: 0.5in 0.5in 0.5in 0.5in;
}

/* ========== CV Mode Toggle ========== */
body.cv-mode {
    background: white !important;
}

body.cv-mode #mainNav {
    position: static !important;
    border-bottom: 1px solid #ddd !important;
    background: #f8f9fa !important;
    margin-bottom: 0 !important;
    padding: 0.5rem 0 !important;
    box-shadow: none !important;
}

body.cv-mode #mainNav .navbar-brand {
    font-size: 1rem;
}

body.cv-mode #main-content-wrapper {
    max-width: 8.5in;
    margin: 0 auto;
    padding: 0.5in;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* ========== Typography for CV ========== */
body.cv-mode section header h2 {
    font-size: 14pt !important;
    font-weight: 600 !important;
    color: #3948d2 !important;
    line-height: 1.2 !important;
    margin: 0.3in 0 0.15in 0 !important;
    border-bottom: 2px solid #3948d2;
    padding-bottom: 0.1in;
}

body.cv-mode section .main-body {
    font-size: 10pt !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    color: #333;
}

body.cv-mode section .main-body p {
    margin-bottom: 0.1in !important;
}

body.cv-mode section .main-body ul,
body.cv-mode section .main-body ol {
    margin-bottom: 0.1in !important;
    margin-left: 0.2in !important;
    padding-left: 0 !important;
}

body.cv-mode section .main-body li {
    margin-bottom: 0.05in !important;
    line-height: 1.3 !important;
}

body.cv-mode section .main-body a {
    color: #3948d2;
    text-decoration: none;
    word-break: break-word;
}

/* ========== Spacing & Layout ========== */
body.cv-mode #avatar {
    position: static !important;
    height: auto !important;
    top: auto !important;
    max-width: none !important;
    margin: 0 0 0.2in 0 !important;
    text-align: center;
}

body.cv-mode #avatar img {
    height: 100px !important;
    width: 100px !important;
    border-radius: 50%;
}

body.cv-mode section {
    margin: 0 !important;
    padding: 0.2in 0 !important;
    background: transparent !important;
}

body.cv-mode section.bg-gradient-primary-to-secondary-light,
body.cv-mode section.bg-gradient-primary-to-secondary-gray {
    background: white !important;
}

body.cv-mode .container {
    max-width: 100% !important;
    padding: 0 !important;
}

body.cv-mode section hr {
    margin: 0.1in 0 !important;
    border-top: 1px solid #ddd;
}

/* ========== Hide Non-Essential Elements ========== */
body.cv-mode .top-section {
    padding: 0.3in 0 !important;
    height: auto !important;
    background: transparent url('/static/assets/img/background.jpg') no-repeat center / cover !important;
}

body.cv-mode .top-section:before {
    display: none !important;
}

body.cv-mode .top-section h1,
body.cv-mode .top-section h2 {
    font-size: 12pt !important;
    line-height: 1.2 !important;
    margin: 10px !important;
}

body.cv-mode .top-section-content {
    padding: 0 !important;
}

body.cv-mode #latest-update {
    display: none !important;
}

body.cv-mode footer {
    margin-top: 0.3in;
    padding: 0.15in 0;
    border-top: 1px solid #ddd;
    font-size: 8pt;
    background: white !important;
}

body.cv-mode footer a {
    color: #3948d2;
}

/* ========== Print Specific Styles ========== */
@media print {
    body,
    html {
        width: 8.5in;
        height: 11in;
        margin: 0;
        padding: 0;
        background: white;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a {
        text-decoration: underline;
    }

    section header h2 {
        page-break-after: avoid;
    }

    .main-body ul,
    .main-body ol {
        page-break-inside: avoid;
    }

    .main-body li {
        page-break-inside: avoid;
    }

    body:not(.cv-mode) #mainNav {
        display: none;
    }

    body:not(.cv-mode) #avatar {
        display: none;
    }

    body:not(.cv-mode) #latest-update {
        display: none;
    }

    body:not(.cv-mode) section {
        page-break-inside: avoid;
    }

    body:not(.cv-mode) footer {
        margin-top: 1in;
    }
}

/* ========== Responsive adjustments ========== */
@media screen and (max-width: 768px) {
    body.cv-mode #main-content-wrapper {
        max-width: 100%;
        margin: 0;
        padding: 0.25in;
        box-shadow: none;
    }

    body.cv-mode section header h2 {
        font-size: 12pt !important;
    }

    body.cv-mode section .main-body {
        font-size: 9pt !important;
    }
}

/* ========== CV Button Styling ========== */
#cv-toggle-btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    white-space: nowrap;
}

#cv-toggle-btn.active {
    background-color: #28a745;
    border-color: #28a745;
}
