/* ==========================================================================
   FBTB CATALOG DESIGN SYSTEM & PREMIUM UI STYLESHEET
   ========================================================================== */

/* 1. Design System Tokens (Light & Dark Theme) */
:root {
  /* Functional Colors (Light Mode) */
  --color-background: #fbfbfb;
  --color-surface: #ffffff;
  --color-surface-card: #ffffff;
  --color-surface-hover: #f7f7f9;
  --color-border: #e2e2e6;
  --color-border-hover: #c4c4cb;
  --color-text-primary: #0a0a0c;
  --color-text-secondary: #60606a;
  --color-text-muted: #9696a2;
  --color-accent: #000000;
  --color-accent-hover: #1e1e21;
  --color-accent-foreground: #ffffff;
  
  /* Status Colors */
  --color-error: #e5484d;
  --color-error-bg: #fff0f0;
  --color-success: #30a46c;
  --color-skeleton: #ececee;
  --color-skeleton-shine: rgba(255, 255, 255, 0.6);

  /* Typography Scale */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-md: 1.125rem;    /* 18px */
  --font-size-lg: 1.25rem;     /* 20px */
  --font-size-xl: 1.5rem;      /* 24px */
  --font-size-xxl: 2rem;       /* 32px */
  --font-size-hero: 2.5rem;    /* 40px */
  
  /* Spacing Scale */
  --space-unit: 8px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-section: 64px;

  /* Elevation & Radius */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.04), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 16px 36px -4px rgba(0, 0, 0, 0.06), 0 6px 16px -2px rgba(0, 0, 0, 0.03);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Container Widths */
  --max-width: 1400px;
}

/* Dark Mode Color Overrides */
.dark-mode {
  --color-background: #09090b;
  --color-surface: #121215;
  --color-surface-card: #18181b;
  --color-surface-hover: #222227;
  --color-border: #242427;
  --color-border-hover: #36363f;
  --color-text-primary: #f4f4f5;
  --color-text-secondary: #a1a1aa;
  --color-text-muted: #5e5e67;
  --color-accent: #ffffff;
  --color-accent-hover: #e4e4e7;
  --color-accent-foreground: #09090b;
  --color-skeleton: #212124;
  --color-skeleton-shine: rgba(255, 255, 255, 0.03);
  --color-error-bg: #1f1315;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 40px -4px rgba(0, 0, 0, 0.5), 0 8px 16px -2px rgba(0, 0, 0, 0.3);
}

/* 2. Global Base Resets & Defaults */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* 3. Layout: Application Shell Header */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(251, 251, 251, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.dark-mode .app-header {
  background-color: rgba(9, 9, 11, 0.8);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Header Brand Logo */
.logo {
  font-size: var(--font-size-xl);
  font-weight: 700;
  letter-spacing: -0.05em;
  display: flex;
  align-items: center;
  color: var(--color-text-primary);
  user-select: none;
}

.logo-dot {
  color: var(--color-text-muted);
  margin-left: 1px;
}

/* Dynamic Header Search Bar */
.header-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 var(--space-lg);
  display: flex;
  align-items: center;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-md);
  height: 40px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-normal);
}

.header-search-wrapper:focus-within {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 1px var(--color-text-primary);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  margin-right: var(--space-sm);
  flex-shrink: 0;
}

.header-search-wrapper input {
  width: 100%;
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-primary);
}

.header-search-wrapper input::placeholder {
  color: var(--color-text-muted);
}

.search-clear-btn {
  background: none;
  cursor: pointer;
  padding: 2px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.search-clear-btn:hover {
  color: var(--color-text-primary);
  background-color: var(--color-surface-hover);
}

.search-clear-btn svg {
  width: 14px;
  height: 14px;
}

/* Header Actions Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.theme-toggle-btn,
.mobile-filter-trigger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.theme-toggle-btn:hover,
.mobile-filter-trigger-btn:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-hover);
}

.theme-toggle-btn svg,
.mobile-filter-trigger-btn svg {
  width: 18px;
  height: 18px;
}

.mobile-filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--color-text-primary);
  color: var(--color-background);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--color-background);
}

/* 4. Layout: App Viewport */
.app-content-viewport {
  flex-grow: 1;
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xxl);
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   CATALOG VIEW STYLING
   ========================================================================== */

.catalog-view-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-xxl);
  align-items: start;
  width: 100%;
}

/* Catalog Left Sidebar Filters */
.catalog-sidebar-filters {
  position: sticky;
  top: 96px; /* Header Height (72px) + Gap (24px) */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: var(--space-sm);
}

