/* ============================================================
   ProPartes — Catálogos Interactivos de Repuestos Industriales
   ============================================================ */

/* ──────────────────────────────────────────────────────────────
   TEMA DE COLOR — editar solo esta sección para cambiar colores
   ──────────────────────────────────────────────────────────────
   --green-800/900 : fondo oscuro (navbar, hero, sidebar, footer)
   --green-700/600 : color primario de botones y acentos
   --green-500     : hover / resaltado brillante
   --green-100/50  : tinte suave para fondos de tarjetas/badges
   --gold          : acento sobre fondos OSCUROS (debe ser claro)
   --gold-dark     : acento sobre fondos CLAROS (debe ser oscuro)
   ────────────────────────────────────────────────────────────── */

:root {
  --green-900: #1a0000;   /* deepest dark, footer/shadows */
  --green-800: #420000;   /* dark maroon, navbar/sidebar/hero */
  --green-700: #b52020;   /* primary red, buttons */
  --green-600: #cc2222;   /* hover red */
  --green-500: #e63636;   /* bright red, highlights */
  --green-100: #fde8e8;   /* light red tint */
  --green-50:  #fff5f5;   /* near-white with red hint */
  --gray-900: #1a1a1a;
  --gray-700: #3a3a3a;
  --gray-600: #4a4a4a;
  --gray-500: #6a6a6a;
  --gray-300: #b0b0b0;
  --gray-200: #d8d8d8;
  --gray-100: #f0f0f0;
  --gray-50:  #f8f8f8;
  --gold:      #ffffff;   /* white — accent ON dark backgrounds */
  --gold-dark: #111111;   /* black  — accent ON light backgrounds */
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.15);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.2);
  --radius: 8px;
  --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-700);
  line-height: 1.6;
}

/* ---- NAV ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green-800);
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: inherit;
  color: var(--white);
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 7px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--white);
}

.brand-sep { color: var(--green-500); margin: 0 .2rem; }

.brand-tagline {
  font-size: .7rem;
  color: var(--gray-300);
  font-weight: 400;
  letter-spacing: .5px;
  text-transform: uppercase;
  display: none;
}

@media (min-width: 600px) { .brand-tagline { display: block; } }

.nav-links {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.nav-links a {
  color: var(--gray-300);
  text-decoration: none;
  padding: .4rem .8rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  transition: color .2s, background .2s;
}

.nav-links a:hover { color: var(--white); background: rgba(255,255,255,.08); }

.nav-links .nav-admin {
  background: rgba(255,255,255,.1);
  color: var(--gold);
  border: 1px solid rgba(255,255,255,.3);
  margin-left: .4rem;
}

.nav-links .nav-admin:hover {
  background: var(--gold);
  color: var(--green-900);
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(150deg, var(--green-900) 0%, var(--green-800) 60%, #5a0000 100%);
  color: var(--white);
  padding: 4.5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-content { position: relative; max-width: 760px; margin: 0 auto; }

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: .7rem;
}

.hero-sub {
  font-size: 1rem;
  color: rgba(255,255,255,.65);
  margin: 0 auto .3rem;
  max-width: 480px;
}

/* ---- HERO SEARCH BAR ---- */
.hero-search-wrap {
  position: relative;
  max-width: 660px;
  margin: 2.2rem auto 2.5rem;
}

.hero-search-input {
  width: 100%;
  padding: 1.1rem 5.2rem 1.1rem 1.8rem;
  border: none;
  border-radius: 50px;
  font-size: 1.05rem;
  font-family: var(--font);
  background: #ffffff;
  color: var(--gray-900);
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
  outline: none;
  transition: box-shadow .2s;
  box-sizing: border-box;
}

.hero-search-input:focus {
  box-shadow: 0 8px 40px rgba(0,0,0,.45), 0 0 0 4px rgba(255,255,255,.2);
}

.hero-search-input::placeholder { color: #aaa; }

.hero-search-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: var(--green-700);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}

.hero-search-btn:hover  { background: var(--green-600); }
.hero-search-btn:active { transform: translateY(-50%) scale(.92); }

.machine-badge {
  display: inline-block;
  background: rgba(255,255,255,.12);
  color: var(--gold);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: .25rem .9rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: .8rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: .8rem;
  line-height: 1.1;
}

