/* ========================================
   CV Online - Exact Design Replica
   Author: Nguyễn Đức Thao
   Based on: Modern Resume Design Template
   ======================================== */

/* ========== CSS Variables ========== */
:root {
    /* Primary Colors - Matching Design */
    --primary-teal: #1aa3a3;
    --primary-teal-dark: #158585;
    --primary-teal-light: #2cc5c5;

    /* Background Colors */
    --sidebar-bg: #3d4f5f;
    --main-bg: #ffffff;
    --profile-bg: #1aa3a3;

    /* Text Colors */
    --text-dark: #2c3e50;
    --text-gray: #5a6c7d;
    --text-light: #ffffff;
    --text-muted: #8a9ba8;

    /* Other Colors */
    --gray-light: #f5f5f5;
    --gray-medium: #e0e0e0;
    --border-color: #dee2e6;
    --pdf-btn-bg: #e74c3c;

    /* Typography */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;

    /* Sizes */
    --sidebar-width: 280px;
    --page-max-width: 900px;
}

/* ========== Print Styles ========== */
@page {
    size: a4;
    margin: 0;
}

@media print {
    * {
        box-sizing: border-box !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    html {
        font-size: 12px !important;
    }

    body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 210mm !important;
    }

    .no-print,
    .back-to-top,
    .preloader,
    .download-container {
        display: none !important;
    }

    .cv-wrapper {
        gap: 0 !important;
        max-width: none !important;
        width: 210mm !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .no-print {
        display: none !important;
    }

    .qr-overlay {
        display: block !important;
    }

    /* Page 1 Header Adjust for Print */
    .page-1 .header-text {
        padding: 35px 40px 30px 120px !important;
    }

    .cv-container {
        box-shadow: none !important;
        page-break-after: always !important;
        break-after: page !important;
        width: 100% !important;
        max-width: 210mm !important;
        min-height: 297mm !important;
        border: none !important;
        margin: 0 !important;
        overflow: visible !important;
        background: white !important;
        position: relative !important;
        display: grid !important;
        grid-template-columns: 1fr 74mm !important;
        gap: 0 !important;
    }

    /* Unified Grid for all pages */
    .page-1,
    .page-2,
    .page-3 {
        display: grid !important;
        grid-template-columns: 1fr 74mm !important;
        grid-row-gap: 0 !important;
        background: white !important;
        width: 100% !important;
    }

    /* Main Content Area */
    .main-content,
    .experience-area,
    .profile-section,
    .header-text {
        grid-column: 1 / 2 !important;
        width: auto !important;
        /* Auto fill 1fr */
        box-sizing: border-box !important;
    }

    .main-content {
        padding: 10mm !important;
    }

    /* Sidebar Area */
    .sidebar,
    .header-photo {
        grid-column: 2 / 3 !important;
        width: 100% !important;
        /* Fill the 74mm column */
        box-sizing: border-box !important;
    }

    .sidebar {
        /* min-height: 297mm !important; */
        padding-top: 5mm !important;
        background: var(--sidebar-bg) !important;
        -webkit-print-color-adjust: exact !important;
    }

    /* Page 1 Special Logic */
    .page-1 {
        grid-template-rows: auto auto 1fr !important;
    }

    .page-1 .header-text {
        grid-row: 1 !important;
    }

    .page-1 .profile-section {
        grid-row: 2 !important;
    }

    .page-1 .experience-area {
        grid-row: 3 !important;
    }

    .page-1 .header-photo {
        grid-row: 1 / 3 !important;
        height: 100% !important;
    }

    .page-1 .sidebar {
        /* grid-row: 3 !important; */
    }

    /* Page 2 & 3 Special Logic */
    .page-2,
    .page-3 {
        grid-template-rows: 1fr !important;
    }

    .page-2 .main-content,
    .page-3 .main-content {
        grid-row: 1 !important;
    }

    .page-2 .sidebar,
    .page-3 .sidebar {
        grid-row: 1 !important;
    }

    /* Common content fixes */
    .main-content p {
        text-align: justify !important;
        line-height: 1.5 !important;
        margin-bottom: 8px !important;
        word-break: break-word !important;
    }

    .experience-item {
        margin-bottom: 12px !important;
        padding-bottom: 10px !important;
        page-break-inside: avoid !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        animation: none !important;
    }

    .skills-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .achievements-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .skill-category-card,
    .achievement-item,
    .sidebar-section {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        animation: none !important;
        page-break-inside: avoid !important;
    }

    /* Thu gọn 30% kích thước cho Skills & Achievements khi in layout */
    .skill-category-card,
    .achievement-item {
        padding: 6px 10px !important;
        margin-bottom: 5px !important;
    }

    .skill-cat-icon,
    .achievement-icon {
        width: 30px !important;
        height: 30px !important;
        margin-bottom: 5px !important;
    }

    .skill-cat-icon i,
    .achievement-icon i {
        font-size: 0.8rem !important;
    }

    .skill-category-card h4,
    .achievement-content h4 {
        font-size: 0.75rem !important;
        margin-bottom: 3px !important;
    }

    .skill-category-card p,
    .achievement-content p {
        font-size: 0.7rem !important;
        line-height: 1.3 !important;
    }

    /* Ensure all background colors and images show up */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* ========== Download Button Style ========== */
.download-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

/* ========== PDF Exporting Helper ========== */
body.pdf-exporting .no-print,
body.pdf-exporting .back-to-top,
body.pdf-exporting .download-container,
body.pdf-exporting #preloader {
    display: none !important;
}

body.pdf-exporting {
    background: white !important;
}

.btn-download {
    background: var(--pdf-btn-bg);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
    transition: all 0.3s ease;
}

.btn-download:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(231, 76, 60, 0.4);
    background: #c0392b;
}