/* Custom Scrollbar for Filters Sidebar */
.catalog-sidebar-filters::-webkit-scrollbar {
  width: 4px;
}

.catalog-sidebar-filters::-webkit-scrollbar-track {
  background: transparent;
}

.catalog-sidebar-filters::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.catalog-sidebar-filters::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.filter-sticky-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.filter-header-desktop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
}

.filter-header-desktop h3 {
  font-size: var(--font-size-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.clear-all-btn {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.clear-all-btn:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.filter-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.filter-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

/* Sidebar Custom Input Field */
.sidebar-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
  height: 38px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-input-wrapper:focus-within {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 1px var(--color-text-primary);
}

.sidebar-input-wrapper input {
  width: 100%;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

.sidebar-input-wrapper input::placeholder {
  color: var(--color-text-muted);
}

/* Category Filter List style */
.category-options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.category-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast), font-weight var(--transition-fast);
}

.category-option-btn:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.category-option-btn.active {
  background-color: var(--color-surface-hover);
  color: var(--color-text-primary);
  font-weight: 600;
}

.category-option-btn::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--color-text-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.category-option-btn.active::after {
  opacity: 1;
}

/* Tags Filter Grid */
.tags-options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tag-checkbox-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.tag-checkbox-btn:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.tag-checkbox-btn.active {
  background-color: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: var(--color-background);
}

/* Catalog Main Panel Layout */
.catalog-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0; /* Prevents flex children from stretching outside boundary */
}

/* Active Filters summary panel */
.active-filters-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  animation: fadeIn var(--transition-normal);
}

.summary-text {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.active-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  padding: 4px 8px 4px 10px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.active-filter-chip button {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: 50%;
  padding: 1px;
}

.active-filter-chip button:hover {
  color: var(--color-text-primary);
  background-color: var(--color-border);
}

.active-filter-chip svg {
  width: 12px;
  height: 12px;
}

.clear-filters-chip-btn {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-primary);
  cursor: pointer;
  padding: 4px var(--space-sm);
  border-radius: var(--radius-md);
}

.clear-filters-chip-btn:hover {
  text-decoration: underline;
}

/* Status Bar & Sorting Dropdowns */
.catalog-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-sm);
}

.results-count {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.catalog-sort-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sort-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.sort-select {
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 6px var(--space-xl) 6px var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2371717a' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' class='feather feather-chevron-down' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.sort-select:focus {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 1px var(--color-text-primary);
}

/* Responsive Product Grid setup */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  animation: fadeIn var(--transition-normal);
}

/* ==========================================================================
   PRODUCT CARD UI STYLES
   ========================================================================== */

.product-card {
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-hover);
}

.product-card-link-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Card Visual Media Box */
.product-card-image-box {
  width: 100%;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  background-color: var(--color-surface-hover);
  position: relative;
  border-bottom: 1px solid var(--color-border);
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-card-img {
  transform: scale(1.04);
}

.product-card-category-badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  background-color: rgba(255, 255, 255, 0.9);
  color: #000000;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 4px var(--space-sm);
  border-radius: var(--radius-sm);
  z-index: 3;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow-sm);
}

.dark-mode .product-card-category-badge {
  background-color: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Text Info Body */
.product-card-content {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.product-card-cat-number {
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

.product-card-price {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text-primary);
}

.product-card-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.product-card-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.8em; /* Match line height for exactly 2 lines to stabilize layout */
}

/* Card Tags Dock */
.product-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  margin-top: auto; /* Push tags & button to the bottom of the card */
  height: 24px; /* Restrict tags line to single row overflow hidden */
  overflow: hidden;
}

.product-card-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  background-color: var(--color-surface-hover);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* Card Button Footer */
.product-card-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  position: relative;
  z-index: 3; /* Render above link overlay so button is directly clickable */
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.product-card-action:hover {
  background-color: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: var(--color-background);
}

.product-card-action svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.product-card-action:hover svg {
  transform: translateX(2px);
}


/* ==========================================================================
   PRODUCT DETAIL VIEW STYLING
   ========================================================================== */

.detail-view-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  animation: fadeIn var(--transition-normal);
}

.detail-navigation-bar {
  display: flex;
  align-items: center;
}

.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.back-link-btn:hover {
  color: var(--color-text-primary);
  background-color: var(--color-surface-hover);
}

.back-link-btn svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.back-link-btn:hover svg {
  transform: translateX(-2px);
}

/* Detail Split Grid */
.detail-content-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-xxl);
  align-items: start;
}

/* Gallery Module: Left Stack Thumbnail Bar & Right Display Panel */
.detail-gallery {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: var(--space-md);
}

