/* ==========================================================================
   INCREMENTAL Knowledge Engine — Main Stylesheet
   Brand: #2D3A36 primary, #E73A1E red, #46B170 green, #00A5BA teal
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --primary: #2D3A36;
  --red: #E73A1E;
  --green: #46B170;
  --teal: #00A5BA;
  --dark-green: #3D6E4F;
  --gray: #848484;
  --gray-dark: #383838;
  --light: #f5f5f4;
  --white: #fff;
  --border: #e0e0e0;
  --border-light: #f0f0f0;

  /* Spacing (4px scale) */
  --sp-1: 0.25rem;   /* 4px */
  --sp-2: 0.5rem;    /* 8px */
  --sp-3: 0.75rem;   /* 12px */
  --sp-4: 1rem;      /* 16px */
  --sp-5: 1.25rem;   /* 20px */
  --sp-6: 1.5rem;    /* 24px */
  --sp-8: 2rem;      /* 32px */

  /* Border radius */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-pill: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Layout */
  --max-width: 1200px;
  --sidebar-width: 240px;
  --header-height: auto;
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #333;
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

small, .text-sm {
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   4. HEADER (sticky)
   -------------------------------------------------------------------------- */
.header {
  background: var(--primary);
  color: var(--white);
  padding: var(--sp-4) var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  height: 36px;
}

.header-tagline {
  opacity: 0.65;
  margin-top: var(--sp-1);
  font-weight: 300;
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   5. NAVIGATION (sticky below header)
   -------------------------------------------------------------------------- */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0; /* will stack below header via JS offset or combined sticky */
  z-index: 99;
}

.nav a {
  font-weight: 600;
  color: var(--primary);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius);
  font-size: 0.83rem;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.nav a:hover,
.nav a.active {
  background: #e8f0ec;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   6. SEARCH BAR
   -------------------------------------------------------------------------- */
.search-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-6);
  display: flex;
  justify-content: center;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  opacity: 0.4;
}

.search-box input {
  width: 100%;
  padding: 0.45rem 0.8rem 0.45rem 2rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--teal);
}

/* Search dropdown */
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  z-index: 100;
}

.search-dropdown.open {
  display: block;
}

.search-dropdown .search-category-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  padding: 0.4rem 0.7rem 0.15rem;
  background: var(--light);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.kb-active {
  background: var(--light);
}

.search-result-item img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   7. BREADCRUMBS
   -------------------------------------------------------------------------- */
.breadcrumb-bar {
  padding: var(--sp-2) var(--sp-6);
  font-size: 0.82rem;
  color: var(--gray);
}

.breadcrumb-bar:empty {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--teal);
  font-size: 0.82rem;
}

.breadcrumb .sep::after {
  content: "\203A";
  margin: 0 0.15rem;
  color: var(--gray);
}

/* --------------------------------------------------------------------------
   8. MAIN CONTENT & VIEWS
   -------------------------------------------------------------------------- */
main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-6);
}

.view {
  display: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.view.active {
  display: block;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   9. CATALOG LAYOUT (sidebar + grid)
   -------------------------------------------------------------------------- */
.catalog-layout {
  display: flex;
  gap: var(--sp-6);
}

.filters-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  align-self: flex-start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.catalog-main {
  flex: 1;
  min-width: 0;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.catalog-count {
  color: var(--gray);
  font-size: 0.83rem;
}

/* Active filters bar */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
  align-items: center;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.active-filter-tag:hover {
  background: var(--dark-green);
}

.active-filter-tag .remove::after {
  content: "\00d7";
  margin-left: 0.2rem;
}

.btn-clear-filters {
  font-size: 0.72rem;
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 600;
  padding: 0.15rem 0.3rem;
}

/* Mobile filters button + modal */
.filters-toggle {
  display: none;
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
  margin-bottom: var(--sp-3);
  text-align: center;
}

.filters-modal {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: 30%;
  background: var(--white);
  z-index: 200;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  padding: var(--sp-6);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.filters-modal.open {
  display: block;
  transform: translateY(0);
}

.filters-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

.filters-modal-backdrop.open {
  display: block;
}

.filters-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
}

.filters-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-dark);
}

/* --------------------------------------------------------------------------
   10. GRID SYSTEM
   -------------------------------------------------------------------------- */
.grid-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: var(--sp-4);
}