.btn-download i {
    font-size: 1.1rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 40px 20px;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ========== Preloader ========== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    display: flex;
    gap: 8px;
}

.loader span {
    width: 12px;
    height: 12px;
    background: var(--primary-teal);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loader span:nth-child(1) {
    animation-delay: -0.32s;
}

.loader span:nth-child(2) {
    animation-delay: -0.16s;
}

.loader span:nth-child(3) {
    animation-delay: 0;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ========== CV Wrapper ========== */
.cv-wrapper {
    max-width: var(--page-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* ========== CV Container Base ========== */
.cv-container {
    background: var(--main-bg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.8s ease-out;
    overflow: visible;
    /* Cho phép giãn theo nội dung trên màn hình */
    margin: 0 auto;
}

/* ========== Page 1 Specific Grid Layout ========== */
.cv-container.page-1 {
    display: grid;
    grid-template-columns: 1fr 280px;
    /* Column 1: Main Content, Column 2: Sidebar/Photo */
    grid-template-rows: auto auto 1fr;
    /* Row 1: Header, Row 2: Profile (Teal), Row 3: Experience & Sidebar */
    background: var(--main-bg);
}

/* Header Text (Top Left) */
.page-1 .header-text {
    grid-column: 1 / 2;
    grid-row: 1;
    padding: 50px 40px 30px 40px;
    background: var(--main-bg);
    position: relative;
}

@media print {
    .page-1 .header-text {
        padding: 35px 40px 30px 120px !important;
    }
}

/* Photo (Top Right - Spans 2 rows) */
.page-1 .header-photo {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    /* Quan trọng: Trải qua cả hàng Header và Profile */
    width: 280px;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: var(--sidebar-bg);
}

.page-1 .header-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Profile Section (Mid Left) */
.page-1 .profile-section {
    grid-column: 1 / 2;
    grid-row: 2;
    background: var(--profile-bg);
    height: 210px;
    /* Chiều cao cố định thống nhất */
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    margin: 0;
    /* Hiệu ứng cắt chéo đúng design */
    clip-path: polygon(0 0, 26% 0, 32% 20%, 100% 20%, 100% 100%, 0 100%);
    z-index: 10;
}

/* Lớp phủ Teal đè lên ảnh - Cùng hàng Row 2 */
/* .page-1 .header-photo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 210px;
    background: rgba(26, 163, 163, 0.85);
    pointer-events: none;
    z-index: 5;
} */

/* Experience Area & Sidebar (Bottom) */
.page-1 .experience-area {
    grid-column: 1 / 2;
    grid-row: 3;
    padding: 0 40px 40px 40px;
    background: var(--main-bg);
}

.page-1 .sidebar {
    grid-column: 2 / 3;
    grid-row: 3;
    background: var(--sidebar-bg);
    color: var(--text-light);
    padding: 20px 0;
}

/* ========== Profile Section Details ========== */
.profile-section::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: var(--sidebar-bg);
    z-index: 2;
}

/* Khối màu xám chéo trang trí - Chỉ cho Trang 1 */
/* .page-1 .profile-section::after {
    content: '';
    position: absolute;
    top: -12px;
    right: 20%;
    width: 70px;
    height: 50px;
    background: var(--gray-medium);
    transform: skewX(-35deg);
    z-index: 1;
} */

.profile-header {
    margin-bottom: 5px;
    position: relative;
    z-index: 3;
}

.section-title-teal {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-light);
    border-bottom: 2px solid var(--text-light);
    display: inline-block;
    padding-bottom: 3px;
    margin-bottom: 10px;
}

.profile-content {
    position: relative;
    z-index: 3;
}

.profile-content p {
    font-size: 0.86rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    max-width: 100%;
    text-align: justify;
}

/* ========== Page 2 & 3 Specific Layout ========== */
.cv-container.page-2,
.cv-container.page-3 {
    display: grid;
    grid-template-columns: 1fr 280px;
    background: var(--main-bg);
    margin-top: 50px;
    min-height: 297mm;
    /* Đảm bảo đủ chiều cao trang A4 */
}

.page-2 .main-content,
.page-3 .main-content {
    grid-column: 1 / 2;
    /* Ép ở bên trái */
    background: var(--main-bg);
    padding: 20px 40px 40px 40px;
}

.page-2 .sidebar,
.page-3 .sidebar {
    grid-column: 2 / 3;
    /* Ép ở bên phải */
    background: var(--sidebar-bg);
    color: var(--text-light);
    padding-top: 20px;
}

/* ========== Common Styles ========== */
.main-content {
    background: var(--main-bg);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-dark);
    margin-bottom: 25px;
    padding-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.continued-badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    background: var(--primary-teal);
    color: var(--text-light);
    padding: 3px 10px;
    border-radius: 3px;
}

/* ========== Experience Section ========== */
.experience-section {
    margin-bottom: 30px;
}

.experience-item {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    position: relative;
}

.exp-timeline {
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.exp-timeline .year {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-teal);
    line-height: 1.3;
}

/* Timeline Connector Line */
/* Timeline Connector Line */
.experience-item::before {
    content: '';
    position: absolute;
    left: 76px;
    /* 50px (timeline width) + 20px (gap) + 6px (half dot width) */
    top: 22px;
    /* Dưới chấm tròn một chút */
    bottom: 0;
    /* Kéo dài hết chiều cao của item */
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-teal) 60%, var(--gray-light));
    z-index: 0;
}

