/* public/css/style.css */

/* --- Cấu trúc cơ bản và biến số --- */
@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@300;400;500;600;700&display=swap');

:root {
    --font-family: 'Bai Jamjuree', sans-serif;

    --font-size-xs: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
    --font-size-sm: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
    --font-size-base: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
    
    --font-size-md: clamp(1.3125rem, 1.2rem + 0.4vw, 1.5rem);
    --font-size-lg: clamp(1.625rem, 1.45rem + 0.65vw, 2rem);
    --font-size-xl: clamp(2rem, 1.75rem + 0.9vw, 2.625rem);
    --font-size-xxl: clamp(2.75rem, 2.3rem + 1.8vw, 4.125rem);
    
    --accent-orange: #ff8a3d;
    --accent-yellow: #ffc83d;
    --accent-blue: #3d8bff;
    --accent-pink: #ff6b9d;
    --accent-purple: #8B5CF6;
    --accent-red: #ef4444;
    --accent-green: #22C55E;

    /* Light Theme */
    --bg-main: #f4f8f6;
    --bg-card: #ffffff;
    --text-main: #1e2e5c;
    --text-muted: #686793;
    --border-subtle: #e7ece9;
    --primary: #254ecb;
    --primary-hover: #1e3fa3; 
    --primary-light: #ecf0ff;
}

[data-theme="dark"] {
    --bg-main: #0b111e;
    --bg-card: #151e2e;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-subtle: #243249;
    --primary: #3d6eff;
    --primary-hover: #1e293b;
    --primary-light: #1e293b; 
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

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

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ================= MAIN HEADER ================= */
.main-header {
    background-color: var(--bg-card);
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 99;
    height: 70px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

/* Logo */
.logo {
    font-size: var(--font-size-md);
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.logo-icon {
    font-size: 24px;
}

/* Nav Menu (Bản Desktop) */
.nav-menu {
    display: flex;
    gap: 25px;
    width: 100%;
    justify-content: center;
}

/* --- Cập nhật danh sách liên kết trong Menu --- */
.menu-links {
    display: flex;
    gap: 50px;
    width: 80%;
    justify-content: space-evenly;
}

.menu-links a {
    font-weight: 700;
    color: var(--text-muted);
    font-size: var(--font-size-md);
    position: relative; /* Quan trọng để định vị gạch chân sau này */
    display: inline-block;
    padding: 6px 0;
    transition: color 0.3s ease, transform 0.3s ease;
}

/* Hiệu ứng Hover chung */
.menu-links a:hover {
    color: var(--primary);
    transform: translateY(-2px); /* Nổi nhẹ lên khi hover */
}

/* === LỚP HIỆN TẠI (ACTIVE STATE) === */
.menu-links a.active-grade {
    color: var(--primary);
    transform: translateY(-4px); /* Nổi hẳn lên để tạo sự khác biệt */
}

/* Đường gạch chân của Lớp hiện tại */
.menu-links a.active-grade::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 4px; /* Độ dày của đường gạch chân */
    background-color: var(--primary);
    border-radius: 4px;
    animation: expandUnderline 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Hiệu ứng xuất hiện mượt mà cho gạch chân */
@keyframes expandUnderline {
    from {
        transform: scaleX(0);
        opacity: 0;
    }
    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* Tối ưu hóa hiển thị khi ở trên Mobile Drawer (Menu dọc) */
@media (max-width: 991px) {
    .menu-links a {
        display: block;
        width: 100%;
        padding: 12px 0;
        transition: padding-left 0.3s ease, color 0.3s ease;
    }

    .menu-links a:hover {
        transform: none; /* Không dịch chuyển trục Y trên điện thoại */
        padding-left: 8px; /* Thay thế bằng dịch nhẹ qua phải */
    }

    /* Hiển thị lớp hiện tại trên Mobile */
    .menu-links a.active-grade {
        transform: none;
        padding-left: 12px;
        border-left: 4px solid var(--primary); /* Sử dụng viền trái thay vì gạch dưới trên menu dọc */
        color: var(--primary);
        font-weight: 800;
    }

    /* Ẩn đường gạch chân ngang khi ở chế độ Mobile */
    .menu-links a.active-grade::after {
        display: none;
    }
}

/* Các thành phần ẩn mặc định trên Desktop */
.close-menu,
.menu-search-box,
.menu-theme-switch {
    display: none;
}

/* Cụm tiện ích bên phải */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-main);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s;
    padding: 5px;
}

.icon-btn:hover {
    background-color: var(--primary-light);
}

.icon-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--accent-red);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
}

