/* =========================================================
   Classic LaTeX / Ivy League Minimalist CV Style
   Typography: Times New Roman (Body) & Elegant Serif (Name)
   Strictly Calibrated for Exact 1-Page A4 Printing
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@600;700;800&display=swap');

:root {
    --font-main: 'Times New Roman', Times, 'Liberation Serif', serif;
    --font-name: 'EB Garamond', 'Times New Roman', Times, serif;
    --text-color: #000000;
    --line-color: #000000;
    --bg-page: #f1f2f5;
    --bg-cv: #ffffff;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 12.8px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-color);
    line-height: 1.3;
    min-height: 100vh;
    padding: 24px 0 40px;
}

/* --- Controls / Action Bar --- */
.controls-bar {
    position: sticky;
    top: 14px;
    margin: 0 auto 18px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    max-width: 650px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #1e293b;
    color: #ffffff;
    border: 1px solid #334155;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}

.btn-action-primary {
    background: #1d4ed8;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.35);
}

.btn-action-primary:hover {
    background: #1e40af;
    border-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(29, 78, 216, 0.45);
}

.btn-action svg {
    flex-shrink: 0;
}

/* --- Exact A4 Paper Container (210mm x 297mm) --- */
.cv-paper {
    width: 210mm;
    height: 297mm;
    max-height: 297mm;
    margin: 0 auto;
    background: var(--bg-cv);
    padding: 12mm 15mm 12mm 15mm;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* --- Header --- */
.cv-header {
    text-align: center;
    margin-bottom: 6px;
}

/* Tên nổi bật với font đẹp, cỡ to */
.candidate-name {
    font-family: var(--font-name);
    font-size: 2.35rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    line-height: 1.1;
    color: var(--text-color);
    margin-bottom: 3px;
    text-transform: none;
}

.contact-info {
    font-family: var(--font-main);
    font-size: 0.90rem;
    color: #111111;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    line-height: 1.25;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    color: #000000;
    text-decoration: none;
}

.contact-item a {
    color: inherit;
    text-decoration: none;
}

.contact-item a:hover {
    text-decoration: underline;
}

.divider {
    color: #444;
    user-select: none;
}

/* --- Sections --- */
.cv-section {
    margin-top: 6px;
    margin-bottom: 0;
}

.section-title {
    font-family: var(--font-main);
    font-size: 0.98rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-color);
    border-bottom: 0.9px solid var(--line-color);
    padding-bottom: 1px;
    margin-bottom: 4px;
}

/* Objective Text */
.objective-text {
    font-size: 0.91rem;
    line-height: 1.32;
    text-align: justify;
    color: #000000;
}

/* Section Entries */
.cv-entry {
    margin-bottom: 5px;
}

.cv-entry:last-child {
    margin-bottom: 0;
}

/* Entry Header (Flex 2 columns) */
.entry-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 0.94rem;
    line-height: 1.25;
    margin-bottom: 1px;
}

.entry-title {
    font-weight: 700;
    color: #000000;
}

.entry-location {
    font-weight: 400;
    color: #111111;
    text-align: right;
    white-space: nowrap;
}

.entry-row-2 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 0.90rem;
    font-style: italic;
    color: #222222;
    line-height: 1.25;
    margin-bottom: 2px;
}

.entry-subtitle {
    font-style: italic;
}

.entry-date {
    font-style: italic;
    text-align: right;
    white-space: nowrap;
}

/* Bullet points list */
.bullet-list {
    list-style-type: disc;
    margin-left: 17px;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bullet-list li {
    font-size: 0.90rem;
    line-height: 1.28;
    text-align: justify;
    color: #000000;
}

.bullet-list li strong {
    font-weight: 700;
    color: #000000;
}

/* Skills list */
.skills-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.90rem;
    line-height: 1.28;
}

.skill-row {
    display: block;
    text-align: justify;
}

.skill-row strong {
    font-weight: 700;
    color: #000000;
}

/* Monochrome links & compact certifications */
.cv-paper a {
    color: #000000;
    text-decoration: none;
}

.cv-paper a:hover {
    text-decoration: underline;
}

.cv-paper a.inline-link {
    color: #111111;
    text-decoration: underline;
    text-decoration-thickness: 0.6px;
    text-underline-offset: 1.5px;
}

.cert-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 0.90rem;
    line-height: 1.28;
    margin-bottom: 3px;
}

.cert-row:last-child {
    margin-bottom: 0;
}

.cert-meta {
    font-style: italic;
    color: #222222;
    white-space: nowrap;
}

/* --- Responsive for Screen Preview --- */
@media screen and (max-width: 860px) {
    body {
        padding: 60px 10px 20px;
    }

    .controls-bar {
        position: fixed;
        top: 10px;
        right: 10px;
        left: 10px;
        justify-content: flex-end;
    }

    .cv-paper {
        width: 100%;
        height: auto;
        max-height: none;
        padding: 20px 16px;
    }

    .candidate-name {
        font-size: 1.8rem;
    }

    .entry-row-1, .entry-row-2 {
        flex-direction: column;
        align-items: flex-start;
    }

    .entry-location, .entry-date {
        text-align: left;
        margin-top: 1px;
    }

    .cert-row {
        flex-direction: column;
        gap: 1px;
    }

    .bullet-list {
        margin-left: 15px;
    }
}

/* --- Exact 1-Page A4 Print Optimization --- */
@media print {
    .no-print, .controls-bar {
        display: none !important;
    }

    html, body {
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        color: #000000 !important;
        font-size: 9.8pt !important;
        font-family: 'Times New Roman', Times, serif !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cv-paper {
        width: 100% !important;
        height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 10mm 14mm 10mm 14mm !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        overflow: hidden !important;
    }

    .candidate-name {
        font-family: 'EB Garamond', 'Times New Roman', Times, serif !important;
        font-size: 22pt !important;
        margin-bottom: 2pt !important;
    }

    .contact-info {
        font-size: 8.7pt !important;
        gap: 4pt !important;
    }

    .cv-section {
        margin-top: 5pt !important;
        break-inside: avoid !important;
    }

    .section-title {
        font-size: 10pt !important;
        border-bottom: 0.8pt solid #000000 !important;
        padding-bottom: 1pt !important;
        margin-bottom: 3pt !important;
    }

    .entry-row-1 {
        font-size: 9.4pt !important;
        margin-bottom: 0.5pt !important;
    }

    .entry-row-2 {
        font-size: 8.8pt !important;
        margin-bottom: 1.5pt !important;
    }

    .bullet-list li {
        font-size: 8.8pt !important;
        line-height: 1.25 !important;
    }

    .skills-list {
        font-size: 8.8pt !important;
        gap: 2.5pt !important;
    }

    .cert-row {
        font-size: 8.8pt !important;
        line-height: 1.25 !important;
        margin-bottom: 2pt !important;
    }

    .cert-row:last-child {
        margin-bottom: 0 !important;
    }

    .objective-text {
        font-size: 8.8pt !important;
        line-height: 1.26 !important;
    }

    @page {
        margin: 0;
        size: A4 portrait;
    }
}
