@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary-red: #da251d;
    --dark-red: #b31b15;
    --gold-yellow: #ffcc00;
    --gold-border: #d4af37;
    --bg-color: #fcf4e4;
    --text-main: #222;
}

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 0;
    scroll-behavior: smooth;
    /* Thêm cuộn mượt */
}

body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background-image: url('../images/trong-dong.webp');
    background-size: 80% auto;
    /* Phóng to 1 hình giữa màn hình */
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15;
    /* Làm mờ ảnh */
    z-index: -1;
    pointer-events: none;
}

/* --- HEADER MAPPING --- */
.site-header {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 25px 0 10px;
}

.header-container {
    max-width: 1200px;
    /* Đồng bộ về 1200px */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 20px;
    /* Đồng bộ padding với main-wrapper */
}

.header-logo {
    position: absolute;
    left: 65px;
    /* Căn giữa với mặt ứng viên đầu tiên (20px padding + 110px tâm thẻ - 65px nửa logo = 65px) */
    top: 0;
    width: 130px;
    height: auto;
    filter: drop-shadow(2px 2px 5px rgba(0, 0, 0, 0.3));
}

.header-title-box {
    text-align: center;
    padding-left: 210px;
    /* Tăng lề để nhường chỗ cho logo mới lùi vào */
    padding-right: 40px;
    width: 100%;
    box-sizing: border-box;
}

.header-title {
    color: #b31b15;
    /* Màu đỏ đậm đặc trưng */
    font-size: 34px;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.header-subtitle {
    color: #cc0000;
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
}

.header-notice {
    font-size: 16px;
    font-weight: bold;
    color: #b31b15;
    margin-top: 15px;
    text-align: center;
    max-width: 90%;
    line-height: 1.4;
}

/* --- MAIN CONTENT HOMEPAGE --- */
.main-wrapper {
    flex: 1;
    max-width: 1200px;
    /* Đồng nhất với trang chi tiết */
    margin: 30px auto 10px;
    /* Giảm margin bottom từ 50px xuống 10px */
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.candidates-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 100%;
    margin: 0 auto;
}

/* --- CANDIDATE CARD --- */
.candidate-card {
    text-decoration: none !important;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
    width: calc(20% - 12px);
    /* 5 cột: (100% - 15px*4)/5 = 20% - 12px */
    flex-grow: 0;
    flex-shrink: 0;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    padding: 10px 5px;
    /* Giảm padding để tiết kiệm diện tích */
    border-radius: 20px;
    z-index: 1;
    overflow: hidden;
    box-sizing: border-box;
}

.candidate-card * {
    text-decoration: none !important;
}

.candidate-card:hover {
    transform: translateY(-8px);
}

/* Hiệu ứng viền chạy quanh toàn bộ Card */
.candidate-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 30%, var(--gold-yellow) 70%, var(--primary-red) 100%);
    animation: rotate-border 3s linear infinite;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -2;
}

.candidate-card::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--bg-color);
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.candidate-card:hover::before,
.candidate-card:hover::after {
    opacity: 1;
}

@keyframes rotate-border {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.candidate-card-inner {
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: visible;
}

.card-img-box {
    width: 190px;
    /* Nhỏ lại 1 chút để vừa 5 cột */
    height: 190px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    overflow: visible;
    border-radius: 50%;
    border: 2px solid #da251d;
    position: relative;
    margin-bottom: 12px;
}

/* Hiệu ứng viền kép đỏ */
.card-img-box::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1px solid #da251d;
    border-radius: 50%;
    opacity: 0.6;
}

.card-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Khối màu Đỏ nửa dưới - Bo cong vát lên trên sát mẫu */
.card-info-box {
    background: transparent;
    padding: 10px 5px;
    text-align: center;
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: none;
    margin-top: 0;
}

.card-prefix {
    display: none;
    /* Không dùng tiền tố Đồng chí cho card tròn */
}

.card-name {
    color: #da251d;
    font-size: 19px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 10px 0 !important;
    /* Cố định khoảng cách dưới tên là 10px */
    line-height: 1.4;
    text-shadow: none;
    font-family: inherit;
    white-space: normal;
    /* Cho phép xuống hàng khi tên quá dài */
    overflow: visible;
    text-overflow: clip;
    width: 100%;
    padding: 2px 5px;
    /* Thêm đệm để không bị cắt sát trên dưới */
}