/* Menu di động (Mặc định ẩn nút Hamburger trên PC) */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 2px;
}

/* ================= THEME SWITCH COMPONENT ================= */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 84px;
    height: 36px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border: 2px solid var(--text-main);
    border-radius: 999px;
    background-color: #69D4FF;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50"><path d="M30 50 Q42 34 55 42 Q68 28 82 34 Q92 28 100 38 L100 50 Z" fill="%23FFFFFF"/></svg>');
    background-size: cover;
    background-position: center;
    transition: background-color 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    bottom: 2px;
    aspect-ratio: 1;
    border-radius: 50%;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><circle cx="22" cy="22" r="22" fill="%23FFC83B"/><circle cx="22" cy="22" r="7" fill="none" stroke="%23F3553C" stroke-width="3.5"/><g stroke="%23F3553C" stroke-width="3.5" stroke-linecap="round"><line x1="22" y1="5" x2="22" y2="8"/><line x1="22" y1="36" x2="22" y2="39"/><line x1="5" y1="22" x2="8" y2="22"/><line x1="36" y1="22" x2="39" y2="22"/><line x1="10" y1="10" x2="12.5" y2="12.5"/><line x1="31.5" y1="31.5" x2="34" y2="34"/><line x1="10" y1="34" x2="12.5" y2="31.5"/><line x1="31.5" y1="12.5" x2="34" y2="10"/></g></svg>');
    background-size: contain;
    background-repeat: no-repeat;
}

input:checked + .slider {
    background-color: #19284F;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50"><defs><polygon id="star" points="0,-4 1.2,-1.2 4,-1.2 1.8,.6 2.6,3.4 0,1.6 -2.6,3.4 -1.8,.6 -4,-1.2 -1.2,-1.2" fill="%23FFC83B"/></defs><path d="M0 50 L0 30 Q12 22 24 32 Q34 42 48 42 Q55 42 62 50 Z" fill="%23FFFFFF"/><use href="%23star" x="35" y="12"/><use href="%23star" x="53" y="13"/><use href="%23star" x="44" y="22"/></svg>');
}

input:checked + .slider:before {
    transform: translateX(46px);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'><circle cx='12' cy='12' r='12' fill='%231E293B'/><path d='M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.4' stroke='%23FFC83D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}


/* ================= MOBILE & TABLET LAYOUT (QUYẾT ĐỊNH) ================= */