.hero p {
  font-size: 1.05rem;
  color: rgba(255,255,255,.75);
  max-width: 520px;
  margin: 0 auto 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: .25rem;
}

/* ---- DIAGRAM SECTION ---- */
.diagram-section {
  padding: 2.5rem 1rem;
  background: var(--white);
}

.diagram-container { max-width: 1100px; margin: 0 auto; }

.diagram-header { text-align: center; margin-bottom: 1.5rem; }

.diagram-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-800);
  margin-bottom: .4rem;
}

.diagram-hint {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--gray-500);
  background: var(--gray-50);
  padding: .35rem .8rem;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
}

.diagram-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.diagram-svg-wrapper {
  flex: 1;
  min-width: 0;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.diagram-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Hotspot hover effects */
.part-hotspot {
  cursor: pointer;
}

.part-hotspot .hotspot-hit {
  fill: transparent;
  stroke: none;
}

.part-hotspot .hotspot-highlight {
  fill: rgba(166, 32, 32, 0);
  stroke: transparent;
  stroke-width: 0;
  transition: fill .2s, stroke .2s;
}

.part-hotspot:hover .hotspot-highlight {
  fill: rgba(166, 32, 32, .18);
  stroke: var(--green-600);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(166,32,32,.5));
}

.part-hotspot.active .hotspot-highlight {
  fill: rgba(166, 32, 32, .25);
  stroke: var(--green-600);
  stroke-width: 3;
}

.part-label {
  pointer-events: none;
  font-family: var(--font);
}

.leader-line { stroke: var(--gray-400); stroke-dasharray: 4,3; pointer-events: none; }

/* ---- PART DETAIL PANEL ---- */
.part-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: opacity .25s, transform .25s;
}

.part-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
}

.panel-header {
  background: var(--green-800);
  color: var(--white);
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.panel-category {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.6);
  margin-bottom: .2rem;
}

.panel-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  max-width: 220px;
}

.panel-close {
  background: rgba(255,255,255,.12);
  border: none;
  color: var(--white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}

.panel-close:hover { background: rgba(255,255,255,.25); }

.panel-body { padding: 1.2rem; }

.oem-section { margin-bottom: 1rem; }

.oem-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gray-500);
  margin-bottom: .4rem;
}

.oem-tags { display: flex; flex-wrap: wrap; gap: .35rem; }

.oem-tag {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid rgba(122,30,30,.2);
  border-radius: 4px;
  padding: .2rem .5rem;
  font-size: .78rem;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  letter-spacing: .5px;
}

.oem-tag.consult {
  background: rgba(34,34,34,.1);
  color: var(--gold-dark);
  border-color: rgba(34,34,34,.3);
}

.panel-description {
  font-size: .875rem;
  color: var(--gray-600);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.panel-specs {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  margin-bottom: 1.2rem;
}

.specs-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gray-500);
  margin-bottom: .35rem;
}

.specs-value {
  font-size: .8rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .7rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.stock-badge.in-stock { background: var(--green-100); color: var(--green-700); }
.stock-badge.out-stock { background: rgba(220,53,69,.1); color: #c0392b; }
.stock-badge.consult-stock { background: rgba(34,34,34,.12); color: var(--gold-dark); }

.stock-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.in-stock .stock-dot { background: var(--green-600); }
.out-stock .stock-dot { background: #c0392b; }
.consult-stock .stock-dot { background: var(--gold); }

.btn-quote {
  width: 100%;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: .8rem 1.2rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: background .2s, transform .1s;
}

.btn-quote:hover { background: var(--green-600); transform: translateY(-1px); }
.btn-quote:active { transform: translateY(0); }

/* ---- PARTS LIST ---- */
.parts-section {
  padding: 3rem 1.5rem;
  background: var(--gray-50);
}

.section-header { text-align: center; margin-bottom: 2rem; }

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green-800);
  margin-bottom: .4rem;
}

.section-header p { color: var(--gray-500); font-size: .95rem; }

.container { max-width: 1100px; margin: 0 auto; }

/* ---- Parts toolbar (count + filters) ---- */
.parts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.2rem;
}

.results-count {
  font-size: .88rem;
  color: var(--gray-500);
  font-weight: 500;
  white-space: nowrap;
}

.results-count strong { color: var(--gray-700); }

