/* =============================================================
   MORACHI - MODERN JAPANESE BEAUTY (MATCHING MOCKUP)
   ============================================================= */

:root {
    --primary-red: #ba1a1a;   /* Đỏ đô MORACHI */
    --primary-red-hover: #9c1515;
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --text-main: #333333;
    --text-muted: #888888;
    --border-color: #eeeeee;
    --icon-bg: #fce8e8;       /* Màu nền hồng nhạt cho icon */
    --radius-md: 8px;
    --radius-pill: 50px;
    --shadow-card: 0 2px 15px rgba(0,0,0,0.03);
}

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

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: var(--bg-body); 
    color: var(--text-main);
    line-height: 1.5;
}

.container { max-width: 1240px; margin: 0 auto; padding: 0 15px; }
a { text-decoration: none; color: inherit; }

/* =========================================
   HEADER STYLES
   ========================================= */
.modern-header { 
    background: var(--bg-surface); 
    position: sticky;  /* Giữ header dính chặt vào màn hình */
    top: 0;            /* Vị trí dính là sát mép trên cùng */
    z-index: 1000;     /* Đảm bảo header luôn nổi lên trên các nội dung khác */
    box-shadow: 0 2px 15px rgba(0,0,0,0.05); /* Đổ bóng nhẹ để tách biệt với nội dung khi cuộn */
}
/* 1. Top Bar */
.top-header { border-bottom: 1px solid var(--border-color); padding: 10px 0; font-size: 13px; color: var(--text-main); }
.top-header-inner { display: flex; justify-content: space-between; align-items: center; }
.top-header-left { display: flex; align-items: center; flex: 1; }
.top-header-item { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; border-right: 1px solid var(--border-color); }
.top-header-item:last-child { border-right: none; }
.top-header-item i { color: var(--primary-red); font-size: 16px; }
.top-header-right { display: flex; align-items: center; gap: 15px; padding-left: 20px; border-left: 1px solid var(--border-color); }
.phone-icon-circle { width: 30px; height: 30px; background: var(--icon-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary-red); }
.phone-text { display: flex; flex-direction: column; }
.phone-text strong { font-size: 15px; color: var(--primary-red); line-height: 1.2; }
.phone-text span { font-size: 11px; color: var(--text-muted); }

/* 2. Main Header */
.main-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 25px 0; gap: 40px; }