.gallery-thumbnails-dock {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gallery-thumb-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  cursor: pointer;
  padding: 0;
  transition: border-color var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.gallery-thumb-btn:hover {
  border-color: var(--color-border-hover);
  transform: scale(1.02);
}

.gallery-thumb-btn.active {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 1px var(--color-text-primary);
}

.gallery-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-viewport {
  aspect-ratio: 5 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface-hover);
  position: relative;
}

.gallery-display-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.gallery-display-img.loaded {
  opacity: 1;
}

/* Detail Right Pane: Typography Specs */
.detail-info-pane {
  display: flex;
  flex-direction: column;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-md);
}

.detail-category-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.detail-catalog-no {
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: monospace;
  color: var(--color-text-secondary);
  background-color: var(--color-surface-hover);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.detail-product-name {
  font-size: var(--font-size-hero);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
  line-height: 1.15;
  margin: var(--space-md) 0 var(--space-sm) 0;
}

.detail-price-tag {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xl);
}

/* Detail Specs Description */
.detail-spec-section {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.detail-section-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.detail-description-text {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Detail Tags Array */
.detail-tags-section {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl);
  margin-bottom: var(--space-xxl);
}

.detail-tags-dock {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.detail-tag-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-xl);
}

/* B2B Product Detail CTA Actions */
.detail-actions-panel {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl);
  margin-top: auto; /* Align actions at the bottom of the card content */
}

/* Universal Button Designs */
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: 48px;
  padding: 0 var(--space-xl);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.action-button.primary {
  background-color: var(--color-accent);
  color: var(--color-accent-foreground);
}

.action-button.primary:hover {
  background-color: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.action-button.secondary {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

.action-button.secondary:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-hover);
  transform: translateY(-1px);
}

.action-button svg {
  width: 16px;
  height: 16px;
}


/* ==========================================================================
   UX & STATE WRAPPERS (Skeletons, empty, error)
   ========================================================================== */

/* 1. Shimmering Skeleton Elements */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(90deg, var(--color-skeleton) 25%, var(--color-surface-hover) 50%, var(--color-skeleton) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

/* Card Skeleton loader template styles */
.product-card-skeleton {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface-card);
  overflow: hidden;
  height: 380px;
  display: flex;
  flex-direction: column;
}

.card-skeleton-img {
  aspect-ratio: 5 / 4;
}

.card-skeleton-content {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex-grow: 1;
}

.card-skeleton-line {
  height: var(--space-md);
  border-radius: var(--radius-sm);
}

/* Filter Skeleton mockups */
.sidebar-category-skeleton {
  height: 32px;
  border-radius: var(--radius-md);
  background-color: var(--color-skeleton);
  margin-bottom: var(--space-xs);
}

.sidebar-tag-skeleton {
  display: inline-block;
  height: 26px;
  border-radius: var(--radius-xl);
  background-color: var(--color-skeleton);
  margin-bottom: var(--space-xs);
  width: 80px;
}

/* View transition fades */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 2. Empty Catalog / API Error Screens */
.empty-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-section) var(--space-lg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  max-width: 580px;
  margin: var(--space-xl) auto;
  animation: fadeIn var(--transition-normal);
}

.empty-state-visual, .error-state-visual {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--color-surface-hover);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.error-state-visual {
  background-color: var(--color-error-bg);
  color: var(--color-error);
}

.empty-state-visual svg, .error-state-visual svg {
  width: 28px;
  height: 28px;
}

.empty-state h3, .error-state h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.empty-state p, .error-state p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-xl);
  max-width: 420px;
}

.error-message-text {
  font-family: monospace;
  background-color: var(--color-surface-hover);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}


/* ==========================================================================
   MOBILE INTERACTIVE ELEMENTS (Drawer Modal overlay)
   ========================================================================== */

.mobile-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  animation: fadeInOverlay var(--transition-normal);
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mobile-drawer-content {
  width: 100%;
  max-width: 380px;
  height: 100%;
  background-color: var(--color-background);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInDrawer var(--transition-normal);
}

@keyframes slideInDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.mobile-drawer-header {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.mobile-drawer-header h3 {
  font-size: var(--font-size-md);
  font-weight: 600;
}

.close-drawer-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.close-drawer-btn:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.close-drawer-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-drawer-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

.mobile-drawer-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-md);
  background-color: var(--color-surface);
}

.mobile-drawer-footer .action-button {
  flex-grow: 1;
}


/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS (Media Queries)
   ========================================================================== */