/* ---- Search bar (legacy, unused on main page) ---- */
.parts-search-wrap {
  position: relative;
  margin-bottom: 1.2rem;
}
.parts-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  pointer-events: none;
}
.parts-search-input {
  width: 100%;
  padding: .75rem 2.8rem .75rem 2.6rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: var(--font);
  background: #fff;
  color: var(--gray-900);
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.parts-search-input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(166,32,32,.12);
}
.parts-search-input::placeholder { color: var(--gray-300); }
.parts-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: .9rem;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}
.parts-search-clear:hover { background: var(--gray-100); color: var(--gray-900); }
.parts-search-clear.hidden { display: none; }

.filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.filter-btn {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: .35rem .9rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--gray-600);
  transition: all .2s;
  font-weight: 500;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.part-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  cursor: pointer;
  transition: box-shadow .2s, border-color .2s, transform .15s;
  position: relative;
  overflow: hidden;
}

.part-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--green-600);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s;
  border-radius: 2px 0 0 2px;
}

.part-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--green-500);
  transform: translateY(-2px);
}

.part-card:hover::before { transform: scaleX(1); }

.card-category {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--green-600);
  font-weight: 600;
  margin-bottom: .35rem;
}

.card-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--gray-800, #222);
  margin-bottom: .5rem;
  line-height: 1.3;
}

.card-oem {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .75rem;
}

.card-oem-tag {
  font-size: .72rem;
  font-family: 'Courier New', monospace;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 4px;
  padding: .15rem .4rem;
}

.card-desc {
  font-size: .82rem;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: .9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-stock { font-size: .75rem; font-weight: 600; }
.card-stock.in { color: var(--green-600); }
.card-stock.out { color: #c0392b; }
.card-stock.consult { color: var(--gold-dark); }

.card-btn {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid rgba(122,30,30,.2);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.card-btn:hover { background: var(--green-700); color: var(--white); }

/* ---- CONTACT SECTION ---- */
.contact-section {
  padding: 3rem 1.5rem 4rem;
  background: var(--white);
}

.contact-inner {
  max-width: 680px;
  margin: 0 auto;
}

.quote-form {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: .35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-size: .9rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-700);
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(166,32,32,.12);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.required { color: var(--green-600); }

.pf-machines-list {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .5rem .7rem;
  background: var(--white);
}

.pf-machine-check {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem 0;
  font-size: .85rem;
  font-weight: 400;
  color: var(--gray-700);
  cursor: pointer;
}

.pf-machine-check input { width: auto; }

.pf-machines-error {
  color: #c0392b;
  font-size: .78rem;
  margin-top: .35rem;
}

.form-submit {
  width: 100%;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: .9rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: .5rem;
  transition: background .2s, transform .1s;
}

.form-submit:hover { background: var(--green-600); }
.form-submit:active { transform: scale(.98); }

.form-note {
  text-align: center;
  font-size: .78rem;
  color: var(--gray-500);
  margin-top: .75rem;
}

/* ---- MODAL ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 1;
  transition: opacity .2s;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  background: var(--green-800);
  color: var(--white);
  padding: 1.2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: rgba(255,255,255,.12);
  border: none;
  color: var(--white);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}

.modal-close:hover { background: rgba(255,255,255,.25); }

.modal-body { padding: 1.5rem; }

.modal-part-ref {
  background: var(--green-50);
  border: 1px solid rgba(122,30,30,.15);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: 1.2rem;
  font-size: .85rem;
  color: var(--green-700);
}

.modal-part-ref strong { color: var(--green-800); }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  background: var(--green-800);
  color: var(--white);
  padding: .9rem 1.4rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .6rem;
  transform: translateY(0);
  transition: opacity .3s, transform .3s;
  max-width: 340px;
}

.toast.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }

/* ---- DIAGRAM TABS ---- */
.diagram-tabs {
  display: flex;
  gap: .4rem;
  justify-content: center;
  margin: .8rem 0 .6rem;
}

.diagram-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  padding: .45rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all .2s;
}

.diagram-tab:hover { border-color: var(--green-500); color: var(--green-700); }

.diagram-tab.active {
  background: var(--green-700);
  border-color: var(--green-700);
  color: var(--white);
}

/* ---- DESPIECE GRID ---- */
.despiece-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1rem 0 .5rem;
}

.dp-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1rem .75rem .85rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, box-shadow .15s, transform .15s;
  position: relative;
}