.experience-item:last-child::before {
    display: none;
}

/* Force show timeline line for the last item on Page 1 (continued on Page 2) */
.page-1 .experience-item:last-child::before {
    display: block !important;
}

/* Force show timeline line for the last Experience item on Page 2 (to connect with Achievements below) */
.page-2 .experience-item:last-child::before {
    display: block !important;
    bottom: -40px;
    /* Extend a bit more to connect visually with the next section */

}

.exp-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-teal);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
    position: relative;
    z-index: 1;
    /* Nằm đè lên đường kẻ */
}

/* Xóa style cũ của .exp-dot::after */
.exp-dot::after {
    display: none;
}

.exp-content {
    flex: 1;
}

.exp-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}

.exp-company {
    font-size: 0.8rem;
    color: var(--primary-teal);
    margin-bottom: 8px;
}

.exp-desc {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 10px;
    line-height: 1.6;
}

.exp-list {
    margin-left: 0;
}

.exp-list li {
    position: relative;
    padding-left: 15px;
    font-size: 0.82rem;
    color: var(--text-gray);
    margin-bottom: 5px;
    line-height: 1.5;
}

.exp-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    width: 5px;
    height: 5px;
    background: var(--primary-teal);
    border-radius: 50%;
}

/* ========== Sidebar ========== */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--text-light);
    padding: 0;
    padding-top: 20px;
    position: relative;
}

/* Sidebar Sections */
.sidebar-section {
    padding: 10px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section:first-child {
    padding-top: 0;
}

.sidebar-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-light);
    margin-bottom: 15px;
}

/* Contact List */
.contact-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    transition: transform 0.3s ease;
}

.contact-list li:hover {
    transform: translateX(5px);
}

.contact-icon {
    width: 32px;
    height: 32px;
    background: rgba(26, 163, 163, 0.2);
    border: 1px solid var(--primary-teal);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.contact-list li:hover .contact-icon {
    background: var(--primary-teal);
}

.contact-icon i {
    font-size: 0.75rem;
    color: var(--primary-teal);
    transition: color 0.3s ease;
}

.contact-list li:hover .contact-icon i {
    color: var(--text-light);
}

.contact-list span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    word-break: break-word;
}

/* Education */
.education-item .edu-year {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-teal);
    margin-bottom: 5px;
}

.edu-degree {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-teal);
    margin-bottom: 3px;
}

.edu-school {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2px;
}

.edu-note {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Skills */
.skill-item {
    margin-bottom: 12px;
}

.skill-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    display: block;
    margin-bottom: 5px;
}