/* 1. Large Screen Adjustments (Scale grid widths) */
@media (min-width: 1440px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 2. Desktop to Tablet (Below 1100px) */
@media (max-width: 1100px) {
  .catalog-view-container {
    grid-template-columns: 240px 1fr;
    gap: var(--space-lg);
  }
  
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .detail-content-grid {
    gap: var(--space-xl);
  }
}

/* 3. Tablet Portrait (Below 900px) */
@media (max-width: 900px) {
  .catalog-view-container {
    grid-template-columns: 1fr; /* Hides left sidebar, shifts layout */
  }
  
  .catalog-sidebar-filters {
    display: none; /* Relies strictly on mobile drawer filters */
  }
  
  .product-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns grid */
  }
  
  .detail-content-grid {
    grid-template-columns: 1fr; /* Stack detail layout vertically */
    gap: var(--space-xxl);
  }
  
  .detail-gallery {
    grid-template-columns: 1fr; /* Stack thumbnail list vertically beneath image viewport */
    display: flex;
    flex-direction: column-reverse; /* Put thumbnails below viewport */
  }
  
  .gallery-thumbnails-dock {
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: var(--space-xs);
  }
  
  .gallery-thumb-btn {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }
}

/* 4. Mobile Screen Adaptations (Below 600px) */
@media (max-width: 600px) {
  :root {
    --space-lg: 16px;
    --space-xl: 24px;
    --space-xxl: 32px;
  }
  
  .header-container {
    height: 64px;
  }
  
  .header-search-wrapper {
    margin: 0 var(--space-sm);
  }
  
  .product-grid {
    grid-template-columns: 1fr; /* 1 column grid */
    gap: var(--space-md);
  }
  
  .product-card-image-box {
    aspect-ratio: 4 / 3;
  }
  
  .detail-product-name {
    font-size: var(--font-size-xl);
  }
  
  .detail-actions-panel {
    flex-direction: column;
    align-items: stretch;
  }
  
  .detail-actions-panel .action-button {
    width: 100%;
  }
}


/* ==========================================================================
   DEDICATED PREMIUM A4 PRINT STYLES
   ========================================================================== */

@media print {
  /* Hide all generic navigation, UI items and theme toggles */
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }
  
  /* Disable screen application shell layouts completely */
  .app-shell, 
  .app-header,
  .detail-navigation-bar,
  .detail-actions-panel,
  .mobile-drawer-overlay {
    display: none !important;
  }
  
  /* Make only the explicit spec template container render */
  .print-only {
    display: block !important;
  }
  
  /* Format spec sheet to span single page perfectly */
  @page {
    size: A4 portrait;
    margin: 15mm;
  }

  .print-spec-sheet {
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, sans-serif;
    color: #000000;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 15px;
    margin-bottom: 25px;
  }

  .print-brand {
    font-size: 20pt;
    font-weight: 700;
    letter-spacing: -0.04em;
  }

  .print-brand-dot {
    color: #888888;
  }

  .print-doc-title {
    font-size: 10pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555555;
  }

  .print-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 25px;
  }

  .print-gallery-box {
    border: 1px solid #e2e2e6;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 5 / 4;
  }

  .print-gallery-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .print-info-box {
    display: flex;
    flex-direction: column;
  }

  .print-category {
    font-size: 8pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666666;
    margin-bottom: 5px;
  }

  .print-title {
    font-size: 18pt;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 10px;
  }

  .print-cat-num {
    font-family: monospace;
    font-size: 9pt;
    font-weight: 600;
    color: #444444;
    background-color: #f5f5f7;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #e2e2e6;
    align-self: flex-start;
    margin-bottom: 15px;
  }

  .print-price {
    font-size: 14pt;
    font-weight: 700;
    margin-bottom: 20px;
  }

  .print-divider {
    border-top: 1px solid #e2e2e6;
    margin-bottom: 15px;
  }

  .print-section-lbl {
    font-size: 8pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666666;
    margin-bottom: 8px;
  }

  .print-desc {
    font-size: 10pt;
    color: #222222;
    line-height: 1.5;
    margin-bottom: 20px;
  }

  .print-tags-dock {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .print-tag-chip {
    font-size: 8pt;
    border: 1px solid #d2d2d6;
    padding: 3px 8px;
    border-radius: 20px;
    color: #333333;
    font-weight: 500;
  }

  .print-footer {
    border-top: 1px solid #000000;
    padding-top: 15px;
    margin-top: auto; /* Pushes footer to absolute bottom of A4 page */
    display: flex;
    justify-content: space-between;
    font-size: 8pt;
    color: #666666;
  }

  .print-footer-brand {
    font-weight: 600;
  }
}

/* Hide print-only class on monitor screens */
@media screen {
  .print-only {
    display: none !important;
  }
}