.dp-card:hover {
  border-color: var(--green-500);
  box-shadow: 0 4px 14px rgba(166,32,32,.15);
  transform: translateY(-2px);
}

.dp-card.dp-active {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(166,32,32,.2);
}

.dp-num {
  position: absolute;
  top: .5rem; left: .6rem;
  width: 22px; height: 22px;
  background: var(--green-700);
  color: var(--white);
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.dp-icon {
  margin: .4rem auto .6rem;
  display: flex; justify-content: center; align-items: center;
  height: 80px;
}

.dp-name {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gray-700);
  line-height: 1.3;
  margin-bottom: .25rem;
}

.dp-oem {
  font-size: .68rem;
  font-family: 'Courier New', monospace;
  color: var(--gray-500);
  letter-spacing: .3px;
  margin-bottom: .3rem;
}

.dp-price {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid rgba(122,30,30,.15);
  border-radius: 10px;
  padding: .15rem .5rem;
  font-size: .7rem;
  font-weight: 700;
}

/* ---- PRODUCT LIST (new parts section) ---- */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.product-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  display: flex;
  gap: 0;
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}

.product-card:hover { box-shadow: var(--shadow-md); border-color: var(--green-700); }

.product-image {
  width: 173px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem .5rem;
  cursor: pointer;
  position: relative;
}

.product-photo {
  width: 100%;
  height: 133px;
  object-fit: contain;
  padding: .25rem;
  display: block;
}

.product-num {
  position: absolute;
  top: .5rem; left: .6rem;
  width: 22px; height: 22px;
  background: var(--green-700);
  color: var(--white);
  border-radius: 50%;
  font-size: .68rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.product-info {
  flex: 1;
  padding: 1rem 1.2rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.product-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.product-cat {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--green-600);
  font-weight: 600;
}

.product-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900, #111);
  margin: .2rem 0 .35rem;
  line-height: 1.25;
}

.product-oem { display: flex; flex-wrap: wrap; gap: .3rem; }

.product-price-summary {
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.price-from {
  display: block;
  font-size: .68rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.price-main {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-700);
  letter-spacing: -.5px;
}

.price-consult {
  font-size: .82rem;
  color: var(--gold-dark);
  font-weight: 600;
}

.product-desc {
  font-size: .83rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* Supplier table */
.supplier-table-wrap {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
}

.supplier-table-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gray-500);
  font-weight: 600;
  padding: .45rem .75rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}

.supplier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.supplier-row td { padding: .5rem .75rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.supplier-row:last-child td { border-bottom: none; }
.supplier-row:hover td { background: var(--gray-50); }
.best-row td { background: rgba(166,32,32,.04); }
.best-row:hover td { background: rgba(166,32,32,.08); }
.no-stock-row { opacity: .65; }

.flag-emoji { font-size: 1.2rem; line-height: 1; }
.flag-icon  { display: inline-block; vertical-align: middle; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); object-fit: cover; }
.sup-flag   { width: 32px; text-align: center; padding-right: .2rem !important; }
.sup-country{ font-size: .78rem; color: var(--gray-500); white-space: nowrap; }
.sup-name   { font-weight: 600; color: var(--gray-700); }
.sup-price  { text-align: right; font-weight: 700; white-space: nowrap; }
.sup-badges { white-space: nowrap; }
.sup-action { text-align: right; white-space: nowrap; padding-right: .6rem !important; }

.price-val  { color: var(--green-700); font-size: .9rem; }
.price-na   { color: var(--gray-400); font-style: italic; font-size: .8rem; }

.price-tax-note {
  font-size: .65rem;
  font-weight: 400;
  color: var(--gray-400);
  margin-left: .3rem;
  white-space: nowrap;
}

.badge-sup {
  display: inline-block;
  border-radius: 4px;
  padding: .12rem .45rem;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .3px;
}

