/* --- RESET CƠ BẢN --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body { background-color: #eef2f3; color: #333; line-height: 1.6; }

.resume-container {
    display: flex;
    max-width: 1000px;
    margin: 40px auto;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    min-height: 100vh;
    position: relative; /* Để định vị các nút absolute */
}

/* --- CỘT TRÁI (SIDEBAR) --- */
.left-col {
    width: 320px;
    background-color: #1a2a3a; /* Màu Xanh Navy đậm */
    color: white;
    padding: 30px 20px;
    flex-shrink: 0;
}

.profile-pic img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid #3498db;
    display: block;
    margin: 0 auto 20px;
    object-fit: cover;
}

.contact-section { text-align: center; margin-bottom: 30px; border-bottom: 1px solid #34495e; padding-bottom: 20px; }
#sb-name { font-size: 22px; font-weight: 700; margin-bottom: 5px; }
.job-title { color: #3498db; font-size: 14px; margin-bottom: 15px; font-weight: 500; }

.contact-list { text-align: left; font-size: 13px; color: #bdc3c7; }
.c-item { margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.c-item i { width: 15px; color: #3498db; }
.c-item a { color: #bdc3c7; text-decoration: none; }

.section-box { margin-bottom: 30px; }
.section-box h3 { font-size: 16px; border-bottom: 2px solid #3498db; padding-bottom: 5px; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }

/* Học vấn */
.edu-item { margin-bottom: 15px; }
.edu-item h4 { font-size: 15px; color: #ecf0f1; }
.edu-item .major { color: #3498db; font-size: 13px; }
.edu-item .time { font-style: italic; font-size: 12px; color: #95a5a6; margin-bottom: 5px;}
.edu-item .courses { font-size: 12px; color: #bdc3c7; line-height: 1.4; }

/* Kỹ năng */
.skill-cat { font-size: 13px; font-weight: bold; color: #95a5a6; margin-top: 15px; margin-bottom: 5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #2c3e50; padding: 4px 8px; font-size: 12px; border-radius: 4px; border: 1px solid #34495e; }

/* --- CỘT PHẢI (MAIN) --- */
.right-col { flex-grow: 1; padding: 40px; background-color: #fff; }

.intro-section { margin-bottom: 40px; }
.main-title { font-size: 28px; color: #2c3e50; margin-bottom: 15px; border-left: 5px solid #3498db; padding-left: 15px; }
#main-about { font-size: 15px; color: #555; text-align: justify; }

/* Tiêu đề mục chung */
.section-title { 
    font-size: 22px; 
    color: #2c3e50; 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; /* Quan trọng: Căn giữa icon và chữ */
    gap: 10px; 
}

/* --- DỰ ÁN (PROJECT CARDS) --- */
.grid-container { display: grid; grid-template-columns: 1fr; gap: 20px; }

.project-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #3498db;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    background-color: #f9fcff;
}

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.card-header h3 { font-size: 18px; color: #2c3e50; margin: 0; }
.subject-tag { background: #f0f4f8; color: #7f8c8d; padding: 2px 8px; font-size: 11px; border-radius: 12px; font-weight: 600; }

.card-body p { font-size: 14px; color: #666; margin-bottom: 15px; }

.card-footer { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tech-badge { background: #e3f2fd; color: #1565c0; font-size: 12px; padding: 3px 8px; border-radius: 4px; font-weight: 500; }
.link-icons { margin-left: auto; display: flex; gap: 10px; }
.link-icons a { color: #3498db; font-size: 18px; transition: color 0.2s; }
.link-icons a:hover { color: #21618c; } 

/* --- CHỨNG CHỈ (CERTIFICATES) --- */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 15px;
}

.cert-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #3498db; /* Viền xanh đồng bộ */
    transition: transform 0.2s;
    cursor: pointer; /* Thêm cái này để biết là bấm được */
}

.cert-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1); /* Bóng đậm hơn chút */
    background-color: #f9fcff;
    border-color: #3498db;
}

.cert-card h4 { font-size: 16px; color: #2c3e50; margin-bottom: 8px; }

.cert-issuer { font-size: 13px; color: #7f8c8d; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.cert-issuer i { color: #f39c12; /* Màu vàng cho icon cúp/award */ }

.cert-date { font-size: 12px; color: #95a5a6; font-style: italic; }

/* --- CSS CHO ICON HUÂN CHƯƠNG Ở TIÊU ĐỀ --- */
#cert-header-icon {
    font-size: 28px;
    margin-right: 10px;
}

/* --- NÚT DOWNLOAD PDF --- */
#pdf-btn {
    position: absolute;
    top: 60px; /* Nằm dưới nút ngôn ngữ */
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px; /* Khoảng cách giữa icon và chữ */
    padding: 8px 15px;
    
    background: #e74c3c; /* Màu đỏ */
    color: rgb(255, 255, 255);
    font-weight: bold;
    text-decoration: none; /* Quan trọng: Bỏ gạch chân của thẻ a */
    
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(90, 85, 85, 0.1);
    transition: all 0.3s ease;
    z-index: 1000;
}

#pdf-btn:hover {
    background: #c0392b; /* Màu đỏ đậm khi di chuột */
    transform: translateY(-2px); /* Hiệu ứng nổi lên */
    color: white; /* Giữ chữ màu trắng */
}

/* --- NÚT ĐỔI NGÔN NGỮ (LANG BTN) --- */
#lang-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 15px;
    background: white;
    border: 2px solid #3498db;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    color: #3498db;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 1000;
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;   
    transform: translateZ(0);             
}

#pdf-btn i {
    font-size: 16px;
    display: inline-block;
}

#lang-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

#lang-flag {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

/* --- MODAL POPUP --- */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #fefefe;
    margin: 8% auto;
    padding: 30px;
    border: 0;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn { from {opacity: 0; transform: translateY(-20px);} to {opacity: 1; transform: translateY(0);} }

.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 20px; transition: color 0.2s; }
.close-btn:hover { color: #e74c3c; }

#modal-title { color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; margin-bottom: 20px; margin-top: 0; }

.modal-file-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    margin-bottom: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    border: 1px solid #eee;
    transition: all 0.2s;
}

.modal-file-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateX(5px);
}

.modal-file-item i { font-size: 20px; margin-right: 15px; width: 25px; text-align: center; }
.fa-file-pdf { color: #e74c3c; }
.fa-image { color: #27ae60; }
.fa-youtube { color: #c0392b; }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .resume-container { flex-direction: column; margin: 0; width: 100%; box-shadow: none; }
    .left-col { width: 100%; text-align: center; }
    .contact-list { display: inline-block; text-align: left; }
    .right-col { padding: 20px; }
    
    #lang-btn { top: 10px; right: 10px; padding: 5px 10px; font-size: 12px; }
    #pdf-btn { top: 50px; right: 10px; padding: 5px 10px; font-size: 12px; }
    
    .section-title { font-size: 20px; }
    .card-header { flex-direction: column; gap: 5px; }
}

/* --- CẤU HÌNH KHI IN RA PDF --- */
@media print {
    /* 1. Thiết lập trang giấy A4 */
    @page {
        size: A4;
        margin: 0; /* Xóa lề trắng mặc định của máy in */
    }

    /* 2. Ép buộc hiện màu nền (Quan trọng để cột trái có màu xanh) */
    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-color: white;
    }

    /* 3. Ẩn các nút không cần thiết */
    #pdf-btn, #lang-btn, .modal, .close-btn {
        display: none !important;
    }

    /* 4. CẤU HÌNH KHUNG CHÍNH (QUAN TRỌNG NHẤT) */
    .resume-container {
        display: flex !important;       /* Bắt buộc dùng Flexbox */
        flex-direction: row !important; /* Bắt buộc xếp hàng ngang */
        width: 210mm !important;        /* Chiều rộng chuẩn khổ A4 */
        min-height: 297mm !important;   /* Chiều cao tối thiểu khổ A4 */
        margin: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;    /* Cắt bỏ phần thừa nếu có */
    }

    /* 5. Cố định kích thước 2 cột để không bị rớt dòng */
    .left-col {
        width: 35% !important; /* Cột trái chiếm 35% */
        min-width: 200px !important; /* Đảm bảo không bị quá bé */
        height: 100vh !important; /* Kéo dài hết trang giấy */
        background-color: #1a2a3a !important; /* Màu xanh navy */
        color: white !important;
        padding: 20px !important;
    }

    .right-col {
        width: 65% !important; /* Cột phải chiếm 65% */
        padding: 30px !important;
    }

    /* 6. Fix lỗi link và ngắt trang */
    a { text-decoration: none !important; color: inherit !important; }
    
    /* Không cho phép cắt đôi các thẻ quan trọng */
    .section-box, .project-card, .cert-card, .edu-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* 7. Thu nhỏ nhẹ nếu nội dung quá dài (Tùy chọn) */
    /* body { transform: scale(0.90); transform-origin: top left; width: 105%; } */
}