/* ==========================================================================
   Phần bổ sung cho WordPress / WooCommerce (style.css là giao diện gốc của website HTML)
   ========================================================================== */

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--card); color: var(--text); padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { left: 16px; }

/* Thanh quản trị WordPress (khi đăng nhập) */
.admin-bar .topbar { top: 32px; }
.admin-bar .catnav-wrap { top: 96px; }
@media (max-width: 782px) {
  .admin-bar .topbar { top: 46px; }
  .admin-bar .catnav-wrap { top: 104px; }
}
@media (max-width: 600px) {
  .admin-bar .topbar { top: 0; }
  .admin-bar .catnav-wrap { top: 58px; }
}

/* Menu đầu trang dạng danh sách */
.nav-list { display: flex; align-items: stretch; gap: 24px; list-style: none; margin: 0; padding: 0; height: 100%; }
.nav-list > li { display: flex; }
.nav-link[aria-current="page"] { color: var(--accent-ink); }
.footer-menu ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-menu a { color: var(--accent); }

.anchor { display: block; position: relative; top: -10px; }

/* Thẻ sản phẩm khi dùng liên kết thay cho nút */
.card .photo { text-decoration: none; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--primary); text-decoration: underline; }
.add { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.add.ask-btn { background: var(--card); color: var(--accent-ink); border: 1.5px solid var(--accent); }
.add.ask-btn:hover { background: var(--accent-soft); }
.add.loading { opacity: .6; pointer-events: none; }
.add.added::after { content: " ✓"; }
.card-foot .added_to_cart { display: none; } /* WooCommerce tự chèn link "Xem giỏ hàng" — đã có thông báo và giỏ hàng trượt */
.more-card { text-decoration: none; }
.more-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.link-btn { text-decoration: none; }
.cat-card small .woocommerce-Price-amount { color: inherit; }

/* Đường dẫn: Trang chủ / Danh mục / Sản phẩm */
.woocommerce-breadcrumb { font-size: .84rem; color: var(--muted); margin: 18px 0 6px; }
.woocommerce-breadcrumb a { color: var(--muted); text-decoration: none; }
.woocommerce-breadcrumb a:hover { color: var(--accent-ink); }

/* Trang cửa hàng / danh mục */
.shop-archive { padding-top: 6px; }
.archive-head { margin-bottom: 18px; }
.archive-head h1 { margin: 0; display: flex; align-items: center; gap: 12px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.archive-head h1::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--accent); }
.archive-head .count { font: 600 .9rem "Be Vietnam Pro"; color: var(--primary); background: var(--surface); padding: 3px 10px; border-radius: 999px; }
.archive-head .sub-links { margin: 6px 0 14px; }
.sub-links a small { color: var(--muted); font-weight: 500; }
.sub-links a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.sub-links a[aria-current="page"] small { color: var(--accent); }
.archive-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.archive-tools .product-search { flex: 1 1 320px; max-width: 480px; }
.woocommerce-ordering { margin: 0 0 0 auto; }
.woocommerce-ordering select, .archive-tools select {
  font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 9px 14px; min-height: 44px;
}
.woocommerce .woocommerce-result-count, .woocommerce-result-count { float: none; color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.woocommerce .woocommerce-ordering, .woocommerce-ordering { float: none; }
.woocommerce .grid::before, .woocommerce .grid::after { content: none; } /* bỏ clearfix của WooCommerce trong lưới */
.woocommerce-pagination { margin: 28px 0 0; text-align: center; }
.woocommerce-pagination ul { display: inline-flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; border: 0; }
.woocommerce-pagination li { border: 0; }
.woocommerce-pagination a, .woocommerce-pagination span {
  display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 10px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font-weight: 600;
}
.woocommerce-pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Ô tìm kiếm sản phẩm */
.product-search { position: relative; display: flex; width: 100%; }
.product-search input[type="search"] {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 46px 9px 14px; min-height: 44px;
}
.product-search input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; background: var(--card); }
.product-search .search-submit {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: none; color: var(--muted); display: grid; place-items: center;
}
.controls .product-search { width: 320px; }
@media (max-width: 1060px) { .controls .product-search { width: 240px; } }
@media (max-width: 960px) { .controls .product-search { width: 100%; } }