/* --------------------------------------------------------------------------
   11. PRODUCT CARD
   -------------------------------------------------------------------------- */
.product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-normal);
  background: var(--white);
}

.product-card:hover {
  box-shadow: var(--shadow-md);
}

.product-card-img {
  aspect-ratio: 3 / 2;
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-card-img img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.product-card-img .placeholder {
  font-size: 2.5rem;
  opacity: 0.2;
}

.product-card-body {
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.product-card-body h3 {
  font-size: 0.92rem;
  color: var(--primary);
  cursor: pointer;
  line-height: 1.3;
}

.product-card-body h3:hover {
  text-decoration: underline;
}

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

.product-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
  padding-top: 0.4rem;
}

/* --------------------------------------------------------------------------
   12. BADGES
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  font-size: 0.63rem;
  font-weight: 600;
  padding: 0.13rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.badge-brand {
  background: #e0f0ff;
  color: #1565c0;
}

.badge-category,
.badge-cat {
  background: #e8f0ec;
  color: var(--primary);
}

.badge-norm {
  background: #e8f5e9;
  color: var(--dark-green);
}

.badge-spec {
  background: #eee;
  color: #555;
}

/* Spec badges (small inline) */
.spec-badge {
  display: inline-block;
  font-size: 0.66rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: #eee;
  color: #555;
  margin: 0.08rem 0.12rem 0 0;
}

/* Color dots */
.color-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid #ddd;
  margin-right: 2px;
}

/* --------------------------------------------------------------------------
   13. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition-fast);
  font-family: inherit;
}

.btn:hover {
  background: var(--dark-green);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-buy,
.btn-red {
  background: var(--red);
}

.btn-buy:hover,
.btn-red:hover {
  background: #c62828;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-sm {
  font-size: 0.7rem;
  padding: 0.22rem 0.45rem;
}

/* --------------------------------------------------------------------------
   14. CHIPS / FILTER CHIPS
   -------------------------------------------------------------------------- */
