/* =========================================
   1. RESET & GLOBAL STYLES
   ========================================= */
* {
    box-sizing: border-box;
}

/* =======================================================
   HỆ THỐNG TYPOGRAPHY & UI CHUẨN (SSSTUTER THEME)
   ======================================================= */
:root {
    --font-primary: "Open Sans", sans-serif;
    --text-color: #333333;
    --primary-red: #e31837; /* Màu đỏ thương hiệu */
}

/* 1. ĐỒNG BỘ FONT THÂN TRANG WEB */
body {
    font-family: var(--font-primary) !important;
    font-size: 15px !important;
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Làm nét chữ mịn, không bị răng cưa */
    -moz-osx-font-smoothing: grayscale;
    background-color: #fbfbfb; /* Nền xám cực nhẹ giúp các khối trắng nổi bật hơn */
}

/* 2. CHUẨN HÓA KÍCH THƯỚC TIÊU ĐỀ (HEADING) */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family: var(--font-primary) !important;
    font-weight: 700 !important; /* Luôn in đậm */
    color: #111111;
    margin-bottom: 0.5rem;
}

h1,
.h1 {
    font-size: 28px !important;
}
h2,
.h2 {
    font-size: 24px !important;
}
h3,
.h3 {
    font-size: 20px !important;
}
h4,
.h4 {
    font-size: 18px !important;
}
h5,
.h5 {
    font-size: 16px !important;
}
h6,
.h6 {
    font-size: 15px !important;
}

/* 3. HIỆU ỨNG NÚT BẤM (BUTTON) HIỆN ĐẠI */
.btn {
    font-family: var(--font-primary) !important;
    font-weight: 600 !important;
    border-radius: 4px; /* Bo góc nhẹ */
    transition: all 0.3s ease; /* Hiệu ứng chuyển động mượt */
}

/* Nút Thanh toán / Nút đỏ */
.btn-danger {
    background-color: var(--primary-red) !important;
    border-color: var(--primary-red) !important;
}
.btn-danger:hover {
    background-color: #c81530 !important;
    transform: translateY(-2px); /* Di chuột vào nút sẽ tự động nổi lên */
    box-shadow: 0 4px 10px rgba(227, 24, 55, 0.3);
}

/* Nút Thêm vào giỏ / Nút đen */
.btn-dark {
    background-color: #222 !important;
}
.btn-dark:hover {
    background-color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* 4. CHUẨN HÓA GIÁ TIỀN & MENU */
.text-danger.fw-bold {
    color: var(--primary-red) !important;
    font-size: 1.1rem; /* Giá tiền to hơn chữ bình thường một chút */
}

.nav-link,
.dropdown-item {
    font-size: 15px !important;
}

/* 5. FIX BẢNG BIỂU (GIỎ HÀNG / ĐƠN HÀNG) */
table th {
    font-weight: 700 !important;
    font-size: 15px;
    background-color: #f8f9fa !important; /* Đổ nền xám nhạt cho tiêu đề bảng */
}
table td {
    font-size: 15px;
    vertical-align: middle;
}
/* ======================================================= */

html {
    font-size: 62.5%;
}

body {
    font-size: 1.6rem;
    font-family: "Open Sans", sans-serif;
    background-color: #f5f5f5; /* Thêm màu nền xám nhẹ cho body đỡ chói */
}

a {
    text-decoration: none;
}

/* Cấu hình ảnh chung (Áp dụng cho banner/sản phẩm) */

img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

/* =========================================
   2. HEADER & LOGO (PHẦN ĐÃ SỬA)
   ========================================= */
header {
    background-color: #e30019;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

header.fixed {
    position: sticky;
    top: 0; /* Sửa lại top 0 để dính ngay mép trên */
}

.main-content {
    width: 1200px;
    max-width: calc(100% - 20px); /* Padding an toàn cho mobile */
    margin: 0 auto;
}

.header .body {
    display: flex;
    align-items: center;
    padding: 10px 0; /* Giảm padding trên dưới chút cho gọn */
    height: 70px; /* Cố định chiều cao header */
}

/* --- LOGO FIX (QUAN TRỌNG) --- */
.logo {
    /* Ghi đè thuộc tính img toàn cục */
    width: auto !important; /* Để chiều rộng tự nhiên theo tỉ lệ */
    height: 40px !important; /* Chiều cao cố định phù hợp header */
    object-fit: contain !important; /* Giữ nguyên tỉ lệ ảnh, không bị méo/cắt */
    border-radius: 0 !important; /* Logo không cần bo góc */

    /* Tạo khoảng cách */
    margin-right: 20px;
    padding-right: 0;

    /* Biến logo màu đen thành MÀU TRẮNG */
    filter: brightness(0) invert(1);

    cursor: pointer;
}

/* =========================================
   3. HEADER ELEMENTS (SEARCH, NAV, BUTTON)
   ========================================= */

/* Nút Danh mục */
.category-btn {
    background-color: #be1e2d;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    height: 40px;
    margin-right: 15px; /* Cách ô tìm kiếm ra */
}

.category-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}
/* --- CSS CHO DROPDOWN MENU --- */

/* Wrapper bọc nút và menu */
.category-dropdown-wrapper {
    position: relative; /* Để menu con định vị theo nó */
    margin-right: 15px; /* Giữ khoảng cách với ô tìm kiếm */
    z-index: 10001; /* Nổi lên trên cùng */
}

/* Menu con ẩn mặc định */
.dropdown-menu {
    display: none; /* Ẩn đi */
    position: absolute;
    top: 100%; /* Nằm ngay dưới nút */
    left: 0;
    background-color: #fff;
    min-width: 220px; /* Chiều rộng menu */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); /* Bóng đổ đẹp */
    border-radius: 4px;
    padding: 10px 0;
    list-style: none;
    margin-top: 5px; /* Cách nút một chút cho đẹp */
    border: 1px solid #eee;
}