/* Ô tìm kiếm trượt (mở từ thanh dưới cùng ở các trang không có ô tìm) */
dialog.search-sheet { width: min(560px, calc(100% - 32px)); padding: 16px; border-radius: 18px; margin: 12vh auto auto; }
@media (max-width: 720px) {
  dialog.search-sheet { width: 100%; margin: 0 0 auto; border-radius: 0 0 18px 18px; max-height: none; padding: 14px 16px; }
  dialog.search-sheet[open] { animation: none; }
}

/* Trang chi tiết sản phẩm */
.product-page { padding-bottom: 40px; }
.product-page .detail {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-top: 8px;
}
.product-page .gallery { min-height: 100%; }
.product-page .stage img { width: 100%; height: 100%; object-fit: cover; }
.product-page .thumbs button img { height: auto; }
.product-page h1.product_title { font-size: 1.7rem; padding-right: 0; margin-top: 6px; }
.product-page .cat-tag { text-decoration: none; }
.product-page .code { display: inline-block; }
.product-desc { margin-top: 32px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.product-desc h2 { font-size: 1.3rem; }
.related { margin-top: 36px; }

/* Ô số lượng + nút Thêm vào giỏ của WooCommerce */
.detail-actions form.cart { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; margin: 0; }
.detail-actions form.cart .single_add_to_cart_button { flex: 1; }
.quantity { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); }
.woocommerce .quantity .qty, .quantity .qty {
  width: 46px; padding: 0; border-radius: 0; min-height: 40px; border: 0; background: none; text-align: center; font: 600 16px "Be Vietnam Pro", sans-serif; color: var(--text);
  -moz-appearance: textfield; appearance: textfield;
}
.quantity .qty::-webkit-outer-spin-button, .quantity .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.quantity .qty-btn { width: 38px; height: 40px; border: 0; background: none; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.detail-actions { flex-wrap: wrap; }
.detail-actions .btn { flex: 1 1 auto; }

/* Nút của WooCommerce dùng màu của theme */
.woocommerce .button, .woocommerce button.button, .woocommerce a.button, .woocommerce input.button,
.single_add_to_cart_button, .checkout-button, #place_order, .wc-forward, .woocommerce-mini-cart__buttons .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 0; font: 700 1rem "Be Vietnam Pro", sans-serif;
  background: var(--button); color: #fff; text-decoration: none; cursor: pointer; transition: .15s;
}
.woocommerce .button:hover, .single_add_to_cart_button:hover, .checkout-button:hover, #place_order:hover { background: var(--button-hover); color: #fff; }
.woocommerce .button.alt, .single_add_to_cart_button.alt { background: var(--button); }
.woocommerce .button:disabled, .woocommerce .button.disabled { opacity: .5; cursor: not-allowed; }
.wc-block-components-button:not(.is-link) { background: var(--button) !important; color: #fff !important; border-radius: 999px !important; }

/* Thông báo */
.woocommerce-message, .woocommerce-info, .woocommerce-error, .woocommerce-notice {
  list-style: none; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft);
  border-left: 4px solid var(--accent); color: var(--text); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
}
.woocommerce-error { background: #fdecea; border-left-color: var(--sale); }
.woocommerce-message .button, .woocommerce-info .button { padding: 8px 16px; font-size: .9rem; order: 2; }

/* Giỏ hàng trượt (giỏ hàng mini của WooCommerce) */
.drawer-body .woocommerce-mini-cart { list-style: none; margin: 0; padding: 0; }
.woocommerce-mini-cart-item {
  position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; align-items: center;
  padding: 14px 28px 14px 0; border-bottom: 1px solid var(--line); font-size: .92rem;
}
.woocommerce-mini-cart-item a:not(.remove) { display: contents; color: var(--text); font-weight: 600; text-decoration: none; }
.woocommerce-mini-cart-item img { grid-row: span 2; width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.woocommerce-mini-cart-item .quantity { border: 0; background: none; color: var(--muted); font-size: .85rem; grid-column: 2; }
.woocommerce-mini-cart-item .remove {
  position: absolute; right: 0; top: 12px; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; color: var(--muted); text-decoration: none; font-size: 1.2rem;
}
.woocommerce-mini-cart-item .remove:hover { background: var(--surface); color: var(--sale); }
.woocommerce-mini-cart-item dl.variation { grid-column: 2; margin: 0; font-size: .8rem; color: var(--muted); }
.woocommerce-mini-cart__total { display: flex; justify-content: space-between; padding: 14px 0 6px; margin: 0; font-size: 1rem; }
.woocommerce-mini-cart__total .amount { color: var(--sale); font-weight: 800; }
.woocommerce-mini-cart__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 0; }
.woocommerce-mini-cart__buttons .button:not(.checkout) { background: var(--card); color: var(--text); border: 1.5px solid var(--line); }
.woocommerce-mini-cart__empty-message { text-align: center; color: var(--muted); padding: 48px 0; }
.drawer-foot .ship-hint { margin: 0; }
.drawer-foot:empty, .drawer-foot .ship-hint[hidden] { display: none; }

/* Trang thường, giỏ hàng, thanh toán (dạng mã ngắn cổ điển) */
.page-main { padding: 24px 0 56px; }
.page-head h1 { margin: 0 0 18px; }
.entry-content { font-size: 1rem; line-height: 1.7; }
.entry-content > * { max-width: 100%; }
.entry-content a { color: var(--accent-ink); }
.entry-content img { height: auto; border-radius: 12px; }
.woocommerce table.shop_table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.woocommerce table.shop_table th, .woocommerce table.shop_table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.woocommerce table.shop_table img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea, .woocommerce form .form-row select,
.woocommerce .input-text, .select2-container .select2-selection {
  font: inherit; font-size: 16px; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 44px; width: 100%;
}
.woocommerce form .form-row label { font-weight: 600; font-size: .9rem; }
.woocommerce .cart-collaterals, .woocommerce-checkout-review-order { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.woocommerce-checkout #payment { background: var(--surface); border-radius: 12px; padding: 14px; }
.woocommerce .amount { font-weight: 700; }

/* Bài viết */
.post-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.post-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.post-card .post-thumb img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.post-card .post-body { padding: 14px 16px 18px; }
.post-card h2 { font-size: 1.15rem; }
.post-card h2 a { color: inherit; text-decoration: none; }
.post-hero img { width: 100%; height: auto; border-radius: 14px; margin-bottom: 18px; }
.notfound { text-align: center; max-width: 560px; }
.notfound .product-search { margin: 18px 0; }

@media (max-width: 960px) {
  .post-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .post-list { grid-template-columns: 1fr; }
  .archive-tools .product-search { flex-basis: 100%; max-width: none; }
  .woocommerce-ordering { margin: 0; width: 100%; }
  .woocommerce-ordering select { width: 100%; }
  .archive-head .sub-links { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; width: auto; }
  .product-page .detail { border-radius: 14px; margin-inline: -4px; }
  .product-page h1.product_title { font-size: 1.35rem; }
  .product-page .detail-actions {
    position: sticky; bottom: calc(var(--bn-h) + env(safe-area-inset-bottom)); z-index: 5;
    margin: 14px -18px 0; padding: 12px 18px; background: var(--card); border-top: 1px solid var(--line);
  }
  .product-page .detail-body { padding: 18px 18px 6px; }
  .product-desc { padding: 18px; }
  .woocommerce table.shop_table_responsive tr td { display: block; text-align: right; }
  .woocommerce table.shop_table_responsive tr td::before { content: attr(data-title) ": "; float: left; font-weight: 600; }
  .woocommerce table.shop_table_responsive thead { display: none; }
  .woocommerce-mini-cart__buttons { grid-template-columns: 1fr; }
}