.card-job {
    font-family: inherit;
    font-size: 15px;
    text-align: center;
    color: #da251d;
    line-height: 1.4;
    font-weight: 500;
    margin-top: 0 !important;
    text-decoration: none !important;
    white-space: normal;
    padding: 0 5px;
}

.card-job p {
    margin: 0 !important;
    /* Loại bỏ margin của thẻ p để đồng nhất */
    padding: 0 !important;
    text-decoration: none !important;
}

.card-job * {
    text-decoration: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* --- NEW UNIFIED FOOTER --- */
.site-footer {
    background-color: var(--dark-red);
    height: 45px;
    position: relative;
    margin: 10px auto 0;
    /* Căn giữa và sát nội dung */
    max-width: 1200px;
    /* Giới hạn chiều rộng bằng nội dung */
    width: calc(100% - 40px);
    /* Bù đắp padding của main-wrapper/page-container */
    border-top: none;
    z-index: 100;
}

.footer-container {
    width: 100%;
    margin: 0 auto;
    position: relative;
    height: 100%;
}

.footer-logo-tab {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--dark-red);
    height: 65px;
    /* Cao hơn thanh footer */
    padding: 0 50px 0 20px;
    display: flex;
    align-items: center;
    border-top-right-radius: 60px 100%;
    /* Tạo độ vát cong đặc trưng */
    box-shadow: 2px -2px 10px rgba(0, 0, 0, 0.1);
}

.footer-logo-tab img {
    height: 35px;
    width: auto;
    filter: brightness(0) invert(1);
    /* Làm logo thành màu trắng chuẩn mẫu */
}

.footer-info-text {
    display: none;
    /* Ẩn text cũ */
}

.scroll-top-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    background-color: #fff;
    color: var(--dark-red);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.scroll-top-btn:hover {
    background-color: var(--gold-yellow);
    transform: translateY(-50%) scale(1.1);
}

.scroll-top-btn i {
    font-size: 20px;
    font-weight: bold;
}

/* RESPONSIVE */

/* 1. Màn hình Laptop nhỏ */
@media (max-width: 1100px) {
    .header-logo {
        width: 110px;
        left: 10px;
    }

    .header-title-box {
        padding-left: 120px;
        padding-right: 120px;
    }

    .header-title {
        font-size: 28px;
    }
}

/* 2. Tablet và Mobile: Logo lên trên */
@media (max-width: 850px) {
    .header-logo {
        position: relative;
        left: auto;
        top: auto;
        margin-bottom: 20px;
        width: 100px;
    }

    .header-title-box {
        padding-left: 0;
        padding-right: 0;
    }

    .header-title {
        font-size: 24px;
        padding: 0 10px;
    }

    .header-subtitle {
        font-size: 16px;
    }

    .header-notice {
        font-size: 14px;
        margin-top: 10px;
    }
}

/* 3. Phân chia số cột linh hoạt */
@media (max-width: 950px) {
    .candidate-card {
        width: calc(25% - 11.25px);
        /* 4 cột: (100% - 15px*3)/4 = 25% - 11.25px */
    }
}

@media (max-width: 750px) {
    .candidate-card {
        width: calc(33.333% - 10px);
        /* 3 cột: (100% - 15px*2)/3 = 33.33% - 10px */
    }
}

@media (max-width: 600px) {
    .header-title {
        font-size: 20px;
    }

    .candidates-grid {
        gap: 10px;
    }

    .candidate-card {
        width: calc(50% - 5px);
        /* 2 cột: (100% - 10px*1)/2 = 50% - 5px */
    }

    .card-img-box {
        width: 150px;
        /* Thu nhỏ avatar để vừa 2 cột */
        height: 150px;
    }

    .card-name {
        font-size: 16px;
    }

    .card-job {
        font-size: 13px;
    }
}

@media (max-width: 420px) {
    .header-title {
        font-size: 18px;
    }

    .header-notice {
        font-size: 12px;
    }

    .card-img-box {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 380px) {
    .candidate-card {
        width: 100%;
        /* 1 cột */
        max-width: 260px;
        margin: 0 auto 15px;
    }

    .card-img-box {
        width: 180px;
        height: 180px;
    }
}