/* Reset cơ bản */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f9f9f9; color: #333; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* Header - ĐEN (#222) */
header { background: #222; color: #fff; padding: 1rem 0; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.navbar { display: flex; justify-content: space-between; align-items: center; }

/* Logo - XANH CYAN (#00d2ff) */
.logo { font-size: 1.5rem; font-weight: bold; color: #00d2ff; display: flex; align-items: center; }
.logo img { max-height: 40px; margin-right: 10px; }

/* Menu Nav */
nav a { color: #fff; margin-left: 20px; font-weight: 500; transition: color 0.2s; }
nav a:hover { color: #00d2ff; }

/* --- GLOBAL PRODUCT CARD & GRID (Dùng chung cho trang chủ & ds sản phẩm) --- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 30px; margin: 40px 0; }
.card { background: #fff; border-radius: 8px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid #eee; }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.card img { width: 100%; height: 250px; object-fit: cover; }
.card-body { padding: 15px; }
.card-title { font-size: 1.1rem; margin-bottom: 5px; font-weight: 600; color: #333; height: 2.8em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;}
.price { color: #e53935; font-weight: bold; font-size: 1.1rem; }

/* Pagination */
.pagination { margin-top: 40px; text-align: center; }
.pagination a { padding: 8px 12px; border: 1px solid #ddd; margin: 0 5px; border-radius: 4px; display: inline-block; color: #333; background: white; }
.pagination a:hover { background-color: #f0f0f0; }
.pagination a.active { background-color: #00d2ff; color: white; border-color: #00d2ff; }

/* Footer */
footer { text-align: center; padding: 40px 20px; margin-top: 50px; color: #777; border-top: 1px solid #ddd; background: #fff; }
footer p { margin-bottom: 10px; }

/* Page Content */
.page-container { max-width: 800px; margin: 40px auto; padding: 0 20px; background: white; min-height: 400px; }
.page-title { text-align: center; margin-bottom: 30px; color: #333; border-bottom: 2px solid #eee; padding-bottom: 20px; }
.page-content { font-size: 16px; line-height: 1.6; color: #444; }

/* =========================================
   PRODUCT DETAIL PAGE STYLES
   ========================================= */

/* Layout chính trang chi tiết */
.product-detail-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Chia đôi màn hình: Ảnh - Thông tin */
    gap: 25px;
    margin-bottom: 10px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}
.product-description {
white-space: pre-wrap; 
font-family: Arial, sans-serif;
line-height: 1.6;
}
/* Phần hình ảnh chi tiết */
.detail-image {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.detail-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    object-fit: cover;
}

/* Phần thông tin chi tiết */
.detail-info h1.detail-title {
    font-size: 2.2rem;
    margin-top: 0;
    margin-bottom: 15px;
    color: #1a1a1a;
    line-height: 1.3;
}

.detail-price-large {
    font-size: 2rem;
    color: #e53935;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
}

.description {
    line-height: 1.6;
    color: #555;
    margin-bottom: 30px;
    font-size: 1.05rem;
}

/* Nút mua hàng */
.btn-buy {
    background-color: #1a1a1a;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    max-width: 300px;
    margin-top: 10px;
}
.btn-buy:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Thông tin vận chuyển (Shipping) */
.shipping-info-box {
    background: #f8f9fa;
    padding: 0px 20px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid #eee;
}
.shipping-info-box p {
    margin: 2px 0;
    font-size: 0.95rem;
    color: #444;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tags và Categories */
.meta-tags {
    margin-top: 5px;
    padding-top: 10px;
}
.meta-group {
    margin-bottom: 5px;
}
.meta-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-link {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.tag-link:hover {
    transform: translateY(-1px);
}
.cat-link {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}
.cat-link:hover { background-color: #c8e6c9; }

.t-link {
    background-color: #f5f5f5;
    color: #616161;
    border: 1px solid #e0e0e0;
}
.t-link:hover { background-color: #e0e0e0; }

/* --- SECTION SẢN PHẨM LIÊN QUAN --- */
.related-section {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.related-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: #333;
    position: relative;
    padding-left: 15px;
}
.related-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background-color: #e53935;
    border-radius: 2px;
}

/* Grid riêng cho sản phẩm liên quan (tái sử dụng style card ở trên) */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    border-color: #ddd;
}
.product-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.card-img-container {
    width: 100%;
    padding-top: 100%; /* Tạo khung vuông */
    position: relative;
    background: #f9f9f9;
    overflow: hidden;
}
.card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.product-card:hover .card-img {
    transform: scale(1.05);
}
.card-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.card-title-small {
    font-size: 1rem;
    margin: 0 0 10px;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #333;
    font-weight: 500;
}
.card-price-small {
    color: #e53935;
    font-weight: 700;
    font-size: 1.1rem;
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */

@media (max-width: 992px) {
    .product-detail {
        gap: 30px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    /* Navbar stack dọc */
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .navbar nav {
        margin-top: 15px;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    nav a {
        margin-left: 0;
        margin-right: 15px;
        font-size: 0.95rem;
    }

    /* Chuyển layout chi tiết sản phẩm thành 1 cột */
    .product-detail {
        grid-template-columns: 1fr; /* 1 cột duy nhất */
        gap: 20px;
    }
    
    .detail-info h1.detail-title {
        font-size: 1.8rem; /* Giảm cỡ chữ tiêu đề */
    }
    
    .detail-price-large {
        font-size: 1.6rem;
    }

    .btn-buy {
        width: 100%; /* Nút mua full chiều rộng */
        max-width: none;
        padding: 12px;
    }

    /* Grid sản phẩm liên quan: 2 cột trên mobile */
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .grid {
         grid-template-columns: repeat(2, 1fr); /* Grid trang chủ cũng 2 cột */
         gap: 15px;
    }

    .shipping-info-box {
        padding: 15px;
    }
    .related-section {
        margin-top: 40px;
    }
}

@media (max-width: 480px) {
    /* Màn hình rất nhỏ: Grid 1 cột hoặc điều chỉnh font nhỏ hơn */
    .grid, .related-grid {
        grid-template-columns: repeat(2, 1fr); /* Vẫn giữ 2 cột để xem được nhiều hơn */
        gap: 10px;
    }
    .card-title-small {
        font-size: 0.9rem;
    }
    .card-info {
        padding: 10px;
    }
}
