/* Template ststore_v2 – khung header/menu/footer (bố cục tham khảo omegaplus, thương hiệu ststore).
   Mọi class dùng tiền tố .stv2- để không xung đột CSS estore đang nạp chung. */
:root {
    --stv2-primary: #27ae34;
    --stv2-primary-dark: #1e8a29;
    --stv2-accent: #d4b26b;
    --stv2-text: #2b2b2b;
    --stv2-muted: #6b6b6b;
    --stv2-line: #e6e6e6;
    --stv2-bg-soft: #f6f8f4;
    --stv2-footer-bg: #1f2a22;
    --stv2-radius: 8px;
    --stv2-shadow: 0 6px 24px rgba(0, 0, 0, .08);
}

/* ---------- Thanh trên ---------- */
.stv2-topbar { background: var(--stv2-primary); color: #fff; font-size: 13px; }
.stv2-topbar__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 34px; }
.stv2-topbar__slogan i { color: var(--stv2-accent); margin-right: 6px; }
.stv2-topbar__links { display: flex; gap: 20px; }
.stv2-topbar__links a { color: #fff; text-decoration: none; opacity: .92; }
.stv2-topbar__links a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Header ---------- */
.stv2-header { position: sticky; top: 0; z-index: 1030; background: #fff; border-bottom: 1px solid var(--stv2-line); transition: box-shadow .2s; }
.stv2-header.is-scrolled { box-shadow: var(--stv2-shadow); }
.stv2-header__wrap { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.stv2-logo img { display: block; height: 48px; width: auto; }
.stv2-burger { display: none; background: none; border: 0; font-size: 22px; color: var(--stv2-text); padding: 4px 8px; }

.stv2-nav { flex: 1; }
.stv2-nav__head { display: none; }
.stv2-nav__list { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.stv2-nav__item { position: static; }
.stv2-nav__link { display: flex; align-items: center; gap: 6px; padding: 26px 14px; font-weight: 600; font-size: 15px; color: var(--stv2-text); text-decoration: none; white-space: nowrap; }
.stv2-nav__link:hover, .stv2-nav__item:hover > .stv2-nav__link { color: var(--stv2-primary); text-decoration: none; }
.stv2-caret { font-size: 11px; transition: transform .2s; }
.stv2-nav__item--mega:hover .stv2-caret { transform: rotate(180deg); }

/* Mega menu "Tủ sách" */
.stv2-mega { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-top: 3px solid var(--stv2-primary);
    box-shadow: var(--stv2-shadow); padding: 24px max(24px, calc((100vw - 1140px) / 2)); opacity: 0; visibility: hidden;
    transform: translateY(8px); transition: all .18s; }
.stv2-nav__item--mega:hover .stv2-mega { opacity: 1; visibility: visible; transform: none; }
.stv2-mega__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 24px; }
.stv2-mega__link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--stv2-radius); color: var(--stv2-text); text-decoration: none; font-size: 14px; }
.stv2-mega__link i { color: var(--stv2-accent); width: 16px; text-align: center; }
.stv2-mega__link:hover { background: var(--stv2-bg-soft); color: var(--stv2-primary); text-decoration: none; }
.stv2-mega__all { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--stv2-primary); font-weight: 600; text-decoration: none; }

/* Nhóm nút bên phải */
.stv2-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.stv2-action { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 42px; min-width: 42px; justify-content: center;
    padding: 0 10px; border: 0; border-radius: 21px; background: transparent; color: var(--stv2-text); font-size: 18px; text-decoration: none; cursor: pointer; }
