/* ===================================
   PRODUCT TABLE COMPONENT
   =================================== */

.product-table-container {
  width: 100%;
  margin-top: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  box-sizing: border-box;
}

.table-wrapper {
  overflow-x: hidden;
  width: 100%;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

.product-table thead {
  background: linear-gradient(135deg, #3f486f 0%, #2a2f43 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.product-table th {
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  height: auto;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
  overflow: visible;
  text-overflow: clip;
}

.product-table th:last-child {
  border-right: none;
}

.product-table tbody tr.product-row {
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #dee2e6;
}

.expanded-row {
  border-bottom: 2px solid #dee2e6;
}

.expanded-row+.product-row {
  border-top: 2px solid #dee2e6;
}

.product-table tbody tr.product-row:nth-child(even) {
  background-color: #f8f9fa;
}

.product-table tbody tr.product-row:nth-child(odd) {
  background-color: #fff;
}

.product-table tbody tr.product-row:hover {
  background-color: #e3f2fd !important;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
  transform: translateY(-1px);
}

.product-table td {
  padding: 12px 8px;
  vertical-align: middle;
  border-right: 1px solid #dee2e6;
}

.product-table td:last-child {
  border-right: none;
}

/* Column Widths */
.col-pdf {
  width: 60px;
  text-align: center;
}

.col-hersteller {
  width: 100px;
  min-width: 100px;
  text-align: center;
  white-space: nowrap;
}

.col-bezeichnung {
  min-width: 250px;
  width: auto;
}

.col-bezeichnung strong {
  color: #2a2f43;
  font-size: 13px;
  line-height: 1.3;
  display: inline;
}

.col-bezeichnung .ref-number {
  color: #666;
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

/* Desktop: Mobile Labels und Zustand-Text verstecken */
.mobile-label {
  display: none !important;
}

.zustand-text {
  display: none !important;
}

.product-table tbody td::before {
  content: none !important;
}

/* Desktop: "Zur Liste hinzufügen" Button in Expanded View verstecken */
.expanded-add-to-list {
  display: none !important;
}

.col-q,
.col-h {
  width: 85px;
  min-width: 85px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
}

.col-zustand {
  width: 90px;
  min-width: 90px;
  max-width: 90px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.condition-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin: 0 auto;
  display: block;
}

.condition-indicator-inline {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid white;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.col-motor,
.col-atex {
  text-align: center;
  width: 70px;
  min-width: 70px;
}

.col-polzahl {
  width: 80px;
  min-width: 80px;
  text-align: center;
}

.col-effizienz {
  width: 100px;
  min-width: 100px;
  text-align: center;
}

.col-leistung {
  width: 100px;
  min-width: 100px;
  text-align: center;
}

.col-baureihe {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

.col-nennweite {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
}

.col-preis {
  width: 90px;
  min-width: 90px;
  text-align: right;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.product-table tbody .col-preis {
  color: #2a2f43;
}

.col-anbieter {
  width: 80px;
  min-width: 80px;
  text-align: center;
  vertical-align: middle;
}

.anbieter-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.anbieter-icon-small {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 8px;
}

.anbieter-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.anbieter-text {
  display: inline-block;
  vertical-align: middle;
}

.col-aktion {
  width: 70px;
  min-width: 70px;
  text-align: center;
}

.btn-details {
  padding: 8px;
  background: #E30A1D;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  border: none;
  cursor: pointer;
}

.btn-details:hover {
  background: #b8080f;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(227, 10, 29, 0.3);
}

.btn-details:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-details.in-cart {
  background: #28a745;
  border: 2px solid #28a745;
}

.btn-details.in-cart:hover {
  background: #218838;
  border-color: #218838;
}

.btn-details.in-cart svg {
  stroke-width: 3;
}

.doc-icons {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
}

.doc-icon {
  display: inline-block;
  padding: 4px;
  transition: transform 0.3s ease;
}

.doc-icon:hover {
  transform: scale(1.1);
}

/* Expanded Row Styles */
.expanded-row {
  background: white;
  border-top: 2px solid #E30A1D;
}

.expanded-content {
  padding: 0 !important;
  width: 100%;
}

.expanded-wrapper {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
  padding: 30px;
  background: white;
  width: 100%;
  box-sizing: border-box;
}

.expanded-images {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.main-image-container {
  margin-bottom: 15px;
}

.expanded-main-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.expanded-main-image:hover {
  transform: scale(1.02);
}

.image-caption {
  margin-top: 8px;
  font-size: 12px;
  color: #666;
  font-style: italic;
  text-align: center;
}

.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.expanded-thumbnail {
  width: 100%;
  height: 40px;
  object-fit: cover;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.expanded-thumbnail:hover,
.expanded-thumbnail.active {
  opacity: 1;
  border-color: #E30A1D;
  transform: scale(1.05);
}

.no-image-placeholder {
  height: 200px;
  background: #f8f9fa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 14px;
}

.expanded-data {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;
  background: #fff;
}

.spec-item:nth-child(even) {
  border-right: none;
}

.spec-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.spec-item:nth-child(odd) {
  background: #f8f9fa;
}

.spec-item.highlight {
  background: #fff3cd;
  font-weight: 600;
}

.spec-item.highlight .spec-label,
.spec-item.highlight .spec-value {
  color: #333;
}

.spec-label {
  font-weight: 600;
  color: #2a2f43;
  font-size: 13px;
}

.spec-value {
  color: #333;
  font-size: 13px;
  text-align: right;
  word-break: break-word;
}

.spec-value.bold {
  font-weight: bold;
  font-size: 15px;
}

.expanded-documents {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 6px;
  display: none;
}

.expanded-documents h4 {
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin: 0 0 10px 0;
}

.documents-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.document-link-small {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  color: #333;
  transition: all 0.3s ease;
}

.document-link-small:hover {
  background: #f8f9fa;
  border-color: #E30A1D;
}

.expanded-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-expanded-primary {
  padding: 8px 12px;
  background: #28a745;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.3s ease;
  text-align: center;
  min-width: 120px;
}

.btn-expanded-primary:hover {
  background: #218838;
}

.btn-expanded-secondary {
  padding: 8px 12px;
  background: #E30A1D;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.3s ease;
  text-align: center;
  min-width: 120px;
}

.btn-expanded-secondary:hover {
  background: #b8080f;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
  .expanded-wrapper {
    grid-template-columns: 1fr;
  }

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

  .spec-item:nth-child(even) {
    border-right: 1px solid #ddd;
  }

  .data-table {
    grid-template-columns: 1fr;
  }

  .data-row:nth-child(even) {
    border-right: 1px solid #eee;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .product-table-container {
    margin-top: 15px;
    background: transparent;
    box-shadow: none;
  }

  .product-table {
    display: block !important;
    font-size: 14px;
    border: none;
  }

  .product-table thead {
    display: none !important;
  }

  .product-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* Mobile Card - Collapsed State */
  .product-table tbody tr.product-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: dense;
    gap: 12px 16px;
    background: white;
    padding: 14px 16px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    margin-bottom: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    align-items: start;
  }

  .product-table tbody tr.product-row:hover {
    transform: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    border-color: #E30A1D;
  }

  .product-table tbody tr.product-row.expanded {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
  }

  .product-table td {
    display: block;
    padding: 0 !important;
    border: none !important;
  }

  /* Mobile Labels und Zustand-Text anzeigen */
  .mobile-label {
    display: inline !important;
  }

  .zustand-text {
    display: inline !important;
  }

  /* Alle Felder einheitlich - volle Breite */
  .col-hersteller,
  .col-bezeichnung,
  .col-q,
  .col-h,
  .col-motor,
  .col-polzahl,
  .col-effizienz,
  .col-leistung,
  .col-atex,
  .col-baureihe,
  .col-nennweite,
  .col-baugroesse,
  .col-produkttyp,
  .col-zustand,
  .col-preis {
    display: block !important;
    grid-column: 1 / -1;
    padding: 8px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #2a2f43;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
    word-wrap: break-word;
  }

  /* Reihenfolge */
  .col-hersteller { order: 1; }
  .col-bezeichnung { order: 2; }
  .col-q { order: 3; }
  .col-h { order: 4; }
  .col-zustand { order: 5; }
  .col-motor { order: 6; }
  .col-polzahl { order: 7; }
  .col-effizienz { order: 8; }
  .col-leistung { order: 9; }
  .col-atex { order: 10; }
  .col-baureihe { order: 11; }
  .col-nennweite { order: 12; }
  .col-baugroesse { order: 13; }
  .col-produkttyp { order: 14; }
  .col-preis { order: 999; }

  /* Bezeichnung spezial - mit strong/ref-number Struktur */
  .col-bezeichnung {
    white-space: normal !important;
  }

  .col-bezeichnung strong {
    font-weight: 400;
    color: #2a2f43;
    font-size: 13px;
  }

  .col-bezeichnung .ref-number {
    display: none;
  }

  /* Q und H - kein Umbruch */
  .col-q,
  .col-h {
    white-space: nowrap !important;
    overflow: visible !important;
  }

  /* Zustand - Indikator inline, kein Umbruch */
  .col-zustand {
    white-space: nowrap !important;
    overflow: visible !important;
  }

  .col-zustand .condition-indicator {
    display: inline-block !important;
    width: 12px;
    height: 12px;
    margin: 0 4px 0 0;
    vertical-align: middle;
  }

  /* Preis ohne Trennlinie, kein Umbruch */
  .col-preis {
    padding-top: 8px;
    margin-top: 0;
    border-top: none;
    white-space: nowrap !important;
  }

  .col-preis strong {
    white-space: nowrap !important;
  }

  /* Komplett verstecken auf Mobile */
  .product-table tbody tr.product-row .col-pdf,
  .product-table tbody tr.product-row .col-anbieter,
  .product-table tbody tr.product-row .col-aktion,
  .col-pdf,
  .col-anbieter,
  .col-aktion {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  /* Expanded Row Mobile */
  .expanded-row {
    display: none !important;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
    border: 1px solid #E30A1D;
    border-top: none;
    margin-top: 0;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  }

  .expanded-row.show {
    display: block !important;
  }

  .expanded-content {
    display: block !important;
    padding: 0 !important;
  }

  .expanded-wrapper {
    display: flex !important;
    flex-direction: column;
    padding: 16px !important;
    gap: 16px;
  }

  .expanded-images {
    width: 100%;
  }

  .expanded-main-image {
    max-height: 250px;
    width: 100%;
    object-fit: contain;
  }

  .specs-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .spec-item {
    border-right: none !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
  }

  .spec-label {
    font-size: 12px;
  }

  .spec-value {
    text-align: left !important;
    font-size: 13px;
  }

  /* Actions in expanded view */
  .expanded-actions {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
  }

  .btn-expanded-primary,
  .btn-expanded-secondary {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }

  /* Show Add to List button in expanded view */
  .expanded-add-to-list {
    display: flex !important;
    width: 100%;
    padding: 12px 16px;
    background: #E30A1D;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
  }

  .expanded-add-to-list svg {
    flex-shrink: 0;
    display: block;
  }

  .expanded-add-to-list .button-text {
    display: inline-block;
    line-height: 1;
  }

  .expanded-add-to-list:hover {
    background: #b8080f;
  }

  .expanded-add-to-list.in-cart {
    background: #28a745;
  }

  .expanded-add-to-list.in-cart:hover {
    background: #218838;
  }
}