/* Logo */
.logo-area a { display: flex; align-items: center; gap: 12px; }
.logo-icon { height: 50px; width: auto; }
.logo-text h1 { font-family: 'Playfair Display', serif; font-size: 28px; color: #111; line-height: 1; letter-spacing: 1px; }
.logo-text p { font-size: 10px; letter-spacing: 4px; text-transform: uppercase; color: var(--text-muted); margin-top: 5px; }

/* Search Bar (Giữ class cho JS) */
.search-bar {
    flex: 1; max-width: 650px; display: flex;
    border: 1px solid var(--primary-red);
    border-radius: var(--radius-pill);
    padding: 2px;
    background: #fff;
}
.search-bar input {
    flex: 1; border: none; background: transparent;
    padding: 12px 25px; outline: none; font-size: 14px;
}
.search-bar button {
    width: 45px; background: transparent; border: none;
    font-size: 18px; color: #111; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Actions */
.header-actions { display: flex; align-items: center; gap: 30px; }
.action-item { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.action-icon {
    width: 42px; height: 42px; background: var(--icon-bg);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: var(--primary-red); font-size: 18px; position: relative;
}
.action-text { display: flex; flex-direction: column; }
.action-text strong { font-size: 14px; color: #111; line-height: 1.2; }
.action-text span { font-size: 12px; color: var(--text-muted); }

/* Cart Count (Giữ class cho JS) */
.cart-count {
    position: absolute; top: -5px; right: -5px;
    background: var(--primary-red); color: #fff;
    font-size: 11px; font-weight: bold;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 2px solid #fff;
}

/* 3. Red Banner */
.red-banner {
    background: var(--primary-red); color: white;
    text-align: center; padding: 10px 0;
    font-size: 13px; font-weight: bold; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.red-banner i { margin-right: 8px; font-size: 16px; vertical-align: middle; }

/* =========================================
   LAYOUT & BREADCRUMB
   ========================================= */
.breadcrumb { padding: 20px 0; font-size: 13px; color: var(--text-muted); }
.breadcrumb span { color: var(--primary-red); }

.main-layout { display: flex; gap: 25px; margin-bottom: 60px; }

/* =========================================
   SIDEBAR (Giữ class cho JS)
   ========================================= */
.sidebar { width: 280px; flex-shrink: 0; }

/* Tạo khối trắng bọc ngoài cho toàn bộ sidebar */
.sidebar-wrapper {
    background: var(--bg-surface); 
    padding: 25px;
    border-radius: var(--radius-md); 
    box-shadow: var(--shadow-card);
}

/* Bỏ background của từng section nhỏ để chúng hòa vào khối wrapper */
.filter-section {
    margin-bottom: 0; 
}

.filter-section h3 {
    font-size: 14px; margin-bottom: 20px; text-transform: uppercase;
    display: flex; align-items: center; gap: 10px; color: var(--text-main);
}

.filter-section h3::before { 
    content: ''; display: inline-block; width: 4px; height: 16px; background: var(--primary-red); 
}

/* Price Inputs */
.price-inputs { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.input-wrap { position: relative; flex: 1; }
.input-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--primary-red); font-size: 13px; }
.price-inputs input {
    width: 100%; padding: 10px 10px 10px 35px;
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    font-size: 13px; outline: none;
}
.price-divider { color: var(--text-muted); font-weight: bold; }

/* Apply Button (Giữ class cho JS) */
.btn-apply {
    width: 100%; padding: 12px; background: var(--primary-red); color: #fff;
    border: none; border-radius: var(--radius-md);
    font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;
}
.btn-apply:hover { background: var(--primary-red-hover); }

/* Divider Tag */
.filter-divider { 
    margin: 25px 0; 
    border-top: 1px solid var(--border-color); 
}

/* Checkbox Thương Hiệu */
.filter-section label { 
    display: flex; align-items: center; gap: 10px; 
    font-size: 14px; margin-bottom: 12px; cursor: pointer; color: var(--text-main); 
}
.filter-section label input[type="checkbox"] {
    accent-color: var(--primary-red);
    width: 16px; height: 16px; cursor: pointer;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.content { flex: 1; background: var(--bg-surface); padding: 30px; border-radius: var(--radius-md); box-shadow: var(--shadow-card); }

.content-header h2 { font-size: 22px; font-weight: bold; margin-bottom: 25px; display: flex; align-items: baseline; gap: 10px; }
.content-header h2 span { font-size: 13px; color: var(--text-muted); font-weight: normal; }

/* Sort Tabs (Giữ class cho JS) */
.sort-tabs { display: flex; gap: 30px; border-bottom: 1px solid var(--border-color); margin-bottom: 30px; }
.sort-tabs span { font-size: 14px; color: var(--text-main); cursor: pointer; padding-bottom: 12px; position: relative; }
.sort-tabs span.active { color: var(--primary-red); font-weight: bold; }
.sort-tabs span.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: var(--primary-red); }

/* Product Grid (Giữ class cho JS) */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.product-card { padding: 15px; border: 1px solid var(--border-color); border-radius: var(--radius-md); transition: 0.3s; cursor: pointer; position: relative; display: flex; flex-direction: column; }
.product-card:hover { border-color: var(--primary-red); box-shadow: 0 4px 15px rgba(218, 31, 38, 0.08); }
.product-img { width: 100%; height: 180px; object-fit: contain; margin-bottom: 10px; }
.brand { font-size: 11px; font-weight: bold; color: var(--text-muted); text-transform: uppercase; margin-bottom: 5px; }
.product-title { font-size: 13px; color: var(--text-main); line-height: 1.4; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-bottom: 10px; }
.price-group { margin-top: auto; }
.current-price { color: var(--primary-red); font-size: 16px; font-weight: bold; }
.old-price { font-size: 12px; color: var(--text-muted); text-decoration: line-through; margin-left: 5px; }
.product-rating { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-color); }
.stars { color: #f5c518; }
.discount-badge { position: absolute; top: 10px; left: 10px; background: var(--primary-red); color: white; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; z-index: 2;}

/* Skel loading / Empty State styling */
.skel-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 15px; display: flex; flex-direction: column; gap: 10px; height: 100%; }
.skel-img-home { width: 100%; height: 180px; background: #f0f0f0; }
.skel-line { width: 100%; height: 14px; background: #f0f0f0; }
.skel-line.short { width: 60%; }
.skel-price-home { width: 50%; height: 20px; background: #f0f0f0; margin-top: auto; }

/* =========================================
   CART DRAWER (Giữ ID cho JS)
   ========================================= */
.cart-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 2000; visibility: hidden; opacity: 0; transition: 0.3s; }
.cart-overlay.active { visibility: visible; opacity: 1; }
.cart-drawer { position: fixed; top: 0; right: -400px; width: 400px; height: 100%; background: #fff; z-index: 2001; transition: 0.3s; display: flex; flex-direction: column; box-shadow: -5px 0 20px rgba(0,0,0,0.05); }
.cart-drawer.active { right: 0; }
.cart-header { padding: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.cart-header h2 { font-size: 18px; }
.cart-header button { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.cart-items { flex: 1; overflow-y: auto; padding: 20px; }
.cart-footer { padding: 20px; border-top: 1px solid var(--border-color); background: var(--bg-body); }
.cart-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: bold; margin-bottom: 15px; }
.cart-total span:last-child { color: var(--primary-red); font-size: 20px; }
.btn-checkout { width: 100%; padding: 15px; background: var(--primary-red); color: white; border: none; border-radius: var(--radius-md); font-weight: bold; cursor: pointer; }

/* =========================================
   RESPONSIVE
   ========================================= */
/* =========================================
   TỐI ƯU SORT TABS (Cho phép vuốt ngang trên Mobile)
   ========================================= */
.sort-tabs { 
    display: flex; 
    gap: 30px; 
    border-bottom: 1px solid var(--border-color); 
    margin-bottom: 25px; 
    /* Thêm 3 dòng dưới để lướt ngang trên điện thoại */
    overflow-x: auto; 
    white-space: nowrap; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: none; /* Ẩn thanh cuộn Firefox */
}
.sort-tabs::-webkit-scrollbar { display: none; } /* Ẩn thanh cuộn Chrome/Safari */


/* =========================================
   RESPONSIVE (TỐI ƯU MOBILE & IPAD) - ĐÃ CẬP NHẬT LỀ
   ========================================= */
@media (max-width: 992px) {
    /* Đẩy Sidebar (Bộ lọc) lên trên lưới sản phẩm, chia cột dọc */
    .main-layout { flex-direction: column; padding: 20px 0; gap: 20px; }
    .sidebar { width: 100%; }
}

@media (max-width: 768px) {
    /* --- PHẦN 1: HEADER & MẠNG XÃ HỘI --- */
    .top-header { display: none; } /* Ẩn topbar để tiết kiệm không gian */
    .main-header-inner { flex-wrap: wrap; padding: 15px 0; gap: 15px; }
    
    .logo-area { flex: 1; }
    .logo-icon { height: 40px; }
    .logo-text h1 { font-size: 22px; }
    .logo-text p { font-size: 9px; letter-spacing: 2px; }

    .header-actions { flex: 1; justify-content: flex-end; gap: 20px; }
    .action-text { display: none; } 
    .action-icon { width: 38px; height: 38px; font-size: 16px; }
    
    .search-bar { width: 100%; order: 3; max-width: 100%; }
    .search-bar input { padding: 10px 15px; }

    .floating-contact { 
        transform: scale(0.75); 
        transform-origin: bottom right; 
        right: 15px !important; 
        bottom: 15px !important; 
    }

    /* --- PHẦN 2: ÉP LỀ VÀ KHOẢNG CÁCH (FIX LỖI SÁT LỀ) --- */
    /* Ép lề an toàn 15px cho toàn bộ khung website */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Tạo khoảng cách thoáng giữa các khối */
    .main-layout {
        padding-top: 15px;
        padding-bottom: 40px;
        gap: 20px;
    }

    /* Tối ưu lại khoảng trống bên trong các thẻ trắng trên Mobile */
    .sidebar-wrapper, 
    .content, 
    .pd-wrapper, 
    .pd-section-block {
        padding: 20px 15px !important;
        border-radius: 16px !important;
        width: 100%;
        box-sizing: border-box;
    }

    .breadcrumb {
        padding: 20px 15px 5px 15px !important;
    }

    /* Xếp lại ô nhập giá thành cột dọc cho dễ bấm */
    .price-inputs {
        flex-direction: column;
        gap: 15px;
    }
    .price-divider {
        display: none;
    }
}

@media (max-width: 576px) {
    /* --- PHẦN 3: LƯỚI SẢN PHẨM & GIỎ HÀNG --- */
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-card { padding: 10px; }
    .product-img { height: 150px; margin-bottom: 8px; }
    
    .product-title { font-size: 12px; height: 36px; margin-bottom: 5px; }
    .current-price { font-size: 15px; }
    .old-price { font-size: 11px; }
    .discount-badge { font-size: 10px; padding: 3px 6px; }

    .cart-drawer { width: 100%; right: -100%; }
}

/* =========================================
   ẨN ĐÁNH GIÁ & LƯỢT BÁN (Yêu cầu tùy chỉnh)
   ========================================= */

/* 1. Ẩn ở thẻ sản phẩm (Trang chủ) */
.product-rating {
    display: none !important;
}

/* 2. Ẩn ở trang Chi tiết sản phẩm (product-detail.html) */
.pd-rating {
    display: none !important;
}