.badge-sup.oem     { background: rgba(122,30,30,.1);  color: var(--green-700); }
.badge-sup.best    { background: rgba(34,34,34,.15); color: var(--gold-dark); }
.badge-sup.nostock { background: var(--gray-100); color: var(--gray-500); }
.badge-sup.instock { background: rgba(30,142,62,.1); color: #1e8e3e; }
.badge-sup.onorder { background: rgba(232,161,32,.12); color: var(--gold-dark); }

.btn-cotizar-sup {
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: .3rem .7rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.btn-cotizar-sup:hover { background: var(--green-600); }

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: auto;
}

.card-stock.in     { font-size: .78rem; font-weight: 600; color: var(--green-600); }
.card-stock.out    { font-size: .78rem; font-weight: 600; color: #c0392b; }
.card-stock.consult{ font-size: .78rem; font-weight: 600; color: var(--gold-dark); }

.btn-ver-diagrama {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid rgba(122,30,30,.2);
  border-radius: 6px;
  padding: .35rem .8rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn-ver-diagrama:hover { background: var(--green-700); color: var(--white); }

/* Panel price range */
.panel-price-range {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .75rem;
  background: var(--green-50);
  border: 1px solid rgba(122,30,30,.12);
  border-radius: var(--radius);
  padding: .5rem .8rem;
}

.ppr-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; color: var(--green-600); font-weight: 600; }
.ppr-value { font-size: 1.15rem; font-weight: 700; color: var(--green-700); letter-spacing: -.3px; }
.ppr-to    { font-size: .78rem; color: var(--gray-500); }

/* Mobile: product card stacks vertically */
@media (max-width: 600px) {
  .product-card { flex-direction: column; }
  .product-image { width: 100%; height: 160px; border-right: none; border-bottom: 1px solid var(--gray-200); }
  .product-top { flex-direction: column; }
  .product-price-summary { text-align: left; }
  .supplier-table { font-size: .75rem; }
  .sup-country { display: none; }
  .despiece-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---- FOOTER ---- */
.footer {
  background: var(--green-900);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: .82rem;
}

.footer-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: .4rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: .75rem 0;
}

.footer-links a {
  color: rgba(255,255,255,.5);
  text-decoration: none;
  font-size: .8rem;
  transition: color .2s;
}

.footer-links a:hover { color: var(--white); }

/* ---- RESPONSIVE: small screens / mobile ---- */
@media (max-width: 768px) {
  .diagram-layout { flex-direction: column; }
  .part-panel { width: 100%; }
  .nav-links a:not(.nav-admin) { display: none; }
}

/* ---- ADMIN STYLES ---- */
.admin-body { background: var(--gray-100); }

.admin-sidebar {
  width: 220px;
  background: var(--green-900);
  min-height: 100vh;
  flex-shrink: 0;
  padding: 1.5rem 0;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
}

.sidebar-logo .brand-name { color: var(--white); font-size: 1.15rem; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1.2rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  transition: all .2s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.08);
  color: var(--white);
}

.sidebar-nav a.active { border-left: 3px solid var(--gold); }

.admin-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.admin-card-header {
  padding: 1rem 1.5rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-card-header h3 { font-size: 1rem; font-weight: 700; color: var(--green-800); }

.admin-card-body { padding: 1.5rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.admin-table th {
  background: var(--gray-50);
  padding: .7rem 1rem;
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
}

.admin-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.admin-table tr:hover td { background: var(--gray-50); }

.btn-sm {
  padding: .3rem .7rem;
  font-size: .78rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
}

.btn-primary { background: var(--green-700); color: var(--white); }
.btn-primary:hover { background: var(--green-600); }
.btn-secondary { background: var(--gray-200); color: var(--gray-600); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: rgba(220,53,69,.12); color: #c0392b; }
.btn-danger:hover { background: #c0392b; color: var(--white); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.stat-card-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-700);
  line-height: 1;
  margin-bottom: .25rem;
}

.stat-card-label {
  font-size: .78rem;
  color: var(--gray-500);
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-red { background: rgba(220,53,69,.1); color: #c0392b; }
.badge-yellow { background: rgba(34,34,34,.12); color: var(--gold-dark); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.admin-title { font-size: 1.4rem; font-weight: 700; color: var(--green-800); }

.quote-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
  transition: border-color .2s;
}

.quote-item:hover { border-color: var(--green-500); }

.quote-item-header { display: flex; justify-content: space-between; margin-bottom: .5rem; }
.quote-name { font-weight: 700; font-size: .95rem; }
.quote-date { font-size: .78rem; color: var(--gray-500); }
.quote-part { font-size: .85rem; color: var(--green-700); font-weight: 600; margin-bottom: .25rem; }
.quote-contact { font-size: .82rem; color: var(--gray-500); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ============================================================
   ACCORDION EXPAND PANEL
   ============================================================ */

/* Wrapper holds card + expand panel as one visual unit */
.machine-card-wrapper {
  display: flex;
  flex-direction: column;
}

/* Expanded card: flat bottom, visually connects to panel */
.machine-select-card.expanded {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: var(--green-100);
  box-shadow: var(--shadow-md);
  transform: none !important;
}

/* Expand panel: sits flush below the card */
.machine-expand-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-top: none;
  border-left: 4px solid var(--green-700);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
  overflow: hidden;
}

.mep-inner {
  padding: 1.4rem 1.5rem 1.5rem;
}

/* Toolbar row: search (left) + count/filters (right) */
.mep-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.mep-search-wrap {
  position: relative;
  flex: 0 1 260px;
  min-width: 160px;
}

.mep-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--green-700);
  pointer-events: none;
}

.mep-search-input {
  width: 100%;
  padding: .6rem 1rem .6rem 2.5rem;
  border: 3px solid var(--green-700);
  border-radius: 50px;
  font-size: .88rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-900);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}

.mep-search-input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 4px var(--green-100);
}

.mep-search-input::placeholder { color: var(--gray-400); }

.mep-toolbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.mep-count {
  font-size: .82rem;
  color: var(--gray-500);
  font-weight: 500;
  white-space: nowrap;
}

.mep-filters {
  margin-bottom: 0;
  justify-content: flex-start;
}

/* Mobile: stack toolbar vertically */
@media (max-width: 600px) {
  .mep-toolbar { flex-direction: column; }
  .mep-search-wrap { min-width: 0; width: 100%; }
  .mep-toolbar-right { width: 100%; }
}

/* ---- Hero search: preview de coincidencias en cada card ---- */
.msc-search-preview {
  margin-top: .65rem;
  padding-top: .6rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
}

.msc-preview-label {
  font-size: .72rem;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  margin-right: .1rem;
}

.msc-preview-tag {
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 5px;
  padding: .18rem .55rem;
  font-size: .78rem;
  font-weight: 500;
}

.msc-preview-tag mark {
  background: #fff176;
  color: var(--gray-900);
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}

/* ---- NAV CART ICON ---- */
.nav-cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  color: var(--white);
  text-decoration: none;
  transition: background .2s;
  margin-left: .2rem;
  flex-shrink: 0;
}

.nav-cart:hover { background: rgba(255,255,255,.22); }

.nav-cart.active {
  background: var(--green-700);
  border-color: var(--green-700);
}

.cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--green-600);
  color: var(--white);
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: .62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--green-800);
  line-height: 1;
}