.stv2-action:hover { background: var(--stv2-bg-soft); color: var(--stv2-primary); text-decoration: none; }
.stv2-action--text span { font-size: 14px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stv2-cart__count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--stv2-accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

.stv2-account { position: relative; }
.stv2-account__menu { position: absolute; right: 0; top: 100%; min-width: 210px; margin: 0; padding: 8px 0; list-style: none; background: #fff;
    border-radius: var(--stv2-radius); box-shadow: var(--stv2-shadow); opacity: 0; visibility: hidden; transition: all .15s; }
.stv2-account:hover .stv2-account__menu { opacity: 1; visibility: visible; }
.stv2-account__menu a { display: block; padding: 8px 16px; color: var(--stv2-text); font-size: 14px; text-decoration: none; }
.stv2-account__menu a:hover { background: var(--stv2-bg-soft); color: var(--stv2-primary); }

/* Ô tìm kiếm thả xuống */
.stv2-search { display: none; border-top: 1px solid var(--stv2-line); background: #fff; }
.stv2-search.is-open { display: block; }
.stv2-search__form { display: flex; gap: 10px; padding-top: 14px; padding-bottom: 14px; }
.stv2-search__input { flex: 1; height: 46px; padding: 0 18px; border: 1px solid var(--stv2-line); border-radius: 23px; font-size: 15px; outline: none; }
.stv2-search__input:focus { border-color: var(--stv2-primary); }
.stv2-search__btn { height: 46px; padding: 0 22px; border: 0; border-radius: 23px; background: var(--stv2-primary); color: #fff; font-weight: 600; }
.stv2-search__btn:hover { background: var(--stv2-primary-dark); }

.stv2-overlay { display: none; }

/* ---------- Footer ---------- */
.stv2-footer { background: var(--stv2-footer-bg); color: #cfd6d0; font-size: 14px; margin-top: 48px; }
.stv2-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.1fr; gap: 32px; padding: 48px 0 32px; }
.stv2-footer__logo { display: block; margin-bottom: 12px; height: 52px; width: auto; background: #fff; border-radius: 6px; padding: 4px 8px; }
.stv2-footer__org { color: #fff; font-weight: 700; letter-spacing: .3px; margin-bottom: 10px; }
.stv2-footer__info, .stv2-footer__links { list-style: none; margin: 0; padding: 0; }
.stv2-footer__info li { margin-bottom: 8px; line-height: 1.5; }
.stv2-footer__info i { color: var(--stv2-accent); width: 18px; }
.stv2-footer a { color: #cfd6d0; text-decoration: none; }
.stv2-footer a:hover { color: #fff; text-decoration: underline; }
.stv2-footer__title { color: #fff; font-size: 15px; font-weight: 700; text-transform: uppercase; margin: 0 0 16px; position: relative; padding-bottom: 10px; }
.stv2-footer__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 36px; height: 2px; background: var(--stv2-accent); }
.stv2-footer__title--sub { margin-top: 24px; }
.stv2-footer__links li { margin-bottom: 10px; }
.stv2-footer__social { display: flex; gap: 10px; }
.stv2-footer__social a { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255, 255, 255, .08); color: #fff; font-size: 16px; }
.stv2-footer__social a:hover { background: var(--stv2-primary); text-decoration: none; }
.stv2-footer__apps { display: flex; flex-wrap: wrap; gap: 10px; }
.stv2-footer__apps a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; }
.stv2-footer__bct { display: inline-block; margin-top: 16px; font-size: 12px; opacity: .8; }
.stv2-footer__bottom { border-top: 1px solid rgba(255, 255, 255, .08); padding: 16px 0; font-size: 13px; color: #9aa59c; text-align: center; }

/* ---------- Ẩn khung cũ nếu còn nạp chung ---------- */
body.stv2 .menu_component, body.stv2 .menu_component-mobile { display: none !important; }

/* ---------- Máy tính bảng & điện thoại ---------- */
@media (max-width: 1199.98px) {
    .stv2-nav__link { padding: 26px 9px; font-size: 14px; }
    .stv2-mega__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stv2-action--text span { display: none; }
}
@media (max-width: 991.98px) {
    .stv2-topbar__slogan { display: none; }
    .stv2-topbar__inner { justify-content: center; }
    .stv2-header__wrap { min-height: 64px; gap: 10px; }
    .stv2-burger { display: block; }
    .stv2-logo img { height: 40px; }
    .stv2-nav { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 86vw; background: #fff; z-index: 1050;
        transform: translateX(-100%); transition: transform .25s; overflow-y: auto; }
    .stv2-nav.is-open { transform: none; }
    .stv2-nav__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--stv2-line); }
    .stv2-nav__close { background: none; border: 0; font-size: 20px; }
    .stv2-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
    .stv2-nav__link { padding: 14px 16px; border-bottom: 1px solid var(--stv2-line); justify-content: space-between; }
    .stv2-mega { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border-top: 0; padding: 4px 8px 12px; display: none; }
    .stv2-nav__item--mega.is-open .stv2-mega { display: block; }
    .stv2-mega__grid { grid-template-columns: 1fr; }
    .stv2-overlay.is-open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1040; }
    .stv2-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 575.98px) {
    .stv2-topbar__links a:not(:last-child) { display: none; }
    .stv2-actions { gap: 0; }
    .stv2-action { min-width: 38px; padding: 0 6px; }
    .stv2-footer__grid { grid-template-columns: 1fr; gap: 24px; padding-top: 32px; }
    .stv2-search__btn span, .stv2-search__btn { padding: 0 16px; }
}

/* =====================================================================
   MỨC 2 – TRANG CHỦ MỚI (views/estore/default/home.php)
   ===================================================================== */
.stv2-home { padding-bottom: 8px; }
.stv2-hero { margin-top: 20px; }
.stv2-hero img { border-radius: 12px; }

.stv2-usp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; list-style: none; margin: 20px 0 8px; padding: 18px 20px;
    background: #fff; border: 1px solid var(--stv2-line); border-radius: 12px; }
.stv2-usp li { display: flex; align-items: center; gap: 12px; }
.stv2-usp i { flex: 0 0 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--stv2-bg-soft); color: var(--stv2-primary); font-size: 18px; }
.stv2-usp b { display: block; font-size: 14px; color: var(--stv2-text); }
.stv2-usp span { display: block; font-size: 12px; color: var(--stv2-muted); line-height: 1.4; }

.stv2-sec { margin-top: 36px; }
.stv2-sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--stv2-line); }
.stv2-sec__title { position: relative; margin: 0; padding-bottom: 12px; font-size: 22px; font-weight: 800; color: var(--stv2-text); text-transform: none; }
.stv2-sec__title i { color: var(--stv2-primary); margin-right: 6px; font-size: 18px; }
.stv2-sec__title::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 64px; height: 3px; background: var(--stv2-primary); border-radius: 2px; }
.stv2-sec--hot .stv2-sec__title i { color: #e4572e; }
.stv2-sec--sale .stv2-sec__title i { color: var(--stv2-accent); }
.stv2-sec__more { padding-bottom: 12px; color: var(--stv2-primary); font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; }
.stv2-sec__more:hover { color: var(--stv2-primary-dark); }

/* Danh mục dạng tròn, cuộn ngang */
.stv2-cats { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; }
.stv2-cats::-webkit-scrollbar { height: 6px; } .stv2-cats::-webkit-scrollbar-thumb { background: var(--stv2-line); border-radius: 3px; }
.stv2-cat { flex: 0 0 120px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; text-decoration: none; scroll-snap-align: start; }
.stv2-cat__img { width: 104px; height: 104px; border-radius: 50%; overflow: hidden; background: var(--stv2-bg-soft); border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--stv2-line); transition: box-shadow .2s, transform .2s; }
.stv2-cat__img img { width: 100%; height: 100%; object-fit: cover; }
.stv2-cat__name { font-size: 13px; font-weight: 600; color: var(--stv2-text); line-height: 1.35; }
.stv2-cat:hover .stv2-cat__img { box-shadow: 0 0 0 2px var(--stv2-primary); transform: translateY(-3px); }
.stv2-cat:hover .stv2-cat__name { color: var(--stv2-primary); }

