@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);
    margin: 0;
    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:
        radial-gradient(circle at 0% 50%, rgba(255, 255, 255, 0.12), transparent 38%),
        radial-gradient(circle at 95% 20%, rgba(255, 255, 255, 0.14), transparent 30%),
        linear-gradient(135deg, #8e0000 0%, #bf0000 45%, #8e0000 100%);
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    padding: 18px 0 16px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 0;
    border-bottom: 4px solid rgba(255, 215, 0, 0.45);
    overflow: hidden;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 20px;
    min-height: 132px;
    /* Đảm bảo có đủ chiều cao cho logo dẫu tiêu đề ngắn */
}

.header-logo {
    position: absolute;
    left: 20px;
    top: 8px;
    transform: none;
    width: 115px;
    height: auto;
    margin-bottom: 0;
    filter: drop-shadow(2px 2px 5px rgba(0, 0, 0, 0.5));
}

.header-title-box {
    text-align: center;
    padding: 0 130px;
    /* Chừa không gian 130px hai bên để chữ nằm giữa tuyệt đối */
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-title {
    color: #ffe200;
    font-size: 30px;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8), -1px -1px 0 rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.header-subtitle {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
    margin-top: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
}

.header-notice {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    margin-top: 15px;
    text-align: center;
    max-width: 90%;
    line-height: 1.4;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* --- MAIN CONTENT HOMEPAGE --- */
.main-wrapper {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    /* Đồng nhất với trang chi tiết */
    margin: 0px auto 0px;
    /* Giảm margin bottom từ 50px xuống 10px */
    padding: 10px 0 10px;
    background: rgba(244, 237, 223, 0.50);
    backdrop-filter: saturate(110%);
    border-left: 1px solid #e3d6bf;
    border-right: 1px solid #e3d6bf;
    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: 0px;
    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;
    /* Hiện/ẩn tùy theo setting; mặc định ẩn */
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    color: #da251d;
    margin: 0 0 3px 0;
    text-align: center;
}

.card-name {
    color: #da251d;
    font-size: 19px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 5px 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;
    width: 100%;
    /* Giới hạn chiều rộng bằng nội dung */
    /* 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: 100px;
        left: 10px;
    }

    .header-title-box {
        padding: 0 110px;
    }

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

/* 2. Tablet và Mobile: Logo lên trên */
@media (max-width: 850px) {
    .site-header,
    .main-wrapper,
    .site-footer {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .header-container {
        min-height: auto;
    }

    .header-logo {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 90px;
        margin-bottom: 15px;
    }

    .header-title-box {
        padding: 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: 550px) {
    .main-wrapper {
        padding: 12px 10px;
        /* Đẩy nội dung ra sát lề màn hình */
        border-left: none;
        border-right: none;
        width: 100%;
    }

    .candidates-grid {
        gap: 6px;
    }

    .candidate-card {
        width: 100%;
        max-width: 100%;
        /* Chiếm tối đa không gian */
        margin: 0 auto 8px auto;
        padding: 10px 8px;
        /* Tăng padding của thẻ */
    }

    .card-img-box {
        width: 240px;
        /* Avatar to và rõ ở màn hình di động */
        height: 240px;
        margin-bottom: 15px;
    }

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

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

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

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