/* Master TSB Theme Assets - Header Styles & Zero-Gap Product Grid */

/* Image & Media Fluid Resets */
img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Modal & Off-Canvas Initial Hidden State Fallbacks */
#master-tsb-nav-drawer,
#master-tsb-cart-drawer,
#master-tsb-quick-modal {
  opacity: 0;
  pointer-events: none;
}

#master-tsb-bottom-cart-bar {
  display: none;
}

.tsb-site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}

.tsb-header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tsb-header-left, .tsb-header-right {
  display: flex;
  align-items: center;
  flex: 1;
}

.tsb-header-right {
  justify-content: flex-end;
  gap: 0.25rem;
}

.tsb-header-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tsb-brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tsb-brand-title {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tsb-icon-btn {
  position: relative;
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tsb-icon-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.tsb-home-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
  position: relative;
  z-index: 100;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tsb-cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: #4f46e5;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

/* Zero Edge Padding Product Grid & Compact Layout Rules */
.tsb-grid-container {
  padding-left: 2px !important;
  padding-right: 2px !important;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.tsb-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.375rem !important; /* 6px gap between cards */
}

@media (min-width: 640px) {
  .tsb-compact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem !important;
  }
}

@media (min-width: 1024px) {
  .tsb-compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem !important;
  }
}

/* Product Card 1:1 Aspect Ratio & Compact Styles */
.tsb-product-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  height: 100%;
}

.tsb-product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tsb-product-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #f8fafc;
  overflow: hidden;
}

.tsb-product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Single line title truncation */
.tsb-single-line-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8125rem; /* 13px */
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

/* Slim Action Buttons */
.tsb-btn-slim {
  padding: 0.25rem 0.5rem !important; /* 4px 8px */
  font-size: 0.75rem !important; /* 12px */
  font-weight: 700;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  height: 2rem; /* 32px slim height */
}

/* Category Offcanvas Drawer & Overlay Styles */
.tsb-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
  justify-content: flex-start;
}

.tsb-drawer-overlay.tsb-active {
  opacity: 1;
  pointer-events: auto;
}

.tsb-drawer-content {
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background-color: #ffffff;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tsb-drawer-overlay.tsb-active .tsb-drawer-content {
  transform: translateX(0);
}

.tsb-drawer-header {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f8fafc;
}

.tsb-drawer-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.tsb-drawer-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.tsb-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.tsb-category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tsb-category-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: #1e293b;
  background-color: #f8fafc;
  border: 1px solid #f1f5f9;
  transition: all 0.2s ease;
}

.tsb-category-item:hover {
  background-color: #e2e8f0;
  color: #2563eb;
}

.tsb-cat-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.tsb-cat-title {
  font-size: 0.875rem;
  font-weight: 700;
  flex: 1;
}

.tsb-cat-count {
  font-size: 0.75rem;
  color: #64748b;
}

.tsb-drawer-footer {
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tsb-drawer-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #16a34a;
  color: #ffffff;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.tsb-drawer-phone-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}