/* Tạo mũi tên nhọn chỉ lên (Optional - cho đẹp) */
.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 20px;
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
}

/* Hiển thị menu khi di chuột vào Wrapper */
.category-dropdown-wrapper:hover .dropdown-menu {
    display: block;
    animation: fadeIn 0.3s ease; /* Hiệu ứng hiện dần */
}

/* =======================================================
   CSS CHO DROPDOWN MENU (CHUẨN FORM DỄ BẤM NHƯ ẢNH)
   ======================================================= */

/* Wrapper bọc nút và menu */
.category-dropdown-wrapper {
    position: relative;
    margin-right: 15px;
    z-index: 10001;
}

/* Menu con ẩn mặc định */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    min-width: 200px; /* Rộng rãi hơn để dễ nhìn */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Bóng đổ mờ, hiện đại */
    border-radius: 0 0 4px 4px;
    padding: 0 !important; /* Xóa khoảng trắng thừa để thẻ <a> tràn viền */
    list-style: none;
    margin-top: 0 !important; /* Dính sát vào nút để chuột không bị lọt khe */
    border: 1px solid #e5e5e5;
    border-top: 2px solid #e31837 !important; /* Điểm nhấn vạch đỏ ở trên cùng */
}

/* Bỏ cái mũi tên nhọn cho thiết kế phẳng và hiện đại hơn giống ảnh */
.dropdown-menu::before {
    display: none !important;
}

/* Hiển thị menu khi di chuột vào Wrapper */
.category-dropdown-wrapper:hover .dropdown-menu {
    display: block;
    animation: menuFadeIn 0.2s ease-in-out;
}

/* Style cho từng mục trong menu */
.dropdown-menu li a {
    display: block !important;
    padding: 10px 15px !important; /* Tăng chiều cao để VÙNG BẤM CỰC TO */
    color: #333 !important;
    text-decoration: none !important;
    font-size: 15px !important;
    font-weight: 400 !important; /* Chữ mỏng vừa phải thanh lịch */
    transition: all 0.2s ease !important;
    border-bottom: 1px dashed #e5e5e5 !important; /* Đường kẻ đứt mờ giống y ảnh */
}

/* Dòng cuối cùng không cần viền dưới */
.dropdown-menu li:last-child a {
    border-bottom: none !important;
}

