* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; color: #1f1f1f; background: #f6f2e8; }
a { color: #7a4e12; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1200px, 94%); margin: 0 auto; }
.narrow { width: min(860px, 94%); }
.top-head { position: sticky; top: 0; z-index: 30; background: #3a301d; border-bottom: 3px solid #8d6a2e; }
.header-wrap { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: center; padding: 12px 0; }
.brand { color: #fff; display: flex; flex-direction: column; }
.brand-title { font-weight: 700; letter-spacing: .6px; }
.brand-sub { font-size: 12px; opacity: .9; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; padding: 9px 10px; border-radius: 6px; border: 1px solid #c8b58d; }
.search button, .actions button, .card button, .form-card button { background: #8d6a2e; color: #fff; border: none; border-radius: 6px; padding: 9px 12px; cursor: pointer; }
.actions { display: flex; gap: 10px; align-items: center; }
.inline-form { display: inline; }
.hero { background: linear-gradient(120deg, #4d3f22, #91713a); color: #fff; padding: 48px 0; }
.hero h1 { margin: 0 0 8px; }
.section-block { padding: 28px 0; }
.section-block h2, .section-block h1 { margin-top: 0; color: #4b3716; }
.cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.card { background: #fff; border: 1px solid #e2d7c0; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: #e9e9e9; }
.card-body { padding: 10px; }
.card-title { font-weight: 700; display: block; margin-bottom: 6px; }
.price { color: #bf1a1a; font-weight: 700; }
.form-card { background: #fff; border: 1px solid #e2d7c0; border-radius: 8px; padding: 14px; display: grid; gap: 8px; }
.form-card input, .form-card textarea { padding: 10px; border: 1px solid #c9b89a; border-radius: 6px; }
.alert { padding: 12px; border-radius: 6px; margin-bottom: 10px; }
.alert.success { background: #e9f8ec; color: #1e6f3e; border: 1px solid #8dd3a5; }
.alert.error { background: #fff0f0; color: #8f2020; border: 1px solid #f0bbbb; }
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e2d7c0; }
.cart-table th, .cart-table td { border-bottom: 1px solid #eee2ce; padding: 10px; text-align: left; }
.admin-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.admin-card { display: block; padding: 14px; background: #fff; border: 1px solid #e2d7c0; border-radius: 8px; }
.footer { background: #2f2719; color: #fff; padding: 22px 0; margin-top: 24px; }
@media (max-width: 1000px) {
  .header-wrap { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .cards-grid { grid-template-columns: 1fr; }
  .actions { flex-wrap: wrap; }
}

/* ===== Layout classes matching hophamvietnam.com bố cục gốc ===== */

/* Section container clearfix */
.placeSlide_main { overflow: hidden; position: relative; }
.placeSlide_main::after { content: ''; display: block; clear: both; }

/* Danh sách tin (sp_title3lan): tiêu đề / mô tả chữ đen trên nền sáng — không dùng .mauchu (main layout ép .mauchu màu trắng) */
.post-section-list .post-section-title,
.post-section-list a.post-section-title {
  color: #1a1a1a !important;
  font-weight: 600;
  display: block;
  line-height: 1.3;
}
.post-section-list .post-section-title:hover {
  color: #5c3d0c !important;
}
.post-section-excerpt {
  font-size: 13px;
  color: #1f1f1f;
  line-height: 1.4;
  margin-top: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-height: 2.8em;
}
.post-section-empty {
  padding: 20px;
  color: #444;
}

/* Ảnh đại diện trong danh sách: bo tròn, giữ tỷ lệ (không méo) */
.microformat.in_title3lan .boximg {
  border-radius: 50%;
  flex-shrink: 0;
}
.microformat.in_title3lan .boximg img.img_round {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Trang chủ — khối tin cùng layout: mô tả đậm hơn .boxdesc gốc (#999) */
.placeSlide_main .boxdesc {
  color: #333;
}

/* Banner trang chủ — cuộn cùng nội dung, không overlay khi scroll */
#home_in_id.home-has-banner {
  padding-top: 0 !important;
}
#home_in_id > .banner-head {
  position: static !important;
  z-index: auto !important;
  top: auto !important;
  left: auto !important;
  flex: 0 0 auto;
  flex-shrink: 0;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100%;
  margin: 0 0 8px;
  overflow: hidden;
  line-height: 0;
  height: auto !important;
  min-height: 72px;
}
#home_in_id > .banner-head .owl-carousel {
  display: block !important;
}
#home_in_id > .banner-head .owl-carousel.owl-loaded {
  display: block !important;
}
#home_in_id > .banner-head .owl-stage-outer,
#home_in_id > .banner-head .owl-stage,
#home_in_id > .banner-head .owl-item {
  width: 100%;
}
.banner-head-link {
  display: block;
  line-height: 0;
}
.banner-head-img,
.banner-head ul li img {
  width: 100% !important;
  height: auto !important;
  display: block !important;
  object-fit: cover;
  max-height: 420px;
  min-height: 72px;
}
.banner-head ul {
  margin: 0;
  padding: 0;
}
.banner-head ul li {
  list-style: none;
  line-height: 0;
}
.banner-head .owl-carousel,
.banner-head .owl-carousel.owl-loaded {
  display: block !important;
}
@media (max-width: 1024px) {
  #home_in_id .banner-head-img,
  .banner-head ul li img {
    max-height: 280px;
  }
}

/* Section widths */
.widthmb { width: 100%; box-sizing: border-box; }

/* Flex row margin offset (compensate child padding) */
.row_margin { margin: 0 -10px; }

/* Min-height for product card info box */
.min_h_95 { min-height: 95px; }

/* Banner image inside section carousel */
.banner_qc { width: 100%; height: auto; display: block; border-radius: 8px; }

/* Add-to-cart button inside product grid */
a.a_datmon, button.a_datmon {
  background: none;
  border: none;
  cursor: pointer;
  color: #8d6a2e;
  font-size: 16px;
  vertical-align: middle;
  padding: 0 3px;
  display: inline-block;
}
a.a_datmon:hover, button.a_datmon:hover { color: #060; }

/* Section heading overrides for box_home_h3 / _h3 */
.box_home_h3, ._h3 {
  background: linear-gradient(45deg, #3a301d, #5e4d29);
  font-weight: bold;
  display: block;
  padding: 6px 15px;
  color: #ffc107;
  margin: 15px 0;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* section wrapper utilities */
.box_home_cus0, ._cus0 { position: relative; }
.box_home_cus1, ._cus1 { position: relative; }
.box_home_cus2, ._cus2 { padding: 0; }
.box_home_title, ._title { margin-bottom: 2px; }
.box_home_icon_918,
.box_home_icon_917,
.box_home_icon_911,
.box_home_icon_912,
.box_home_icon_906,
.box_home_icon_913,
.box_home_icon_939,
._icon_936 { display: none; }

/* classmetao item separator */
.classmetao { border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 2px; }
.khoangluong { height: 4px; }

/* bannerMain section banner wrapper */
.bannerMain { position: relative; overflow: hidden; border-radius: 8px; margin-bottom: 8px; }
.bannerMain .banner_qc { border-radius: 8px; }

/* noview helper */
.noview { display: block; }

/* box_title inside product card */
.box_title a { display: block; }

/* OWL carousel init for section left banners */
.owl_thumb_cat_left img { width: 100%; height: auto; display: block; }

/* Tin tức / video card trang chủ — lưới 4 cột (desktop) / 2 cột (mobile), chiều cao đồng đều */
.home-youtube-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: stretch;
}
.home-youtube-grid > .clear {
  display: none;
}
.home-youtube-grid .home-youtube {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: visible;
  box-sizing: border-box;
}
.home-youtube-grid .home-youtube .border-video {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
}
.home-youtube-grid .home-youtube .img-youtube {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  flex-shrink: 0;
  background: #eee;
}
.home-youtube-grid .home-youtube .img-youtube a {
  display: block;
  height: 100%;
}
.home-youtube-grid .home-youtube .img-youtube img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-youtube-grid .home-youtube a.title_youtube {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 4.2em;
  max-height: none;
  line-height: 1.4;
  padding: 8px 10px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  word-break: break-word;
  color: #333;
  box-sizing: border-box;
}

.home-youtube-grid.custom_flex {
  display: grid;
  flex-wrap: unset;
  gap: 14px 16px;
}

/* Fallback ngoài lưới (carousel slide) */
.home-youtube .border-video {
  overflow: visible;
}
.home-youtube a.title_youtube {
  height: auto !important;
  min-height: 0;
  max-height: none;
  line-height: 1.4;
  padding: 8px 10px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  word-break: break-word;
}

@media (max-width: 900px) {
  .thumb_cat_left { width: 100% !important; float: none !important; }
  .custom_tin_right { width: 100% !important; float: none !important; }
  .home-youtube-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .d150_bu { width: 50% !important; }
  .d150_bu.div33 { width: 33.333% !important; }
}
@media (max-width: 600px) {
  .home-youtube-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .d150_bu { width: 50% !important; }
  .d150_bu.div33 { width: 50% !important; }
}

/* Trang tĩnh — output từ page builder (public) */
.page-builder-output .pb-heading { margin: 1em 0 0.5em; color: #4b3716; }
.page-builder-output .pb-paragraph { margin: 0 0 1em; }
.page-builder-output .pb-figure { margin: 1em 0; }
.page-builder-output .pb-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid #e2d7c0;
}
.page-builder-output .pb-caption { font-size: 14px; color: #666; margin-top: 6px; }
.page-builder-output .pb-btn-wrap { margin: 1em 0; }
.page-builder-output .pb-btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.page-builder-output .pb-btn-primary {
  background: #8d6a2e;
  color: #fff;
}
.page-builder-output .pb-btn-primary:hover { text-decoration: none; opacity: 0.92; }
.page-builder-output .pb-btn-outline {
  border: 2px solid #8d6a2e;
  color: #7a4e12;
  background: #fff;
}
.page-builder-output .pb-btn-outline:hover { text-decoration: none; background: #faf6ee; }

/* ===== Bố cục public: tránh nội dung đè lên chân trang (legacy fixmain height) ===== */
.half_page #home_in_id,
.half_page_shop #home_in_id {
  display: flex;
  flex-direction: column;
}
.half_page #home_in_id > .banner-head,
.half_page_shop #home_in_id > .banner-head {
  flex: 0 0 auto;
  flex-shrink: 0;
}
.half_page #fixmain_id,
.half_page_shop #fixmain_id {
  flex: 1 0 auto;
  height: auto !important;
  min-height: 0;
  max-height: none !important;
  overflow: visible;
  box-sizing: border-box;
  padding-bottom: 16px;
}
.half_page #footer.footerbg,
.half_page_shop #footer.footerbg {
  flex: 0 0 auto;
  clear: both;
  position: relative;
  z-index: 2;
  margin-top: 0;
}

/* Trang đăng nhập / hồ sơ / form */
.half_page .auth-section {
  padding-bottom: 24px;
}
.half_page .auth-section .container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}
.half_page .profile-page .profile-card {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}
.half_page .profile-page .form-row,
.half_page .auth-section .form-row {
  margin-bottom: 16px;
}
.half_page .profile-page .form-row label,
.half_page .auth-section .form-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}
.half_page .profile-page .form-row input,
.half_page .profile-page .form-row textarea,
.half_page .auth-section .form-row input,
.half_page .auth-section .form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.half_page .profile-page .btn,
.half_page .auth-section .btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.half_page .profile-page .btn-primary,
.half_page .auth-section .btn-primary { background: #4285f4; color: #fff; }
.half_page .profile-page .btn-success,
.half_page .auth-section .btn-success { background: #28a745; color: #fff; }
.half_page .profile-page .btn-danger,
.half_page .auth-section .btn-danger { background: #dc3545; color: #fff; }
.half_page .profile-page .btn-secondary,
.half_page .auth-section .btn-secondary { background: #6c757d; color: #fff; }
.half_page .profile-page .btn-sm,
.half_page .auth-section .btn-sm { padding: 6px 12px; font-size: 13px; }

/* Bài viết chi tiết */
.half_page .post-detail {
  padding: 20px 0 28px;
}
.half_page .post-detail .container.narrow {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
}
.half_page .post-detail h1 {
  color: #4b3716;
  margin: 0 0 10px;
  font-size: 1.75rem;
}
.half_page .post-detail .meta {
  color: #666;
  font-size: 14px;
  margin-bottom: 16px;
}
.half_page .post-detail .detail-thumb {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}
.half_page .post-detail .detail-content {
  line-height: 1.75;
  font-size: 16px;
  overflow: visible;
}
.half_page .post-detail .detail-content img {
  max-width: 100%;
  height: auto;
}

/* Trang section / trang chủ legacy container */
.half_page .container_page {
  padding-bottom: 12px;
}
.half_page .section-block {
  padding-bottom: 24px;
}
.half_page .site-page-body::after {
  content: '';
  display: block;
  clear: both;
}

/* Khóa học LMS (public) */
.course-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.course-card {
  display: block;
  background: #fff;
  border: 1px solid #e2d7c0;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.course-card:hover {
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.course-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.course-card-body { padding: 12px 14px; }
.course-card-title {
  font-size: 1.05rem;
  margin: 0 0 6px;
  color: #4b3716;
}
.course-card-excerpt { font-size: 14px; color: #555; margin: 0; line-height: 1.4; }
.btn-course-primary {
  display: inline-block;
  padding: 10px 18px;
  background: #8d6a2e;
  color: #fff !important;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  font-size: 15px;
}
.btn-course-primary:hover { opacity: 0.92; text-decoration: none; }

/* Banner mobile — override style_global.css ẩn .banner-head (đặt cuối file) */
@media (max-width: 700px) {
  #home_in_id.home-has-banner > .banner-head,
  #home_in_id > .banner-head {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    height: auto !important;
    min-height: 72px;
    max-height: none !important;
  }
  #home_in_id .banner-head-img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 200px;
    min-height: 72px;
  }
}