@media (max-width: 991px) {
    header {
        z-index: 1000;
    }
    /* 1. Ẩn bớt các mục không tối ưu trên Mobile Bar */
    .hide-on-mobile {
        display: none !important;
    }

    /* 2. Hiển thị nút Hamburger */
    .mobile-toggle {
        display: flex;
    }

    /* 3. Đưa Logo về dạng linh hoạt, không bị ép chặt */
    .logo {
        position: static;
        transform: none;
        margin-right: auto;
        margin-left: 15px;
    }

    /* 4. Cấu hình Drawer (Menu trượt rộng rãi từ bên trái) */
    .nav-menu {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        background-color: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        padding: 24px;
        gap: 25px;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
    }

    .nav-menu.active {
        left: 0;
    }

    /* Căn lề danh sách liên kết trong menu */
    .menu-links {
        flex-direction: column;
        gap: 10px;
    }

    .menu-links a {
        font-size: var(--font-size-md);
        font-weight: 600;
        padding: 12px 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    /* Nút đóng góc Menu */
    .close-menu {
        display: block;
        align-self: flex-end;
        background: none;
        border: none;
        font-size: 28px;
        color: var(--text-muted);
        cursor: pointer;
        line-height: 1;
        margin-bottom: 10px;
    }

    /* 5. Tích hợp Hộp tìm kiếm bên trong Menu Trượt */
    .menu-search-box {
        display: flex;
        align-items: center;
        background-color: var(--bg-main);
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        padding: 4px 12px;
        margin-bottom: 10px;
    }

    .menu-search-box input {
        border: none;
        background: none;
        outline: none;
        color: var(--text-main);
        width: 100%;
        height: 36px;
        font-size: var(--font-size-base);
    }

    .menu-search-box .search-submit {
        background: none;
        border: none;
        font-size: 18px;
        cursor: pointer;
    }

    /* 6. Tích hợp Theme Switch ở chân Menu */
    .menu-theme-switch {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: auto; /* Đẩy xuống đáy Menu */
        padding-top: 20px;
        border-top: 1px solid var(--border-subtle);
    }

    .menu-theme-switch span {
        font-weight: 600;
        color: var(--text-main);
        font-size: var(--font-size-sm);
    }

    /* Overlay nền tối khi mở menu */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 10;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Tối ưu hóa tối đa cho các màn hình siêu nhỏ (320px - 375px) */
@media (max-width: 400px) {
    .logo-text {
        font-size: 15px; /* Thu nhỏ nhẹ cỡ chữ logo thay vì ẩn */
    }
    
    .logo-icon {
        font-size: 20px;
    }

    .header-right {
        gap: 6px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }
}

/* Tích hợp font và thiết lập chung cho Dropdown */
.account-menu {
    position: relative;
    font-family: var(--font-family);
}

/* Nút kích hoạt */
.icon-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--border-subtle);
}

.btn-avatar-placeholder {
    font-size: var(--font-size-md);
}

/* Container Dropdown chính */
.account-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 320px;

    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;

    box-shadow:
        0 30px 60px -12px rgba(15, 23, 42, .22),
        0 12px 24px -8px rgba(15, 23, 42, .12),
        0 0 0 1px rgba(255, 255, 255, .04);

    overflow: hidden;
    padding: 0;

    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.95);
    transform-origin: top right;

    transition:
        opacity .25s ease,
        transform .28s cubic-bezier(.2,.8,.2,1),
        visibility .25s;

    z-index: 9999;
}

.account-dropdown.open,
.account-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header Dropdown */
.dropdown-header {
    position: relative;
    text-align: center;
    padding: 28px 16px 20px 16px;
    background: linear-gradient(
        160deg,
        #254ecbb2 0%,
        #3d8bffb2 55%,
        #8B5CF6b2 130%
    );
    overflow: hidden;
}

.dropdown-header::before {
    content: "";
    position: absolute;
    top: -40%;
    right: -20%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
    pointer-events: none;
}

/* Avatar dạng hình tròn */
.avatar {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: var(--font-size-md);
    margin: 0 auto 12px auto;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .25), 0 0 0 4px rgba(255,255,255,.25);
}

.guest-avatar {
    background: rgba(255, 255, 255, .18);
    color: #ffffff;
    backdrop-filter: blur(4px);
}

.user-avatar {
    background-color: var(--accent-purple);
    color: #ffffff;
    border: 3px solid rgba(255, 255, 255, .8);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
}

/* Tiêu đề & Thông tin Header */
.dropdown-header h4 {
    margin: 0;
    font-size: var(--font-size-base);
    color: #ffffff;
    font-weight: 700;
    line-height: 1.4;
}

.dropdown-header p {
    margin: 4px 0 0 0;
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, .8);
    word-break: break-all;
}

/* Phân cách dòng */
.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 8px 16px;
}

/* Thân Dropdown chứa Menu */
.dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px;
}

/* Các liên kết Menu Item */
.dropdown-body a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.dropdown-body a .icon {
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--primary-light);
    flex-shrink: 0;
}

/* Hover Menu */
.dropdown-body a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    transform: translateX(2px);
}

.dropdown-body a:hover .icon {
    background: var(--primary);
    filter: brightness(1.3);
}

/* Nút Đăng nhập/Đăng ký trạng thái chưa đăng nhập */
.dropdown-body .auth-btn {
    justify-content: center;
    padding: 12px;
    font-weight: 600;
    margin-top: 6px;
    border-radius: 12px;
}