/* Hiệu ứng hover vào từng mục */
.dropdown-menu li a:hover {
    background-color: #fcfcfc !important; /* Nền đổi sang màu xám cực mờ */
    color: #e31837 !important; /* Chữ đỏ rực lên */
    /* Đã xóa hiệu ứng trượt (padding-left) để chữ đứng yên, cực kỳ dễ click */
}

/* Animation hiện dần mượt mà */
@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ô tìm kiếm */
.search-box {
    background-color: white;
    border-radius: 5px;
    display: flex;
    align-items: center;
    flex-grow: 1;
    height: 40px;
    padding: 0 10px;
    max-width: 500px; /* Giới hạn chiều rộng ô tìm kiếm cho đẹp */
}

.search-box input {
    border: none;
    outline: none;
    flex-grow: 1;
    font-size: 14px;
    color: #333;
    padding-right: 10px;
}

.search-box input::placeholder {
    color: #777;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn svg {
    width: 18px;
    height: 18px;
    fill: #333;
}

/* Navigation Menu */
.nav {
    margin-left: auto; /* Đẩy menu sang phải cùng */
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 15px; /* Giảm gap chút cho đỡ thưa */
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.nav-item a:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-icon {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none; /* Reset fill cho SVG dạng stroke */
    flex-shrink: 0;
}

/* FontAwesome Icon override (nếu dùng thẻ i) */
i.nav-icon {
    font-size: 20px;
    border: none;
    stroke: none;
    color: white;
}

.nav-text {
    font-size: 12px; /* Giảm size chữ chút cho tinh tế */
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
}

/* Badge Giỏ hàng */
.cart-icon-wrap {
    position: relative;
    display: flex;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: #fdd835;
    color: #e30019;
    font-size: 10px;
    font-weight: bold;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #e30019;
}

/* Nút Đăng nhập nổi bật */
.login-btn {
    background-color: #be1e2d;
    padding: 6px 12px !important;
    border-radius: 5px;
}

.login-btn:hover {
    background-color: #990000 !important;
}

/* =========================================
   4. BODY LAYOUT & BANNERS
   ========================================= */
.container {
    width: 1200px;
    margin: 0 auto;
    max-width: 100%;
    padding: 10px;
}

.main-layout {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    align-items: flex-start;
}

/* Sidebar Trái */
.sidebar-banner {
    width: 190px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
}
/* --- FIX LỖI BANNER DỌC BỊ TRÀN --- */
.sidebar-banner .hover-scale {
    height: auto !important; /* Để chiều cao tự nhiên theo ảnh */
    min-height: auto;
    display: block;
}

.sidebar-banner img {
    height: auto !important; /* Đảm bảo ảnh không bị méo */
    width: 100%;
    object-fit: cover;
    display: block;
}

/* Đảm bảo khung sidebar không bị co quá nhỏ */
.sidebar-banner {
    width: 190px;
    flex-shrink: 0;
    position: sticky;
    top: 90px; /* Cách header một chút cho đẹp */
    z-index: 90; /* Đảm bảo nổi lên trên các thành phần nền */
}

.sidebar-banner img {
    height: auto; /* Để ảnh tự nhiên */
    min-height: 400px; /* Chiều cao tối thiểu */
    object-fit: cover;
}

/* Cột Phải */
.right-column-content {
    flex-grow: 1;
    width: calc(100% - 205px);
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Menu Category Trắng */
.category-nav {
    background: white;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.nav-link {
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link:hover {
    color: #d70018;
}

/* Banner Grid Systems */
.banner-section-top {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 10px;
    height: 380px;
}

.small-banners-col {
    display: grid;
    grid-template-rows: 1fr 1fr; /* Chia đều 2 hàng */
    gap: 10px;
    height: 100%;
}

.banner-section-middle {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    height: 160px;
}

.banner-section-bottom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    height: 160px;
}

.hover-scale {
    overflow: hidden;
    border-radius: 10px;
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.hover-scale img {
    transition: transform 0.3s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hover-scale:hover img {
    transform: scale(1.05);
}

/* =========================================
   5. PRODUCT SLIDER SECTION
   ========================================= */
.product-section {
    background: white;
    padding: 20px 15px;
    margin-top: 20px;
    border-radius: 8px; /* Bo góc nhẹ container */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee; /* Đậm hơn chút */
    padding-bottom: 10px;
}

.section-title {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    color: #333;
}

.tag-installment {
    color: #e30019;
    font-weight: bold;
    font-size: 13px;
    background: #fff0f1;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.slider-viewport {
    overflow: hidden;
    width: 100%;
    padding: 5px 0; /* Padding để shadow không bị cắt */
}

.slider-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    gap: 10px;
}

/* Slider Buttons */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 16px;
    transition: all 0.3s;
}

.slider-btn:hover {
    background: #e30019;
    color: white;
    border-color: #e30019;
}

.btn-prev {
    left: -20px;
}
.btn-next {
    right: -20px;
}

/* Product Card */
.product-card {
    min-width: calc(20% - 8px); /* 5 sản phẩm 1 hàng (100% / 5 = 20%) trừ gap */
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #e30019;
    transform: translateY(-2px);
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Tạo khung vuông tỉ lệ 1:1 */
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 5px;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.product-card:hover .card-image img {
    transform: scale(1.1);
}

.gift-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: linear-gradient(90deg, #ff9900, #ff5e00);
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-info {
    text-align: left;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    height: 38px; /* Giới hạn chiều cao tiêu đề */
    line-height: 1.3;
}

.specs-box {
    background-color: #f9f9f9;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.specs-box span {
    font-size: 10px;
    color: #555;
    background: white;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.price-box {
    margin-top: auto; /* Đẩy giá xuống đáy card */
}

.old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    display: block;
    margin-bottom: 2px;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-price {
    font-size: 16px;
    color: #d70018;
    font-weight: 700;
}

.discount-tag {
    border: 1px solid #d70018;
    color: #d70018;
    font-size: 10px;
    padding: 0 4px;
    border-radius: 2px;
    font-weight: bold;
    background: #fff0f0;
}

.rating-box {
    font-size: 11px;
    color: #f5a623;
    margin-top: 5px;
    display: flex;
    align-items: center;
}

.review-count {
    color: #888;
    font-size: 11px;
    margin-left: 5px;
}

/* =========================================
   BANNER LỚN CUỐI TRANG
   ========================================= */
.bottom-big-banner {
    width: 100%;
    margin-top: 30px;
    margin-bottom: 0;
}

.bottom-big-banner img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 0; /* Banner lớn thường không bo góc */
}

/* =========================================
   FOOTER STYLES (GIỐNG GEARVN)
   ========================================= */
.footer-section {
    background-color: #fff;
    padding-top: 40px;
    border-top: 4px solid #f0f0f0; /* Đường kẻ ngăn cách mờ */
    margin-top: 0;
}

/* Chia bố cục 5 cột */
.footer-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 30px;
}

.footer-col {
    flex: 1; /* Các cột chia đều nhau */
    min-width: 180px; /* Đảm bảo không bị quá bé trên màn nhỏ */
}

/* Tiêu đề cột */
.footer-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    margin-bottom: 15px;
}

/* Danh sách link */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    font-size: 12px;
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #e30019; /* Màu đỏ khi hover */
}

/* Tổng đài hỗ trợ (Màu xanh) */
.support-info p {
    font-size: 12px;
    margin-bottom: 8px;
    color: #333;
}

.phone-link {
    color: #288ad6 !important; /* Màu xanh đặc trưng của link sđt */
    font-weight: 700;
    font-size: 13px;
}

.phone-link:hover {
    text-decoration: underline;
}

/* Icon thanh toán & Vận chuyển */
.icon-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.icon-row i {
    font-size: 24px;
    color: #555;
    border: 1px solid #eee;
    padding: 5px;
    border-radius: 4px;
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- FOOTER BOTTOM --- */
.footer-bottom {
    border-top: 1px solid #eee;
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mạng xã hội */
.social-connect {
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-connect span {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 10px;
}

.social-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #333;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.3s;
}

.social-icon.facebook {
    background-color: #3b5998;
}
.social-icon.tiktok {
    background-color: #000;
}
.social-icon.youtube {
    background-color: #c4302b;
}
.social-icon.zalo {
    background-color: #0068ff;
    font-size: 10px;
    font-weight: bold;
    border-radius: 10px; /* Zalo hình chữ nhật bo góc */
    width: auto;
    padding: 0 8px;
}