.skill-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-teal), var(--primary-teal-light));
    border-radius: 3px;
    width: 0;
    transition: width 1s ease-out;
}

/* ========== Page 2 Styles Detail ========== */

/* Expertise List */
.expertise-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.expertise-list li:last-child {
    border-bottom: none;
}

.expertise-list i {
    font-size: 0.65rem;
    color: var(--primary-teal);
}

/* Language */
.language-item {
    margin-bottom: 12px;
}

.lang-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    display: block;
    margin-bottom: 5px;
}

.lang-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.lang-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-teal-light), var(--primary-teal));
    border-radius: 3px;
    width: 0;
    transition: width 1s ease-out;
}

/* Social List */
.social-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}

.social-list li:hover {
    color: var(--primary-teal);
}

.social-list i {
    width: 20px;
    text-align: center;
    color: var(--primary-teal);
}

/* ========== Achievements Section ========== */
.achievements-section {
    margin-bottom: 30px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 15px;
    background: var(--gray-light);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.achievement-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.achievement-icon i {
    font-size: 1.2rem;
    color: var(--text-light);
}

.achievement-content h4 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.achievement-content p {
    font-size: 0.75rem;
    color: var(--text-gray);
}

/* ========== Interests Section ========== */
.interests-section {
    margin-bottom: 20px;
}

.interests-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.interest-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    background: var(--gray-light);
    border-radius: 8px;
    min-width: 80px;
    transition: all 0.3s ease;
}

.interest-item:hover {
    background: var(--primary-teal);
    transform: translateY(-3px);
}

