/* Base Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #ff6600;
    --bg-color: #f4f6f9;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #eee;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

* {
    box-sizing: border-box;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* Header */
.site-header { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; justify-content: space-between; align-items: center; padding: 15px; }
.logo a { display: flex; align-items: center; }

.search-bar { flex: 1; max-width: 500px; margin: 0 20px; position: relative; }
.search-bar form { display: flex; }
.search-bar input { flex: 1; padding: 10px 15px; border: 1px solid #ccc; border-radius: 20px 0 0 20px; outline: none; font-family: inherit; }
.search-bar button { padding: 10px 20px; border: 1px solid #ccc; border-left: none; background: #f8f9fa; border-radius: 0 20px 20px 0; cursor: pointer; color: #666; transition: 0.2s; }
.search-bar button:hover { background: #e9ecef; }

.cart-icon a { font-weight: 500; color: #333; position: relative; display: inline-flex; align-items: center; }
.cart-count { background: red; color: #fff; font-size: 11px; font-weight: bold; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; position: absolute; top: -6px; left: -10px; right: auto; padding: 0; line-height: 1; }

.header-actions { display: flex; align-items: center; gap: 20px; }
.admin-link { font-weight: 600; text-decoration: none; }
.post-link { color: #28a745; }
.admin-dashboard-link { color: #dc3545; }

/* Navigation */
.main-nav { border-top: 1px solid var(--border-color); }
.main-nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 30px; }
.main-nav a { display: block; padding: 15px 0; font-weight: 500; font-size: 15px; transition: color 0.2s; }
.main-nav a:hover { color: var(--primary-color); }

/* Dropdown styles */
.main-nav ul li { position: relative; }
.main-nav ul li .dropdown-content { display: none; position: absolute; top: 100%; left: 0; background-color: #fff; min-width: 220px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; border-radius: 4px; padding: 10px 0; border: 1px solid var(--border-color); flex-direction: column; gap: 0; }
.main-nav ul li:hover .dropdown-content { display: flex; }
.main-nav ul li .dropdown-content li { width: 100%; }
.main-nav ul li .dropdown-content li a { padding: 10px 20px; font-weight: normal; font-size: 14px; border-bottom: 1px solid #f4f6f9; color: #333; }
.main-nav ul li .dropdown-content li:last-child a { border-bottom: none; }
.main-nav ul li .dropdown-content li a:hover { background-color: #f8f9fa; color: var(--primary-color); }

/* Main Content */
.site-main { padding: 40px 15px; min-height: 60vh; }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.product-card { background: var(--card-bg); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(0,0,0,0.1); }
.product-img { position: relative; padding-top: 100%; background: #f8f8f8; overflow: hidden; }
.product-img img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.product-badge { position: absolute; top: 10px; left: 10px; background: red; color: #fff; padding: 3px 8px; font-size: 12px; font-weight: bold; border-radius: 4px; z-index: 10; }
.product-price { position: absolute; bottom: 10px; right: 10px; background: rgba(0, 128, 0, 0.9); color: #fff; padding: 4px 10px; font-size: 14px; font-weight: bold; border-radius: 4px; z-index: 10; }

.product-info { padding: 15px; display: flex; flex-direction: column; flex: 1; text-align: center; }
.product-title { font-size: 14px; font-weight: 500; margin: 0 0 10px 0; color: #333; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.btn-add-cart { display: block; width: 100%; text-align: center; padding: 8px; background: #e7f1ff; border: 1px solid #b8daff; border-radius: 4px; color: var(--primary-color); font-weight: 600; cursor: pointer; transition: all 0.2s ease; font-size: 14px; }
.btn-add-cart:hover { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* Detail Page */
.product-detail-wrap { display: flex; gap: 40px; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.product-gallery { flex: 1; }
.main-img { width: 100%; border-radius: 8px; overflow: hidden; margin-bottom: 10px; border: 1px solid #eee; }
.thumbnail-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; }
.thumbnail-list img { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; opacity: 0.7; transition: 0.2s; }
.thumbnail-list img:hover, .thumbnail-list img.active { opacity: 1; border-color: var(--primary-color); }

.product-summary { flex: 1; }
.product-summary h1 { font-size: 24px; margin-top: 0; }
.price-tag { font-size: 28px; color: #d32f2f; font-weight: bold; margin: 15px 0; }
.product-meta { margin-bottom: 20px; font-size: 14px; color: #666; }
.product-meta div { margin-bottom: 5px; }

/* Product Actions Buttons */
.product-actions { display: flex; gap: 15px; margin-bottom: 15px; width: 100%; }
.product-actions .btn { flex: 1; padding: 12px 10px; border-radius: 4px; font-size: 14px; font-weight: bold; cursor: pointer; transition: 0.2s; text-align: center; border: none; display: flex; align-items: center; justify-content: center; gap: 6px; }
.product-actions .btn-buy { background: #ff6600; color: #fff; }
.product-actions .btn-buy:hover { background: #e65c00; }
.product-actions .btn-zalo { background: #0068ff; color: #fff; text-decoration: none; }
.product-actions .btn-zalo:hover { background: #0056d6; }

.btn-order-zalo { display: inline-block; padding: 12px 30px; background: #0068ff; color: #fff; border-radius: 30px; font-size: 16px; font-weight: bold; text-align: center; transition: 0.3s; width: 100%; box-sizing: border-box; margin-top: 10px; }
.btn-order-zalo:hover { background: #0054cc; }

.product-content { margin-top: 40px; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.product-content img { max-width: 100%; height: auto; }

/* Cart Page */
.cart-page { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: 15px; border-bottom: 1px solid #eee; text-align: left; }
.qty-input { width: 60px; padding: 5px; text-align: center; }

/* Footer */
.site-footer { background: #222; color: #ddd; padding: 30px 0 15px; margin-top: 40px; }
.footer-content { display: flex; gap: 40px; margin-bottom: 20px; }
.footer-col { flex: 1; }
.footer-col h3 { color: #fff; font-size: 16px; margin-bottom: 10px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 5px; }
.footer-col ul li a:hover { color: #fff; }
.footer-bottom { text-align: center; border-top: 1px solid #333; padding-top: 15px; font-size: 13px; }

/* Responsive */
@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; gap: 10px; padding: 10px 15px; }
    .logo a img { max-height: 35px; }
    .header-actions { flex: 0 0 auto; gap: 10px; }
    .cart-text, .admin-link span { display: none; } /* Hide text on mobile, keep icons */
    .cart-icon a { padding: 5px; }
    .search-bar { order: 3; flex: 1 1 100%; max-width: 100%; margin: 5px 0 0 0; }
    .search-bar input { padding: 8px 15px; }
    
    .site-main { padding: 15px 15px; }
    .product-detail-wrap { flex-direction: column; gap: 20px; padding: 15px; }
    .product-content { padding: 15px; }
    .cart-page { padding: 15px; }
    .footer-content { flex-direction: column; gap: 30px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    
    .main-nav ul {
        overflow-x: auto;
        white-space: nowrap;
        gap: 15px;
        padding: 5px 0;
        -webkit-overflow-scrolling: touch;
    }
    .main-nav a { padding: 10px 0; }
    
    .product-info { padding: 10px; }
    .product-title { font-size: 13px; }
    .product-price { padding: 3px 6px; font-size: 12px; }
    .btn-add-cart { padding: 6px; font-size: 13px; }
    .product-actions { gap: 10px; }
    .product-actions .btn { font-size: 12px; padding: 12px 5px; }
    .price-tag { font-size: 24px; }
}

@media (max-width: 992px) and (min-width: 769px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(1, 1fr); }
}