/* Lưới thẻ sách */
.stv2-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.stv2-card { display: flex; flex-direction: column; background: #fff; border-radius: 10px; transition: transform .2s, box-shadow .2s; }
.stv2-card:hover { transform: translateY(-4px); box-shadow: var(--stv2-shadow); }
.stv2-card__thumb { position: relative; display: block; aspect-ratio: 3 / 4; padding: 10px; background: var(--stv2-bg-soft); border-radius: 10px; overflow: hidden; }
.stv2-card__thumb img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .15)); transition: transform .3s; }
.stv2-card:hover .stv2-card__thumb img { transform: scale(1.04); }
.stv2-card__badge { position: absolute; top: 10px; left: 10px; z-index: 1; padding: 2px 8px; border-radius: 12px; background: #e4572e; color: #fff; font-size: 12px; font-weight: 700; }
.stv2-card__body { padding: 10px 4px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.stv2-card__name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em;
    font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--stv2-text); text-decoration: none; }
.stv2-card__name:hover { color: var(--stv2-primary); text-decoration: none; }
.stv2-card__author { font-size: 12px; color: var(--stv2-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stv2-card__price { margin-top: auto; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.stv2-card__sale { color: var(--stv2-primary-dark); font-weight: 800; font-size: 15px; }
.stv2-card__sale small { font-weight: 500; color: var(--stv2-muted); }
.stv2-card__base { color: #9a9a9a; font-size: 12px; text-decoration: line-through; }
.stv2-card__contact { color: var(--stv2-primary); font-size: 13px; font-weight: 600; }

/* Dải giới thiệu */
.stv2-promo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 36px; }
.stv2-promo__item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 26px 28px; border-radius: 14px; }
.stv2-promo__item b { display: block; font-size: 20px; margin-bottom: 4px; }
.stv2-promo__item span { display: block; font-size: 14px; opacity: .9; }
.stv2-promo__item--green { background: linear-gradient(120deg, var(--stv2-primary), #1b7d26); color: #fff; }
.stv2-promo__item--gold { background: linear-gradient(120deg, #f3e6c8, var(--stv2-accent)); color: #3b2f12; }
.stv2-btn { display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 22px; font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none; }
.stv2-btn--light { background: #fff; color: var(--stv2-primary-dark); }
.stv2-btn--dark { background: #3b2f12; color: #fff; }
.stv2-btn:hover { opacity: .9; text-decoration: none; }
.stv2-legacy { margin-top: 36px; }

@media (max-width: 1199.98px) { .stv2-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 991.98px) {
    .stv2-usp { grid-template-columns: repeat(2, 1fr); }
    .stv2-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
    .stv2-promo { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
    .stv2-grid--scroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
    .stv2-grid--scroll .stv2-card { flex: 0 0 42%; scroll-snap-align: start; }
    .stv2-sec__title { font-size: 18px; }
    .stv2-cat { flex-basis: 92px; } .stv2-cat__img { width: 80px; height: 80px; }
    .stv2-promo__item { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 575.98px) { .stv2-usp { grid-template-columns: 1fr; } }

/* =====================================================================
   MỨC 1 – "ÁO" CHO CÁC KHỐI ESTORE CŨ (chỉ khi template ststore_v2 bật: body.stv2)
   ===================================================================== */
body.stv2 { --Page-bg: none; background: #fff !important; color: var(--stv2-text); }
body.stv2 .wrapper { background: transparent; }
body.stv2 .section, body.stv2 .home-slider-section, body.stv2 .bg-layout, body.stv2 .bg-book-category, body.stv2 .bg-book-search { background: transparent !important; background-image: none !important; }
body.stv2 .green-card, body.stv2 [class*="green-card"] { background: #fff !important; border: 1px solid var(--stv2-line) !important; border-radius: 12px !important; box-shadow: none !important; }
body.stv2 .white-card-custom, body.stv2 .book_content { background: #fff !important; border: 1px solid var(--stv2-line); border-radius: 12px !important; box-shadow: none !important; }
body.stv2 .book_content-title, body.stv2 .border_bottom { border-bottom: 1px solid var(--stv2-line) !important; }
body.stv2 .book_content-title .h3-20, body.stv2 .book_content-title h3, body.stv2 .section_title, body.stv2 .title-section {
    color: var(--stv2-text) !important; font-weight: 800 !important; text-transform: none; position: relative; }
body.stv2 .btn-gray-link, body.stv2 .color-8C8C8C a { color: var(--stv2-primary) !important; font-weight: 600; }
body.stv2 .content_item { border-radius: 10px; transition: transform .2s, box-shadow .2s; }
body.stv2 .content_item:hover { transform: translateY(-4px); box-shadow: var(--stv2-shadow); }
body.stv2 .item-img img, body.stv2 .cover-thumb img { border-radius: 6px; }
body.stv2 .item_infor-title, body.stv2 .element-text { color: var(--stv2-text) !important; font-weight: 600; }
body.stv2 .item_infor-price .color-AA8B47, body.stv2 .color-AA8B47 { color: var(--stv2-primary-dark) !important; }
body.stv2 .category-card-warper { background: #fff; border: 1px solid var(--stv2-line); border-radius: 12px; transition: box-shadow .2s, transform .2s; }
body.stv2 .category-card-warper:hover { box-shadow: var(--stv2-shadow); transform: translateY(-3px); }
body.stv2 .category-title { color: var(--stv2-text) !important; font-weight: 700; }
body.stv2 .brcrumb, body.stv2 .breadcrumb, body.stv2 .breadcrumb_detail { background: transparent !important; border: 0 !important; font-size: 13px; }
body.stv2 .brcrumb a, body.stv2 .breadcrumb a { color: var(--stv2-muted); }
body.stv2 .btn-primary, body.stv2 .btn-success { background: var(--stv2-primary) !important; border-color: var(--stv2-primary) !important; }
body.stv2 .btn-primary:hover, body.stv2 .btn-success:hover { background: var(--stv2-primary-dark) !important; }
body.stv2 .pagination .page-item.active .page-link { background: var(--stv2-primary); border-color: var(--stv2-primary); }
body.stv2 .pagination .page-link { color: var(--stv2-primary); border-radius: 50% !important; margin: 0 3px; min-width: 36px; text-align: center; }
body.stv2 .owl-carousel .owl-nav button { background: #fff !important; box-shadow: var(--stv2-shadow); border-radius: 50% !important; }
body.stv2 input.form-control:focus, body.stv2 select.form-control:focus { border-color: var(--stv2-primary); box-shadow: 0 0 0 .15rem rgba(39, 174, 52, .15); }