.cart-badge.hidden { display: none; }

/* ---- FLOATING CART BUTTON ---- */
.floating-cart-btn {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: .55rem;
  background: var(--green-700);
  color: var(--white);
  padding: .8rem 1.3rem;
  border-radius: 50px;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  font-weight: 700;
  font-size: .85rem;
  transition: background .15s, transform .15s;
}

.floating-cart-btn:hover { background: var(--green-600); transform: translateY(-50%) translateX(-4px); }

.floating-cart-btn .cart-badge {
  position: static;
  background: var(--white);
  color: var(--green-700);
  border: none;
}

@media (max-width: 520px) {
  .floating-cart-btn { right: 1rem; padding: .7rem 1.05rem; font-size: .8rem; }
}

/* ---- SUPPLIER TABLE: btn agregar al carrito ---- */
.btn-add-cart {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: .32rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.btn-add-cart:hover:not(:disabled) { background: var(--green-600); }

.btn-add-cart:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  cursor: not-allowed;
}

.sup-origin {
  width: 40px;
  text-align: center;
}

/* Cantidad + botón agregar en paralelo */
.sup-action-group {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Botón cuando el item ya está en el carrito */
.btn-add-cart.btn-in-cart {
  background: var(--green-50);
  color: var(--green-700);
  border: 1.5px solid rgba(181,32,32,.25);
}

.btn-add-cart.btn-in-cart:hover {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

/* ============================================================
   CART PAGE
   ============================================================ */
.cart-section {
  padding: 2.5rem 1.5rem 4rem;
  background: var(--gray-50);
  min-height: calc(100vh - 62px);
}

.cart-container { max-width: 1000px; margin: 0 auto; }

.cart-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.cart-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--green-800);
  letter-spacing: -.5px;
  line-height: 1.1;
}