.dropdown-body .primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent-blue));
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(37, 78, 203, .3);
}

.dropdown-body .primary-btn:hover {
    background: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37, 78, 203, .4);
}

.dropdown-body .outline-btn {
    border: 2px solid var(--border-subtle);
    background-color: transparent;
}

.dropdown-body .outline-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--text-main);
    transform: translateY(-1px);
}

/* Menu Đặc biệt */
.dropdown-body a.admin-link .icon {
    background: rgba(139, 92, 246, 0.12);
}

.dropdown-body a.admin-link:hover {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.dropdown-body a.admin-link:hover .icon {
    background: var(--accent-purple);
    filter: brightness(1.3);
}

.dropdown-body a.logout-link .icon {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-body a.logout-link:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.dropdown-body a.logout-link:hover .icon {
    background: var(--accent-red);
    filter: brightness(1.3);
}

/* Nền tối phía sau modal */
.search-modal {
    display: none; /* Ẩn mặc định */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Phủ nền mờ */
    align-items: center;
    justify-content: center;
}

/* Khung nội dung modal */
.search-modal-content {
    background-color: #fff;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Nút đóng modal (X) */
.close-modal-btn {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}
.close-modal-btn:hover {
    color: #333;
}

.modal-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text-color, #333);
}

/* Form nhập liệu bên trong modal */
#modal-search-form {
    display: flex;
    gap: 10px;
}

#modal-search-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    outline: none;
}

#modal-search-input:focus {
    border-color: var(--primary, #007bff);
}

.modal-submit-btn {
    padding: 10px 20px;
    background-color: var(--primary, #007bff);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

/* --- CSS CHO FOOTER --- */

.site-footer {
    background-color: var(--bg-card);
    color: var(--text-main);
    font-family: var(--font-family);
    padding: 1rem 1rem 0.1rem 1rem;
    border-top: 3px solid var(--primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    padding: 0 16px;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

/* Responsive grid cho màn hình máy tính và máy tính bảng */
@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
        gap: 1.5rem;
    }
}

/* Cột thương hiệu */
.brand-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background-color: var(--primary);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--primary);
}

.footer-description {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
    max-width: 320px;
}

