/*
Theme Name: Zenith Store
Theme URI: http://example.com/zenith
Author: Your Name
Description: A custom minimalist e-commerce theme for WooCommerce.
Version: 1.0.1
*/

/* CSS reset and base styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: #f7f6f2; color: #1a1a1a; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul { list-style: none; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; }

/* Header */
header { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; border-bottom: 1px solid #e5e5e5; }
.header-left { display: flex; gap: 24px; align-items: center; }
.header-left a { font-size: 14px; }
.logo { font-size: 20px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; position: absolute; left: 50%; transform: translateX(-50%); }
.header-right { display: flex; gap: 20px; align-items: center; }
.header-right span { font-size: 14px; font-weight: 500; }

/* Breadcrumb / Subheader */
.subheader { padding: 24px 0 20px; font-size: 11px; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }

/* Filters and Sort */
.toolbar { display: flex; justify-content: space-between; margin-bottom: 32px; }
.filters { display: flex; gap: 12px; }
.select-box { padding: 8px 16px; background: transparent; border: 1px solid #c0c0c0; border-radius: 20px; font-size: 13px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.select-box::after { content: "▾"; font-size: 12px; }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.product-card { cursor: pointer; text-align: left; }
.product-image-wrap { background: #e8e8e8; aspect-ratio: 4/5; border-radius: 8px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; transition: transform 0.2s;}
.product-card:hover .product-image-wrap { transform: translateY(-4px); box-shadow: 0 8px 16px rgba(0,0,0,0.05); }
.product-image-wrap img { max-width: 85%; max-height: 85%; object-fit: contain; mix-blend-mode: multiply; }
.wishlist-btn { position: absolute; bottom: 12px; right: 12px; font-size: 18px; color: #555; opacity: 0; transition: opacity 0.2s; }
.product-card:hover .wishlist-btn { opacity: 1; }

.product-info { padding: 4px 0; }
.product-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.product-price { font-size: 14px; color: #444; }

/* Modal Overlay */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(2px); }
.modal-overlay.active { display: flex; }

/* Modal Content */
.modal-box { background: white; width: 850px; max-width: 90%; border-radius: 16px; padding: 24px; position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; box-shadow: 0 30px 60px rgba(0,0,0,0.15); animation: modalIn 0.3s ease-out forwards; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-btn { position: absolute; top: 20px; right: 20px; font-size: 24px; color: #666; line-height: 1; z-index: 10; }

/* Modal Left: Images */
.modal-images { display: flex; flex-direction: column; gap: 12px; }
.main-image { background: #f8f8f8; border-radius: 12px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.main-image img { max-width: 85%; object-fit: contain; mix-blend-mode: multiply; }

/* Modal Right: Info */
.modal-info { display: flex; flex-direction: column; padding-top: 10px; }
.modal-category { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #666; margin-bottom: 6px; }
.modal-title { font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.modal-price { font-size: 22px; font-weight: 500; margin-bottom: 24px; }

.modal-desc { font-size: 13px; color: #555; line-height: 1.6; margin-bottom: 16px; }

.actions { display: flex; gap: 16px; margin-top: auto; }
.quantity { display: flex; align-items: center; background: #f5f5f5; border-radius: 24px; padding: 0 8px; height: 44px; border: 1px solid #eee; }
.qty-btn { font-size: 16px; width: 28px; color: #666; display: flex; align-items: center; justify-content: center;}
.qty-input { width: 32px; text-align: center; border: none; background: transparent; font-size: 14px; font-family: inherit;}
.add-to-cart { flex: 1; background: #2d2d30; color: white; border-radius: 24px; height: 44px; font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 8px; transition: background 0.2s; letter-spacing: 0.5px;}
.add-to-cart:hover { background: #1a1a1a; }


/* ========================================================
   RESPONSIVE DESIGN (Điện thoại, iPad)
   ======================================================== */

@media (max-width: 1024px) {
    /* Màn hình iPad nằm ngang */
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .modal-box { width: 95%; gap: 24px; }
}

@media (max-width: 768px) {
    /* Màn hình Điện thoại & iPad đứng */
    .container { padding: 0 16px; }
    
    /* Tinh chỉnh Header: Gộp lại cho gọn, ẩn bớt link phụ */
    header { position: relative; flex-wrap: wrap; }
    .header-left a { display: none; } 
    .logo { position: static; transform: none; flex: 1; text-align: center; }
    .header-right button { display: none; } 
    
    /* Thanh bộ lọc (Filters): Tràn dòng */
    .toolbar { flex-direction: column; gap: 16px; margin-bottom: 24px; }
    .filters { flex-wrap: wrap; }
    .select-box { padding: 6px 12px; font-size: 12px; }
    
    /* Lưới sản phẩm: Chia 2 cột trên điện thoại */
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-title { font-size: 13px; }
    .product-price { font-size: 13px; }
    
    /* Popup Modal: Ép thành 1 cột (Ảnh trên, chữ dưới), thêm thanh cuộn */
    .modal-box { 
        grid-template-columns: 1fr; 
        gap: 16px; 
        padding: 24px 16px; 
        max-height: 85vh; /* Giới hạn chiều cao popup */
        overflow-y: auto; /* Tạo thanh cuộn cho màn hình nhỏ */
    }
    
    /* Đảm bảo thanh cuộn hình nhỏ (Thumbnails) không bị vỡ */
    .thumbnails { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    
    /* Chỉnh chữ trong Modal không bị tràn */
    .modal-title { font-size: 20px; line-height: 1.3; margin-top: 10px; padding-right: 20px;}
    .modal-price { font-size: 18px; margin-bottom: 16px; }
    
    /* Làm nổi bật nút X đóng popup trên điện thoại */
    .close-btn { 
        top: 10px; right: 10px; 
        background: white; 
        width: 30px; height: 30px; 
        border-radius: 50%; 
        display: flex; align-items: center; justify-content: center; 
        box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    }
    
    /* Các nút Tăng giảm / Thêm giỏ hàng: Tràn 100% chiều ngang */
    .actions { flex-direction: column; margin-top: 24px; }
    .quantity { width: 100%; justify-content: space-between; height: 48px;}
    .add-to-cart { width: 100%; height: 48px; font-size: 14px;}
}
