/* =========================================================
   CÂN MINH HUY STYLE THEME — main.css
   Toàn bộ màu sắc / độ rộng / bo góc lấy từ CSS variables
   do Customizer xuất ra (xem inc/customizer.php).
   KHÔNG hard-code màu ở đây để đảm bảo Customizer điều khiển được toàn bộ.
   ========================================================= */

:root {
    --cmh-container-width: 1200px;
    --cmh-border-radius: 6px;
    --cmh-color-primary: #e6472e;
    --cmh-color-secondary: #f7941d;
    --cmh-color-text: #333333;
    --cmh-color-link: #1a56a4;
    --cmh-color-header-bg: #ffffff;
    --cmh-color-topbar-bg: #e6472e;
    --cmh-color-footer-bg: #222222;
    --cmh-color-footer-text: #dddddd;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--cmh-color-text);
    line-height: 1.6;
    background: #f4f4f4;
}
a { color: var(--cmh-color-link); text-decoration: none; }
a:hover { color: var(--cmh-color-primary); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---------- Container: độ rộng toàn site điều khiển bởi Customizer ---------- */
.cmh-container {
    max-width: var(--cmh-container-width);
    margin: 0 auto;
    padding: 0 15px;
}

/* ---------- Nút bấm dùng chung (Liên hệ mua, Gửi liên hệ...) ---------- */
.cmh-btn {
    display: inline-block;
    background: var(--cmh-color-primary);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--cmh-border-radius);
    border: none;
    cursor: pointer;
    font-weight: 600;
}
.cmh-btn:hover { background: var(--cmh-color-secondary); color: #fff; }

/* ---------- Topbar ---------- */
.cmh-topbar { background: #f7f7f7; border-bottom: 1px solid #eee; font-size: 13px; }
.cmh-topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; flex-wrap: wrap; gap: 8px; }
.cmh-topbar-left span { margin-right: 16px; color: #555; }
.cmh-topbar-right a { margin-left: 14px; }
.cmh-topbar-right .cmh-account-trigger { font-weight: 600; color: var(--cmh-color-primary); cursor: pointer; }

/* ---------- Header ---------- */
.cmh-header { background: var(--cmh-color-header-bg); border-bottom: 1px solid #eee; }
.cmh-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; gap: 20px; flex-wrap: wrap; }
.cmh-logo img { max-height: 70px; }
.cmh-logo a { display: block; color: var(--cmh-color-text); }
.cmh-tagline { font-size: 12px; color: #777; font-weight: 400; }

.cmh-search-form { flex: 1; display: flex; max-width: 420px; }
.cmh-search-form input[type="search"] { flex: 1; border: 1px solid #ddd; border-radius: var(--cmh-border-radius) 0 0 var(--cmh-border-radius); padding: 10px 12px; min-width: 0; }
.cmh-search-form button { border: none; background: var(--cmh-color-primary); color: #fff; padding: 0 18px; border-radius: 0 var(--cmh-border-radius) var(--cmh-border-radius) 0; cursor: pointer; }

.cmh-hotline-box { text-align: right; white-space: nowrap; }
.cmh-hotline-label { display: block; font-size: 12px; color: #777; }
.cmh-hotline-number { font-size: 22px; font-weight: 800; color: var(--cmh-color-primary); }

/* ---------- Menu chính (đa cấp) ---------- */
.cmh-main-nav { background: var(--cmh-color-topbar-bg); }
.cmh-main-nav-inner { position: relative; }
.cmh-menu-toggle { display: none; background: none; border: none; color: #fff; font-weight: 700; padding: 14px 0; cursor: pointer; }
.cmh-main-nav ul.cmh-menu { display: flex; flex-wrap: wrap; }
.cmh-main-nav ul.cmh-menu > li { position: relative; }
.cmh-main-nav ul.cmh-menu > li > a {
    display: block; padding: 14px 18px; color: #fff; font-weight: 600;
}
.cmh-main-nav ul.cmh-menu > li:hover > a { background: rgba(0,0,0,.15); }
.cmh-main-nav ul.cmh-menu li.menu-item-has-children > a::after { content: " \25BE"; font-size: 11px; }
.cmh-main-nav ul.cmh-menu ul { position: absolute; top: 100%; left: 0; min-width: 240px; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.15); z-index: 50; display: none; }
.cmh-main-nav ul.cmh-menu ul ul { top: 0; left: 100%; }
.cmh-main-nav ul.cmh-menu li:hover > ul { display: block; }
.cmh-main-nav ul.cmh-menu ul li a { color: #333; padding: 10px 16px; }
.cmh-main-nav ul.cmh-menu ul li a:hover { background: #f4f4f4; }

/* ---------- Modal Đăng nhập / Đăng ký ---------- */
.cmh-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 999; align-items: center; justify-content: center; }
.cmh-modal-overlay.is-open { display: flex; }
.cmh-modal-box { background: #fff; width: 100%; max-width: 400px; border-radius: var(--cmh-border-radius); padding: 30px; position: relative; max-height: 90vh; overflow-y: auto; }
.cmh-modal-close { position: absolute; top: 10px; right: 14px; border: none; background: none; font-size: 22px; cursor: pointer; }
.cmh-modal-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #eee; }
.cmh-tab-btn { flex: 1; border: none; background: none; padding: 10px; cursor: pointer; font-weight: 600; color: #999; border-bottom: 2px solid transparent; }
.cmh-tab-btn.active { color: var(--cmh-color-primary); border-bottom-color: var(--cmh-color-primary); }
.cmh-tab-panel { display: none; }
.cmh-tab-panel.active { display: block; }
.cmh-tab-panel input[type="text"], .cmh-tab-panel input[type="email"], .cmh-tab-panel input[type="password"] { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: var(--cmh-border-radius); margin-top: 4px; }
.cmh-tab-panel label { display: block; margin-bottom: 12px; font-size: 14px; }
.cmh-tab-panel button[type="submit"] { width: 100%; }

/* ---------- Nút gọi nổi ---------- */
.cmh-floating-call { position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px; background: var(--cmh-color-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 500; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.cmh-floating-call-icon { font-size: 24px; }
.cmh-floating-call-ring { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--cmh-color-primary); animation: cmh-pulse 1.6s infinite; }
@keyframes cmh-pulse {
    0% { transform: scale(1); opacity: .8; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- Layout tổng: Nội dung + Sidebar ---------- */
.cmh-main-layout { display: flex; gap: 24px; padding: 24px 0; align-items: flex-start; }
.cmh-content { flex: 1; min-width: 0; }
.cmh-sidebar { width: 300px; flex-shrink: 0; }

/* Bố cục Sidebar TRÁI */
body.cmh-layout-sidebar-left .cmh-main-layout { flex-direction: row-reverse; }

/* Không dùng Sidebar (full width) */
body.cmh-no-sidebar .cmh-sidebar { display: none; }

/* ---------- Grid sản phẩm ---------- */
.cmh-product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
body.cmh-no-sidebar .cmh-product-grid { grid-template-columns: repeat(5, 1fr); }
.cmh-product-card { background: #fff; border-radius: var(--cmh-border-radius); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: box-shadow .2s; }
.cmh-product-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.cmh-product-card img { aspect-ratio: 1/1; object-fit: cover; }
.cmh-product-card h4 { font-size: 15px; padding: 8px 10px 0; margin: 0; height: 42px; overflow: hidden; }
.cmh-product-card .cmh-price { color: var(--cmh-color-primary); font-weight: 700; padding: 6px 10px 12px; }

/* ---------- Widget / Sidebar box ---------- */
.cmh-widget { background: #fff; border-radius: var(--cmh-border-radius); padding: 16px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cmh-widget-title { margin: 0 0 12px; font-size: 16px; border-left: 4px solid var(--cmh-color-primary); padding-left: 10px; }

/* ---------- Footer ---------- */
.cmh-footer { background: var(--cmh-color-footer-bg); color: var(--cmh-color-footer-text); margin-top: 30px; }
.cmh-footer a { color: var(--cmh-color-footer-text); }
.cmh-footer a:hover { color: var(--cmh-color-secondary); }
.cmh-footer-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 40px 0; }
.cmh-footer-title { color: #fff; margin-bottom: 12px; }
.cmh-footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 16px 0; text-align: center; font-size: 13px; }

/* ---------- Slider trang chủ ---------- */
.cmh-slider { position: relative; max-width: var(--cmh-container-width); margin: 20px auto 0; overflow: hidden; border-radius: var(--cmh-border-radius); }
.cmh-slider-track { position: relative; aspect-ratio: 16/5; }
.cmh-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
.cmh-slide.is-active { opacity: 1; z-index: 2; }
.cmh-slide img { width: 100%; height: 100%; object-fit: cover; }
.cmh-slide-caption { position: absolute; left: 30px; bottom: 30px; background: rgba(0,0,0,.5); color: #fff; padding: 10px 18px; border-radius: var(--cmh-border-radius); font-size: 18px; }
.cmh-slider-prev, .cmh-slider-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; background: rgba(255,255,255,.85); border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 20px; }
.cmh-slider-prev { left: 14px; } .cmh-slider-next { right: 14px; }
.cmh-slider-dots { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; }
.cmh-dot { width: 10px; height: 10px; border-radius: 50%; border: none; background: rgba(255,255,255,.6); cursor: pointer; }
.cmh-dot.is-active { background: #fff; }

/* ---------- Khối sản phẩm theo danh mục (Trang chủ) ---------- */
.cmh-home-block { margin-top: 30px; background: #fff; border-radius: var(--cmh-border-radius); padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.cmh-home-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; border-bottom: 2px solid var(--cmh-color-primary); padding-bottom: 10px; }
.cmh-home-block-head h2 { margin: 0; font-size: 20px; color: var(--cmh-color-primary); }
.cmh-view-all { font-size: 14px; font-weight: 600; }
.cmh-home-empty { background: #fff; padding: 30px; border-radius: var(--cmh-border-radius); margin-top: 20px; text-align: center; color: #777; }
.cmh-home-page-content { background: #fff; padding: 20px; border-radius: var(--cmh-border-radius); margin-top: 20px; }
.cmh-breadcrumb { background: #eee; padding: 10px 0; font-size: 14px; }

/* ---------- Sidebar bộ lọc (Danh mục/Thương hiệu/Độ chính xác) ---------- */
.cmh-widget-filter ul { list-style: none; margin: 0; padding: 0; }
.cmh-widget-filter li { border-bottom: 1px dashed #eee; }
.cmh-widget-filter li:last-child { border-bottom: none; }
.cmh-widget-filter li a { display: block; padding: 8px 2px; color: var(--cmh-color-text); font-size: 14px; }
.cmh-widget-filter li a:hover { color: var(--cmh-color-primary); padding-left: 6px; }
.cmh-widget-filter .children { padding-left: 14px; }

/* ---------- Trang Danh mục/Thương hiệu/Tất cả sản phẩm ---------- */
.cmh-archive-head { background: #fff; padding: 20px; border-radius: var(--cmh-border-radius); margin-top: 20px; }
.cmh-archive-title { margin: 0 0 8px; font-size: 22px; color: var(--cmh-color-primary); }
.cmh-archive-desc { color: #666; font-size: 14px; }
.cmh-archive-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 16px 0; font-size: 14px; color: #555; flex-wrap: wrap; gap: 10px; }
.cmh-sort-form select { padding: 6px 10px; border-radius: var(--cmh-border-radius); border: 1px solid #ddd; }
.cmh-empty-notice { background: #fff; padding: 30px; text-align: center; border-radius: var(--cmh-border-radius); color: #777; }
.cmh-pagination { margin-top: 20px; text-align: center; }
.cmh-pagination .page-numbers { display: inline-block; padding: 8px 14px; margin: 0 3px; background: #fff; border-radius: var(--cmh-border-radius); color: var(--cmh-color-text); }
.cmh-pagination .page-numbers.current { background: var(--cmh-color-primary); color: #fff; }

/* ---------- Card sản phẩm: bổ sung mã SP + nút Liên hệ mua nhỏ ---------- */
.cmh-product-card-thumb { display: block; }
.cmh-no-thumb { aspect-ratio: 1/1; background: #f2f2f2; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 13px; }
.cmh-card-code { font-size: 12px; color: #888; padding: 0 10px; }
.cmh-btn-sm { margin: 0 10px 12px; padding: 6px 12px; font-size: 13px; }

/* ---------- Trang chi tiết sản phẩm ---------- */
.cmh-product-single { background: #fff; border-radius: var(--cmh-border-radius); padding: 24px; margin-top: 20px; }
.cmh-product-single-top { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.cmh-gallery-main { border: 1px solid #eee; border-radius: var(--cmh-border-radius); overflow: hidden; }
.cmh-gallery-main img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.cmh-gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cmh-gallery-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: var(--cmh-border-radius); cursor: pointer; border: 2px solid transparent; }
.cmh-gallery-thumb.is-active { border-color: var(--cmh-color-primary); }

.cmh-product-info h1 { margin-top: 0; font-size: 24px; }
.cmh-product-single-price { font-size: 26px; font-weight: 800; color: var(--cmh-color-primary); margin: 10px 0; }
.cmh-spec-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.cmh-spec-table th, .cmh-spec-table td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
.cmh-spec-table th { width: 140px; color: #777; font-weight: 600; }

.cmh-cta-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.cmh-btn-lg { font-size: 16px; padding: 14px 22px; }
.cmh-btn-zalo { background: #0068ff; }
.cmh-btn-zalo:hover { background: #0052cc; }

.cmh-product-block { margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; }
.cmh-product-block h3 { color: var(--cmh-color-primary); margin-bottom: 14px; }
.cmh-specs-list li { padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 14px; }

/* ---------- Trang Liên hệ ---------- */
.cmh-contact-page { background: transparent; margin-top: 20px; }
.cmh-contact-page h1 { color: var(--cmh-color-primary); }
.cmh-contact-intro { background: #fff; padding: 16px 20px; border-radius: var(--cmh-border-radius); margin-bottom: 20px; }
.cmh-contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; align-items: start; }
.cmh-contact-info-list li { padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 14px; }
.cmh-contact-info-list li:last-child { border-bottom: none; }
.cmh-map-widget iframe { border-radius: var(--cmh-border-radius); }

/* ---------- Form liên hệ (dùng chung: Trang Liên hệ + shortcode) ---------- */
.cmh-form-notice { padding: 12px 16px; border-radius: var(--cmh-border-radius); margin-bottom: 16px; font-size: 14px; }
.cmh-form-notice-ok { background: #e6f7e9; color: #1a7d33; border: 1px solid #b8e6c3; }
.cmh-form-notice-error { background: #fdeaea; color: #b3261e; border: 1px solid #f5c2c0; }
.cmh-contact-form .cmh-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmh-contact-form label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.cmh-contact-form input[type="text"], .cmh-contact-form input[type="email"], .cmh-contact-form textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #ddd; border-radius: var(--cmh-border-radius); font-weight: 400; font-family: inherit;
}
.cmh-contact-form textarea { resize: vertical; }

/* ---------- Widget "Mới nhất" (sidebar) ---------- */
.cmh-latest-list { list-style: none; margin: 0; padding: 0; }
.cmh-latest-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #eee; }
.cmh-latest-list li:last-child { border-bottom: none; }
.cmh-latest-thumb { width: 56px; height: 56px; flex-shrink: 0; border-radius: 4px; overflow: hidden; display: block; }
.cmh-latest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cmh-latest-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cmh-latest-info a { font-size: 13px; line-height: 1.3; color: var(--cmh-color-text); }
.cmh-latest-info a:hover { color: var(--cmh-color-primary); }
.cmh-latest-price { font-size: 13px; font-weight: 700; color: var(--cmh-color-primary); }

/* ---------- Hộp Hotline Kinh doanh / Kỹ thuật (sidebar) ---------- */
.cmh-support-group { padding: 10px 0; border-bottom: 1px dashed #eee; }
.cmh-support-group:last-of-type { border-bottom: none; }
.cmh-support-label { font-weight: 700; font-size: 13px; color: #888; text-transform: uppercase; margin-bottom: 4px; }
.cmh-support-phone { display: inline-block; font-weight: 700; color: var(--cmh-color-primary); font-size: 16px; margin-right: 10px; }
.cmh-support-zalo { display: inline-block; font-size: 13px; color: #0068ff; font-weight: 600; }
.cmh-support-email { margin-top: 8px; font-size: 13px; color: #666; }

/* ---------- Đối tác liên kết (sidebar) ---------- */
.cmh-widget-partner-item { display: inline-block; width: 31%; margin: 0 1% 10px; vertical-align: top; }
.cmh-widget-partner-item img { border: 1px solid #eee; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .cmh-main-layout { flex-direction: column; }
    body.cmh-layout-sidebar-left .cmh-main-layout { flex-direction: column; }
    .cmh-sidebar { width: 100%; }
    .cmh-product-grid { grid-template-columns: repeat(2, 1fr); }
    .cmh-footer-columns { grid-template-columns: 1fr; }
    .cmh-topbar-left span { display: block; margin: 2px 0; }
    .cmh-search-form { order: 3; max-width: 100%; width: 100%; }
    .cmh-menu-toggle { display: block; }
    .cmh-main-nav ul.cmh-menu { display: none; flex-direction: column; }
    .cmh-main-nav.is-open ul.cmh-menu { display: flex; }
    .cmh-main-nav ul.cmh-menu ul { position: static; box-shadow: none; min-width: 0; }
    .cmh-main-nav ul.cmh-menu ul ul { left: 0; }
    .cmh-product-single-top { grid-template-columns: 1fr; }
    .cmh-contact-grid { grid-template-columns: 1fr; }
    .cmh-contact-form .cmh-form-row { grid-template-columns: 1fr; }
}