/* Kết nối mạng xã hội */
.social-connect {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.social-label {
    font-size: var(--font-size-sm);
    color: var(--text-main);
    font-weight: 500;
}

.social-icons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-link {
    width: 24px;
    height: 24px;
    display: inline-block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.social-link:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.facebook-color {
    color: #1877F2;
}

.youtube-color {
    color: #FF0000;
}

/* Cấu trúc các cột liên kết */
.footer-heading {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.footer-links a {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease, padding-left 0.2s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 4px;
}

/* Bản quyền chân trang */
.footer-bottom {
    margin-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.5rem;
}

.footer-bottom-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-bottom p {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0;
}


@-webkit-keyframes slide-in-elliptic-bottom-fwd {
  0% {
    -webkit-transform: translateY(600px) rotateX(30deg) scale(0);
            transform: translateY(600px) rotateX(30deg) scale(0);
    -webkit-transform-origin: 50% 100%;
            transform-origin: 50% 100%;
    opacity: 0;
  }
  100% {
    -webkit-transform: translateY(0) rotateX(0) scale(1);
            transform: translateY(0) rotateX(0) scale(1);
    -webkit-transform-origin: 50% -1400px;
            transform-origin: 50% -1400px;
    opacity: 1;
  }
}
@keyframes slide-in-elliptic-bottom-fwd {
  0% {
    -webkit-transform: translateY(600px) rotateX(30deg) scale(0);
            transform: translateY(600px) rotateX(30deg) scale(0);
    -webkit-transform-origin: 50% 100%;
            transform-origin: 50% 100%;
    opacity: 0;
  }
  100% {
    -webkit-transform: translateY(0) rotateX(0) scale(1);
            transform: translateY(0) rotateX(0) scale(1);
    -webkit-transform-origin: 50% -1400px;
            transform-origin: 50% -1400px;
    opacity: 1;
  }
}

@-webkit-keyframes fade-in-bottom {
  0% {
    -webkit-transform: translateY(50px);
            transform: translateY(50px);
    opacity: 0;
  }
  100% {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
  }
}
@keyframes fade-in-bottom {
  0% {
    -webkit-transform: translateY(50px);
            transform: translateY(50px);
    opacity: 0;
  }
  100% {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
  }
}

.swiper-slide {
    opacity: 1;
    animation: slide-in-elliptic-bottom-fwd 0.8s both;
    animation-delay: calc(var(--i) * 0.15s);
}

/* ================= EFFECT: SCROLL REVEAL ================= */
/* ================= EFFECT: SCROLL REVEAL (PARENT -> CHILDREN) ================= */

/* Trạng thái chung khi chưa xuất hiện */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;

    /* MẶC ĐỊNH CHO PARENT: Không delay, xuất hiện lập tức khi scroll tới */
    transition-delay: 0ms;
}

/* 
  BÍ QUYẾT TẠO HỆ THỐNG CHA - CON:
  Những phần tử có sử dụng biến "--i" (các thẻ con) sẽ TỰ ĐỘNG:
  Đợi Parent (250ms) + (Thứ tự --i * 120ms cho mỗi item tiếp theo)
*/
[style*="--i:"].reveal {
    transition-delay: calc(250ms + (var(--i, 0) * 120ms));
}

/* Các kiểu hướng chuyển động khác nhau */
.reveal.fade-up {
    transform: translateY(50px);
}

.reveal.fade-up.active {
    animation: fade-in-bottom 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    animation-delay: 0ms;
}

[style*="--i:"].reveal.fade-up.active {
    animation-delay: calc(250ms + (var(--i, 0) * 120ms));
}

.reveal.fade-down {
    transform: translateY(-40px);
}

.reveal.fade-left {
    transform: translateX(-40px);
}

.reveal.fade-right {
    transform: translateX(40px);
}

.reveal.zoom-in {
    transform: scale(0.85);
}

/* Trạng thái KHI ĐÃ XUẤT HIỆN (khi JS thêm class .active) */
.reveal.active {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* ================= FLOATING CONTACT BUTTONS ================= */
.floating-contact {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 999;
    font-family: var(--font-family);
}

.contact-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    cursor: pointer;
}

.contact-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}

/* Tooltip gợi ý bên cạnh nút */
.contact-tooltip {
    position: absolute;
    right: 70px;
    background-color: var(--text-main);
    color: var(--bg-card);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

.contact-btn:hover .contact-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Nút Zalo */
.zalo-btn {
    background-color: #0068ff;
}

.zalo-icon-img {
    width: 32px;
    height: 32px;
}

/* Nút Gọi điện thoại (Hotline) */
.phone-btn {
    background-color: var(--accent-green);
    color: #ffffff;
}

.phone-icon-svg {
    width: 24px;
    height: 24px;
    z-index: 2;
    transform: rotate(0deg);
    animation: phoneShake 2s infinite ease-in-out;
}

/* Lớp sóng lan tỏa bên dưới nút gọi */
.phone-ripple {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-green);
    opacity: 0.4;
    animation: phoneRipple 1.8s infinite ease-out;
    z-index: 1;
}

/* Hiệu ứng sóng lan tỏa */
@keyframes phoneRipple {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Hiệu ứng rung nhẹ cho biểu tượng chiếc điện thoại */
@keyframes phoneShake {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

/* Tối ưu hóa trải nghiệm trên các thiết bị di động */
@media (max-width: 768px) {
    .floating-contact {
        bottom: 20px;
        right: 20px;
        gap: 12px;
    }

    .contact-btn {
        width: 48px;
        height: 48px;
    }

    .zalo-icon-img {
        width: 26px;
        height: 26px;
    }

    .phone-icon-svg {
        width: 20px;
        height: 20px;
    }

    /* Ẩn tooltip trên các thiết bị cảm ứng để tránh vướng giao diện */
    .contact-tooltip {
        display: none !important;
    }
}

.swal2-container,
.swal2-popup {
    z-index: 101;
}

.swiper-wrapper {
    justify-content: center;
}