.filter-group {
  margin-bottom: 0.7rem;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.chip {
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid #ccc;
  background: var(--white);
  color: #333;
  cursor: pointer;
  font-size: 0.73rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.active,
.chip.a {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   15. TABLES
   -------------------------------------------------------------------------- */

/* Specs table */
.specs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.7rem 0;
}

.specs-table th,
.specs-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #e8e8e8;
  font-size: 0.85rem;
}

.specs-table th {
  background: var(--light);
  color: var(--primary);
  width: 40%;
  font-weight: 600;
}

/* Compare table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.compare-table th {
  background: var(--primary);
  color: var(--white);
  padding: 0.45rem;
  font-size: 0.73rem;
  position: sticky;
  top: 0;
}

.compare-table td {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  text-align: center;
}

.compare-table td.row-label {
  background: var(--light);
  font-weight: 600;
  text-align: left;
  color: var(--primary);
  position: sticky;
  left: 0;
  z-index: 1;
}

.compare-table td.diff {
  background: #e8f5e9;
}

/* Comparator checkboxes */
.compare-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.compare-select label {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.compare-select label.checked {
  background: #e8f0ec;
  border-color: var(--teal);
}

/* --------------------------------------------------------------------------
   16. FICHA (Product detail)
   -------------------------------------------------------------------------- */
.ficha-hero {
  display: flex;
  gap: var(--sp-8);
  margin-bottom: var(--sp-6);
}

.ficha-image {
  flex: 0 0 320px;
  text-align: center;
}

.ficha-image img {
  max-width: 320px;
  max-height: 280px;
  object-fit: contain;
}

.ficha-info {
  flex: 1;
  min-width: 0;
}

.ficha-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.4rem 0;
}

.ficha-back {
  display: inline-block;
  margin-bottom: 0.8rem;
  font-size: 0.88rem;
  color: var(--teal);
  cursor: pointer;
}

.ficha-section {
  margin: 1rem 0 0.5rem;
}

.ficha-section h3 {
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.ficha-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.ficha-size {
  padding: 0.2rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
}

.ficha-related {
  margin-top: var(--sp-8);
}

.ficha-norm-block {
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--green);
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   17. CONFIGURATOR (Wizard)
   -------------------------------------------------------------------------- */
.wizard-step {
  margin-bottom: 0.8rem;
}

.wizard-step-label {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.wizard-options {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.wizard-option {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid #ccc;
  background: var(--white);
  color: #333;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.wizard-option:hover {
  border-color: var(--primary);
}

.wizard-option.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Recommendation cards */
.rec-card {
  display: flex;
  gap: 0.7rem;
  padding: 0.7rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
}

.rec-card.best {
  border-left: 4px solid var(--green);
}

.rec-card.alt {
  border-left: 4px solid var(--border);
}

.rec-card-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

.rec-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.rec-card-label.best {
  color: var(--green);
}

.rec-card-label.alt {
  color: var(--gray);
}

/* Kit item cards */
.kit-card {
  display: flex;
  gap: 0.7rem;
  padding: 0.7rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
}

.kit-card.required {
  border-left: 4px solid var(--primary);
}

.kit-card.optional {
  border-left: 4px solid #ccc;
}

.kit-icon {
  font-size: 1.6rem;
  width: 30px;
  text-align: center;
}

.kit-summary {
  padding: 0.7rem;
  background: var(--light);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  margin-bottom: 0.7rem;
}

.kit-budget {
  padding: 0.6rem;
  background: var(--light);
  border-radius: var(--radius);
  margin-top: 0.5rem;
  text-align: right;
}

/* --------------------------------------------------------------------------
   18. NORMATIVAS VIEW
   -------------------------------------------------------------------------- */
.norm-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  margin-bottom: 0.8rem;
}

.norm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.norm-description {
  font-size: 0.88rem;
  margin: 0.5rem 0;
  line-height: 1.5;
}

.norm-meta {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

.norm-sublabel {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.norm-products {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

/* --------------------------------------------------------------------------
   19. COMPARE BAR (floating bottom)
   -------------------------------------------------------------------------- */
.compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  padding: var(--sp-2) var(--sp-4);
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  z-index: 90;
}

.compare-bar.visible {
  display: flex;
}

.compare-bar-items {
  display: flex;
  gap: var(--sp-2);
}

.compare-bar-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   20. SKELETON LOADING
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 280px;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 1em;
  width: 60%;
  margin-bottom: 0.4rem;
}

/* --------------------------------------------------------------------------
   21. FOOTER
   -------------------------------------------------------------------------- */
.footer {
  background: var(--primary);
  color: var(--white);
  text-align: center;
  padding: 0.8rem;
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   22. UTILITY
   -------------------------------------------------------------------------- */
.overflow-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.text-gray {
  color: var(--gray);
}

.text-primary {
  color: var(--primary);
}

.mt-1 { margin-top: var(--sp-4); }
.mb-1 { margin-bottom: var(--sp-4); }

/* --------------------------------------------------------------------------
   23. RESPONSIVE — Mobile (<640px)
   -------------------------------------------------------------------------- */
@media (max-width: 639px) {
  .header {
    padding: 0.6rem 0.8rem;
  }

  main {
    padding: 0.7rem;
  }

  .grid-products {
    grid-template-columns: 1fr;
  }

  .nav {
    gap: 0.3rem;
  }

  .nav a {
    font-size: 0.72rem;
    padding: 0.2rem 0.3rem;
  }

  /* Hide sidebar, show toggle */
  .filters-sidebar {
    display: none;
  }

  .filters-toggle {
    display: block;
  }

  .catalog-layout {
    flex-direction: column;
  }

  /* Ficha stacked */
  .ficha-hero {
    flex-direction: column;
  }

  .ficha-image {
    flex: none;
  }

  .ficha-image img {
    max-width: 100%;
  }

  .search-bar {
    padding: var(--sp-2);
  }

  .breadcrumb-bar {
    padding: var(--sp-2);
  }
}

/* --------------------------------------------------------------------------
   24. RESPONSIVE — Tablet (640-1024px)
   -------------------------------------------------------------------------- */
@media (min-width: 640px) and (max-width: 1024px) {
  .grid-products {
    grid-template-columns: repeat(2, 1fr);
  }

  .filters-sidebar {
    width: 200px;
  }

  .ficha-image {
    flex: 0 0 240px;
  }
}

/* --------------------------------------------------------------------------
   25. RESPONSIVE — Desktop (>1024px)
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) {
  .grid-products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .grid-products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   FICHA — Professional product detail (Phase 2)
   ========================================================================== */

.ficha-back { display: inline-block; margin-bottom: var(--space-4); font-size: .875rem; color: var(--teal); cursor: pointer; }
.ficha-back:hover { text-decoration: underline; }

.ficha-hero { display: flex; gap: var(--space-8); margin-bottom: var(--space-8); align-items: flex-start; }
.ficha-image { flex: 0 0 380px; aspect-ratio: 1/1; background: var(--light); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ficha-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ficha-image-empty { color: var(--gray-light); }
.ficha-info { flex: 1; }
.ficha-badges { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-3); }
.ficha-title { font-size: 1.75rem; font-weight: 700; color: var(--primary); margin: 0 0 var(--space-2); line-height: 1.2; }
.ficha-price { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: var(--space-2) 0; }
.ficha-price-note { font-size: .8rem; color: var(--gray); margin-top: var(--space-1); }
.ficha-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }

.btn-buy { display: inline-block; background: var(--red); color: #fff; border: none; padding: var(--space-3) var(--space-6); border-radius: var(--radius); font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; transition: background .15s; }
.btn-buy:hover { background: #c62828; }

.ficha-section { margin-bottom: var(--space-8); }
.ficha-section h2 { font-size: 1.15rem; color: var(--primary); margin-bottom: var(--space-4); padding-bottom: var(--space-2); border-bottom: 2px solid var(--light); }
.ficha-section h3 { font-size: 1rem; color: var(--primary); margin-bottom: var(--space-3); }

/* Sizes grid */
.ficha-sizes { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ficha-size { padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; font-weight: 500; text-align: center; min-width: 44px; background: #fff; }

/* Colors */
.ficha-colors { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ficha-color { display: flex; align-items: center; gap: var(--space-2); }
.ficha-color-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); }
.ficha-color-name { font-size: .85rem; }

/* Normative cards */
.ficha-norms-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.ficha-norm-card { padding: var(--space-4); background: var(--light); border-radius: var(--radius); border-left: 4px solid var(--green); }
.ficha-norm-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); flex-wrap: wrap; }
.ficha-norm-desc { font-size: .875rem; line-height: 1.6; color: var(--text); margin: 0 0 var(--space-2); }
.ficha-norm-levels { margin-top: var(--space-2); }
.ficha-norm-levels strong { font-size: .8rem; color: var(--primary); }
.specs-table-compact { font-size: .8rem; margin-top: var(--space-1); }
.specs-table-compact th { width: 30%; font-size: .78rem; padding: var(--space-1) var(--space-2); }
.specs-table-compact td { font-size: .78rem; padding: var(--space-1) var(--space-2); }
.ficha-norm-parts { font-size: .82rem; margin: var(--space-1) 0 0 var(--space-4); padding: 0; list-style: disc; line-height: 1.6; }
.ficha-norm-applies { font-size: .8rem; color: var(--gray); margin-top: var(--space-2); }

/* Usage metadata */
.ficha-usage { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4); }
.ficha-usage-group { background: var(--light); padding: var(--space-3); border-radius: var(--radius); }
.ficha-usage-label { font-size: .75rem; font-weight: 700; color: var(--gray); text-transform: uppercase; margin-bottom: var(--space-2); }
.ficha-usage-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.ficha-usage-tag { font-size: .82rem; padding: var(--space-1) var(--space-2); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }

/* Related products */
.ficha-related { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 2px solid var(--light); }
.ficha-related-group { margin-bottom: var(--space-6); }
.ficha-related-group h3 { font-size: .95rem; color: var(--gray-dark); margin-bottom: var(--space-3); }

@media (max-width: 768px) {
  .ficha-hero { flex-direction: column; gap: var(--space-4); }
  .ficha-image { flex: none; width: 100%; max-height: 300px; }
  .ficha-title { font-size: 1.35rem; }
  .ficha-price { font-size: 1.25rem; }
  .ficha-usage { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .ficha-usage { grid-template-columns: 1fr; }
  .ficha-actions { flex-direction: column; }
  .ficha-actions .btn-buy { width: 100%; text-align: center; }
}