.cart-subtitle {
  font-size: .9rem;
  color: var(--gray-500);
  margin-top: .25rem;
}

.btn-back-catalog {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--green-700);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  padding: .45rem 1rem .45rem .8rem;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}

.btn-back-catalog:hover {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

/* Two-column layout */
.cart-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.cart-items-col { flex: 1; min-width: 0; }

.cart-summary-col {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 78px;
}

@media (max-width: 760px) {
  .cart-layout   { flex-direction: column; }
  .cart-summary-col { width: 100%; position: static; }
}

/* Cart items list */
.cart-items-list {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: .75rem;
}

.cart-item {
  border-bottom: 1px solid var(--gray-100);
  padding: 1.1rem 1.3rem;
  transition: background .15s;
}

.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: var(--gray-50); }

.cart-item-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

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

.cart-item-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--gray-900, #111);
  margin-bottom: .2rem;
  line-height: 1.3;
}

.cart-item-oem {
  font-size: .75rem;
  font-family: 'Courier New', monospace;
  color: var(--gray-500);
  margin-bottom: .3rem;
  letter-spacing: .3px;
}

.cart-item-supplier {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--gray-600);
}

.cart-sup-flag { font-size: 1rem; line-height: 1; }
.cart-sup-country { color: var(--gray-400); }

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
  flex-shrink: 0;
}

.cart-item-unit-price {
  font-size: .8rem;
  color: var(--gray-500);
}

.cart-unit-label { font-size: .72rem; }

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.cart-qty-btn {
  background: var(--gray-50);
  border: none;
  width: 30px;
  height: 30px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  line-height: 1;
}

.cart-qty-btn:hover { background: var(--gray-200); }