.interest-item i {
    font-size: 1.5rem;
    color: var(--primary-teal);
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.interest-item:hover i {
    color: var(--text-light);
}

.interest-item span {
    font-size: 0.75rem;
    color: var(--text-gray);
    transition: color 0.3s ease;
}

.interest-item:hover span {
    color: var(--text-light);
}

/* ========== Back to Top ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-teal);
    color: var(--text-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(26, 163, 163, 0.4);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-teal-dark);
    transform: translateY(-3px);
}

/* ========== Animations ========== */
.sidebar-section,
.experience-item,
.achievement-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.sidebar-section:nth-child(1) {
    animation-delay: 0.1s;
}

.sidebar-section:nth-child(2) {
    animation-delay: 0.2s;
}

.sidebar-section:nth-child(3) {
    animation-delay: 0.3s;
}

.sidebar-section:nth-child(4) {
    animation-delay: 0.4s;
}

.experience-item:nth-child(1) {
    animation-delay: 0.2s;
}

.experience-item:nth-child(2) {
    animation-delay: 0.3s;
}

.experience-item:nth-child(3) {
    animation-delay: 0.4s;
}

.experience-item:nth-child(4) {
    animation-delay: 0.5s;
}

.experience-item:nth-child(5) {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Responsive ========== */
/* ========== Responsive ========== */
@media screen and (max-width: 1366px) {
    .page-1 .profile-section {
        height: auto;
        clip-path: polygon(0 0, 34% 0, 42% 20%, 100% 20%, 100% 100%, 0 100%);
    }
}

@media screen and (max-width: 767px) {
    body {
        padding: 20px 10px;
    }

    .download-container {
        position: relative;
        top: inherit;
        right: inherit;
        margin: auto;
        width: 100%;
        text-align: center;
    }

    .download-container .btn-download {
        margin: auto;
    }

    .download-button {
        margin: auto;
        width: 100%;
        text-align: center;
    }

    .cv-wrapper {
        margin-top: 20px;
    }

    .cv-container,
    .cv-container.page-1,
    .cv-container.page-2,
    .cv-container.page-3 {
        grid-template-columns: 1fr;
        min-height: auto;
        display: flex;
        flex-direction: column;
    }

    /* Sắp xếp lại thứ tự cho Page 1 trên Mobile */
    .cv-container.page-1 {
        display: flex;
        flex-direction: column;
    }

    .page-1 .header-text {
        order: 1;
        width: 100% !important;
        padding: 20px !important;
        text-align: center;
    }

    .page-1 .header-photo {
        order: 2;
        width: 100% !important;
        height: auto !important;
    }

    .page-1 .profile-section {
        order: 3;
        width: 100% !important;
        margin: 0 !important;
        padding: 30px !important;
        height: auto !important;
        clip-path: polygon(0 0, 6% 0, 52% -30%, 100% 20%, 100% 100%, 0 100%) !important;
    }

    .page-1 .experience-area {
        order: 4;
        width: 100% !important;
        padding: 0;
    }

    .page-1 .sidebar {
        order: 5;
        width: 100% !important;
        padding: 30px !important;
    }

    /* Page 2 & 3 Mobile Layout */
    .page-2 .main-content,
    .page-3 .main-content {
        order: 1;
        width: 100% !important;
        padding: 30px !important;
    }

    .page-2 .sidebar,
    .page-3 .sidebar {
        order: 2;
        width: 100% !important;
        padding: 30px !important;
    }

    .profile-header {
        text-align: center;
    }

    .name {
        font-size: 2rem;
    }

    .job-title {
        text-align: center;
    }

    .title-line {
        margin: 15px auto;
    }

    .decoration-boxes {
        justify-content: center;
    }

    .achievements-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 479px) {
    .main-content {
        padding: 20px;
    }

    .profile-section {
        margin: 0 -20px;
        padding: 15px 20px;
        height: auto;
        clip-path: polygon(0 0, 6% 0, 52% -30%, 100% 20%, 100% 100%, 0 100%) !important;
    }

    .name {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    /* Fix timeline overlap on mobile */
    .experience-item {
        gap: 10px;
    }

    .exp-timeline {
        width: 35px;
    }

    .exp-timeline .year {
        font-size: 0.75rem;
    }

    .experience-item::before {
        left: 0;
        /* 35px (timeline) + 10px (gap) + 6px (half dot) */
    }

    .job-title {
        font-size: 0.75rem;
    }

    .experience-item {
        flex-direction: column;
        gap: 10px;
        padding-left: 20px;
    }

    .exp-timeline {
        display: flex;
        gap: 5px;
        width: auto;
    }

    .exp-dot {
        display: none;
    }

    .interests-grid {
        justify-content: center;
    }

    .page-1 .experience-area {
        padding: 20px;
    }

    .skills-grid .skill-category-card {
        padding: 15px;
    }

    .skills-grid {
        gap: 10px;
    }

    .page-3 .main-content {
        padding: 20px !important;
    }

    .skill-cat-icon {
        margin: auto;
        margin-bottom: 12px;
    }

    .skill-category-card h4 {
        text-align: center;
    }

}

/* ========== Job Subtitle ========== */
.job-subtitle {
    font-size: 0.75rem;
    color: var(--primary-teal);
    letter-spacing: 1px;
    margin-top: -5px;
    margin-bottom: 10px;
}

/* ========== Experience Tech Tags ========== */
.exp-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.exp-tech span {
    font-size: 0.7rem;
    padding: 3px 10px;
    background: var(--gray-light);
    color: var(--text-gray);
    border-radius: 20px;
    border: 1px solid var(--gray-medium);
    transition: all 0.3s ease;
}

.exp-tech span:hover {
    background: var(--primary-teal);
    color: var(--text-light);
    border-color: var(--primary-teal);
}

/* ========== Experience Links ========== */
.exp-list a {
    color: var(--primary-teal);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.exp-list a:hover {
    color: var(--primary-teal-dark);
}

/* ========== Technical Skills Section ========== */
.skills-detail-section {
    margin-bottom: 30px;
}

.skills-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 15px;
}

.skill-category-card {
    background: var(--gray-light);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-teal);
    transition: all 0.3s ease;
}

.skill-category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.skill-cat-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.skill-cat-icon i {
    font-size: 1rem;
    color: var(--text-light);
}

.skill-category-card h4 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.skill-category-card p {
    font-size: 0.8rem;
    color: var(--text-gray);
    line-height: 1.5;
}

/* ========== Tools Grid ========== */
.tools-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-tag {
    font-size: 0.75rem;
    padding: 5px 12px;
    background: rgba(26, 163, 163, 0.15);
    color: var(--primary-teal-light);
    border-radius: 20px;
    border: 1px solid rgba(26, 163, 163, 0.3);
    transition: all 0.3s ease;
}

.tool-tag:hover {
    background: var(--primary-teal);
    color: var(--text-light);
}

/* ========== Language Note ========== */
.lang-note {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    font-style: italic;
}

/* ========== Reference Note ========== */
.reference-note {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* ========== QR Overlay (Header Text) ========== */
.qr-overlay {
    position: absolute;
    display: none;
    /* Chỉ hiện khi in */
    top: 35px;
    left: 40px;
    width: 70px;
    height: 70px;
    background: white;
    padding: 3px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 20;
    transition: transform 0.3s ease;
}

.qr-overlay img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 2px;
}

.qr-overlay:hover {
    transform: scale(1.1);
    cursor: pointer;
}