/* ==== FIX PACK for category_family_grid / tabitem ==== */

/* make sure theme floats/margins can't break layout */
.tabitem,
.tabitem * { box-sizing: border-box; }

/* 2-column shell: left panel + right grid */
.tabitem{
  display: grid !important;
  grid-template-columns: 320px 1fr !important; /* left panel width */
  gap: 24px !important;
  max-width: 100%;
  margin: 0 auto 28px;
  padding: 24px;
  background: #f4fafb;
  border: 1px solid #e8e8ee;
  border-radius: 14px;
}

/* LEFT PANEL (subcategory) */
.tabitem > .left-box{
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid #e8e8ee;
  background: #eef0ff;
  text-decoration: none;
  color: #111827;
  box-shadow: 0 2px 12px rgba(17,24,39,.06);
}

.tabitem > .left-box img{
  width: 100% !important;
  height: 230px !important;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e8ee;
  display: block;
}

/* RIGHT GRID (grandchildren) */
.tabitem > .right-box {
    display: grid !important;
    grid-template-columns: repeat(5,minmax(0,1fr)) !important;
    gap: 15px 16px !important;
    align-content: start;
}

/* each card */
.tabitem .right-box > a {
    display: grid !important;
    grid-template-rows: auto 1fr;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
    text-decoration: none;
    color: #111827 !important;
    box-shadow: 0 2px 12px rgba(17,24,39,.06);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tabitem .right-box > a:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(17,24,39,.12);
  border-color: #dcdfea !important;
}
.tabitem .right-box > a p {
    margin: 0;
    font-size: 12px;
    line-height: 18px;
    font-weight: 500;
    min-height: 38px;
}
.tabitem .right-box > a img{
  width: 100% !important;
  height: 130px !important;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e8e8ee9e;
  display: block;
}

/* no-children message spans full row */
.tabitem .no-children{ grid-column: 1 / -1; color:#6b7280; }

/* Group 1 layout */
.tabitem.has-grandchildren { display:grid; grid-template-columns: 1fr 3fr; gap:20px; margin:0 0 24px 0; }
.tabitem .left-box {
    display: block;
    padding: 20px;
    background: #f5f6fa;
    background-repeat: no-repeat;
    border-radius: 8px;
    text-decoration: none;
    background-position: center;
    background-size: cover;
}
.tabitem .left-box .itemname {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    background-color: #ffffff6e;
    padding: 15px;
    line-height: 30px;
    border-radius: 10px;
}
.tabitem .left-box img { width:100%; height:auto; display:block; border-radius:6px; display: none;}
.tabitem .right-box { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:24px; }
.tabitem .right-box a { display:block; text-decoration:none; }
.tabitem .right-box p { margin:0 0 10px; font-weight:600; }
.tabitem .right-box img { width:100%; height:auto; display:block; }

/* Group 2 tiles (children without grandchildren) */
.child-tiles { display:grid; gap:24px; margin:40px 0 10px; }
.child-tiles.tiles-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.child-tiles.tiles-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.child-tiles.tiles-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.child-tiles .tile {
    display: block;
    background: #f5f6fa;
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    height: 400px;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}
.child-tiles .tile-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    background-color: #ffffff6e;
    padding: 15px;
    line-height: 30px;
    border-radius: 10px;
    color: #111827;
}
.child-tiles .tile img { width:100%; height:auto; display:block; border-radius:6px;     display: none;}

/* ===== responsive ===== */
@media (max-width: 1200px){
  .tabitem > .right-box{ grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
}
@media (max-width: 992px){
  .tabitem{ grid-template-columns: 300px 1fr !important; }
  .tabitem > .right-box{ grid-template-columns: repeat(3,minmax(0,1fr)) !important; }

  .child-tiles .tile {
    height: 300px;
}
}
@media (max-width: 768px){
  .child-tiles.tiles-cols-3 {
    grid-template-columns: repeat(2, minmax(0,1fr));
}
  .tabitem .left-box {
    height: 180px;

}
  .tabitem{
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 16px;
  }
  .tabitem > .left-box .itemname{ font-size: 22px; }
  .tabitem > .left-box img{ height: 200px !important; }
  .tabitem > .right-box{ grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width: 480px){
  .tabitem .left-box .itemname {
    font-size: 14px; 
    padding: 10px;
    line-height: 20px;

}
  .child-tiles .tile-title {
    font-size: 14px;
    padding: 10px;
    line-height: 18px;

}
  .child-tiles .tile {
    height: 180px;
    padding: 10px;
}
  /*.tabitem > .right-box{ grid-template-columns: 1fr !important; } */
  .tabitem > .left-box img{ height: 180px !important; }
}