.cart-qty-value {
  width: 32px;
  text-align: center;
  font-size: .88rem;
  font-weight: 700;
  color: var(--gray-800, #222);
  border-left: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  line-height: 30px;
}

.cart-item-subtotal {
  font-size: .95rem;
  font-weight: 700;
  color: var(--green-700);
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  margin-top: .1rem;
}

.cart-item-remove:hover { color: #c0392b; background: rgba(192,57,43,.08); }

.btn-clear-cart {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: .8rem;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.btn-clear-cart:hover { color: #c0392b; background: rgba(192,57,43,.07); }

/* Summary box */
.cart-summary-box {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.cart-summary-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green-800);
  margin-bottom: 1rem;
}

.cart-summary-rows {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
  font-size: .82rem;
}

.csr-name {
  color: var(--gray-600);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.csr-qty {
  color: var(--gray-400);
  font-weight: 600;
  font-size: .75rem;
  margin-left: .2rem;
}

.csr-price {
  color: var(--gray-700);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.cart-summary-divider {
  height: 1px;
  background: var(--gray-200);
  margin: .75rem 0;
}

.cart-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .95rem;
  font-weight: 700;
  color: var(--gray-800, #222);
  margin-bottom: .75rem;
}

.cart-total-value {
  font-size: 1.3rem;
  color: var(--green-700);
  letter-spacing: -.3px;
}

.cart-summary-note {
  font-size: .75rem;
  color: var(--gray-400);
  line-height: 1.5;
  margin-bottom: 1.1rem;
}

.btn-submit-order {
  width: 100%;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: .9rem 1rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: background .2s, transform .1s;
  margin-bottom: .6rem;
}

.btn-submit-order:hover { background: var(--green-600); }
.btn-submit-order:active { transform: scale(.98); }

.btn-keep-shopping {
  display: block;
  text-align: center;
  color: var(--gray-500);
  font-size: .82rem;
  text-decoration: none;
  padding: .4rem;
  border-radius: var(--radius);
  transition: color .15s;
}

.btn-keep-shopping:hover { color: var(--green-700); }

/* Empty / success state */
.cart-empty {
  text-align: center;
  padding: 4rem 2rem;
  width: 100%;
}

.cart-empty svg { margin-bottom: 1.2rem; }

.cart-empty-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: .5rem;
}

.cart-empty-sub {
  color: var(--gray-500);
  font-size: .95rem;
  margin-bottom: 1.5rem;
}

/* ---- MACHINE GROUP (parts section) ---- */
.machine-group {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.machine-group-header {
  background: var(--green-800);
  color: var(--white);
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.machine-group-icon {
  width: 46px;
  height: 46px;
  background: rgba(255,255,255,.12);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.machine-group-meta { flex: 1; min-width: 0; }

.machine-group-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: .15rem;
}

.machine-group-cat {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.machine-group-count {
  background: rgba(255,255,255,.15);
  color: var(--white);
  border-radius: 20px;
  padding: .3rem .9rem;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.machine-group-parts {
  display: flex;
  flex-direction: column;
}

/* Cards inside a machine group: flat, separated by dividers */
.machine-group-parts .product-card {
  border: none;
  border-bottom: 1px solid var(--gray-100);
  border-radius: 0;
  box-shadow: none;
}

.machine-group-parts .product-card:last-child {
  border-bottom: none;
}

.machine-group-parts .product-card:hover {
  box-shadow: none;
  background: var(--gray-50);
}

/* ============================================================
   MACHINE SELECTION CARDS — horizontal, white background
   ============================================================ */
.machines-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: .75rem;
}

/* Single-column always — full width accordion layout */

.machine-select-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--green-700);
  border-radius: var(--radius-lg);
  display: flex;
  overflow: hidden;
  cursor: pointer;
  min-height: 159px;
  transition: box-shadow .2s, border-color .2s, transform .15s;
  outline: none;
}

.machine-select-card:hover,
.machine-select-card:focus {
  box-shadow: var(--shadow-md);
  border-color: var(--green-500);
  border-left-color: var(--green-600);
  transform: translateY(-2px);
}

/* Image area (left side) */
.msc-image {
  width: 205px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.msc-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: .6rem;
  background-color: #ffffff;
}

.msc-placeholder-icon {
  opacity: .7;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ProPartes brand badge over the image */
.msc-brand-badge {
  position: absolute;
  top: .55rem;
  left: .6rem;
  display: flex;
  align-items: center;
  gap: .25rem;
  color: var(--green-800);
  opacity: .45;
  pointer-events: none;
  z-index: 1;
}

.msc-brand-badge svg { flex-shrink: 0; }

.msc-brand-badge span {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1;
}

/* Info area (right side) */
.msc-body {
  flex: 1;
  padding: 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.msc-name {
  font-size: 1.23rem;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--gray-900, #111);
  line-height: 1.2;
  margin-bottom: .15rem;
}

.msc-cat {
  font-size: .7rem;
  color: var(--green-700);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 700;
  margin-bottom: .45rem;
}

.msc-desc {
  font-size: .83rem;
  color: var(--gray-500);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .75rem;
  gap: .75rem;
  flex-wrap: wrap;
}

.msc-count {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid rgba(181,32,32,.18);
  border-radius: 20px;
  padding: .22rem .85rem;
  font-size: .78rem;
  font-weight: 700;
}

.msc-cta {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--green-700);
  color: var(--white);
  border-radius: var(--radius);
  padding: .45rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  transition: background .2s;
  white-space: nowrap;
}

.machine-select-card:hover .msc-cta,
.machine-select-card:focus .msc-cta {
  background: var(--green-600);
}

/* Mobile: stack vertically */
@media (max-width: 520px) {
  .machine-select-card {
    flex-direction: column;
    min-height: auto;
    border-left: 1px solid var(--gray-200);
    border-top: 4px solid var(--green-700);
  }
  .msc-image {
    width: 100%;
    height: 153px;
  }
}

/* ============================================================
   PARTS VIEW BREADCRUMB
   ============================================================ */
.parts-breadcrumb {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--white);
  color: var(--green-700);
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  padding: .4rem 1rem .4rem .8rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background .2s, color .2s, border-color .2s;
}

.btn-back:hover {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

.breadcrumb-sep {
  color: var(--gray-400);
  font-size: 1.1rem;
  line-height: 1;
}

.breadcrumb-machine {
  font-size: .9rem;
  font-weight: 700;
  color: var(--gray-700);
}

/* ============================================================
   SECTION HEADER (machines view)
   ============================================================ */
#maquinas-view .section-header {
  margin-bottom: 1.8rem;
}

/* ============================================================
   FLAT PRODUCT LIST (single machine, no group wrapper)
   ============================================================ */
#parts-grid > .product-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0;
}

#parts-grid > .product-card:hover {
  box-shadow: var(--shadow-md);
  background: var(--white);
}
