/* ============================================
   UAVChip.com - Products & Detail Page Styles
   ============================================ */

/* ===== Page Header ===== */
.page-header {
  background: var(--dark);
  padding: 3rem 0 2.5rem;
  position: relative;
  overflow: hidden;
}

.page-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(0,87,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,87,255,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}

.page-header-content { position: relative; z-index: 2; }

.page-header .breadcrumb .breadcrumb-item,
.page-header .breadcrumb .breadcrumb-item a,
.page-header .breadcrumb .breadcrumb-sep {
  color: rgba(255,255,255,0.45);
}
.page-header .breadcrumb .breadcrumb-item.active { color: rgba(255,255,255,0.8); }

.page-header h1 { color: var(--white); margin-bottom: 0.75rem; }
.page-header p { color: rgba(255,255,255,0.65); }

/* ===== Products Page ===== */
.products-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  padding: 2.5rem 0;
}

/* Sidebar Filters */
.sidebar {
  position: sticky;
  top: 88px;
  height: fit-content;
}

.filter-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.filter-header h3 { font-size: 1rem; font-weight: 700; }

.filter-clear {
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.filter-clear:hover { text-decoration: underline; }

.filter-group {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.filter-group:last-child { border-bottom: none; }

.filter-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 0.875rem;
}

.filter-group-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--dark);
}

.filter-toggle {
  width: 20px;
  height: 20px;
  color: var(--text-light);
  transition: transform var(--transition);
}

.filter-group.collapsed .filter-toggle { transform: rotate(-90deg); }
.filter-group.collapsed .filter-options { display: none; }

.filter-options { display: flex; flex-direction: column; gap: 0.5rem; }

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.filter-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  background: var(--white);
}

.filter-option input:checked + .filter-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.filter-option input:checked + .filter-checkbox::after {
  content: '✓';
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.filter-option input { display: none; }

.filter-label {
  font-size: 0.875rem;
  color: var(--text);
  flex: 1;
}

.filter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Search in filter */
.filter-search {
  position: relative;
  margin-bottom: 0.875rem;
}

.filter-search input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.825rem;
  outline: none;
  transition: border-color var(--transition);
}

.filter-search input:focus { border-color: var(--primary); }
.filter-search svg {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* Products Main Area */
.products-main { min-width: 0; }

.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.products-count {
  font-size: 0.9rem;
  color: var(--text-light);
}

.products-count strong { color: var(--dark); font-weight: 700; }

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-select {
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  outline: none;
  background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  appearance: none;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-btn {
  padding: 0.45rem 0.625rem;
  background: var(--white);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.view-btn svg { width: 16px; height: 16px; color: var(--text-light); }

.view-btn.active {
  background: var(--primary);
}

.view-btn.active svg { color: var(--white); }

/* Active Filters */
.active-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.5rem 0.2rem 0.625rem;
  background: var(--primary-light);
  border: 1px solid rgba(0,87,255,0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--primary);
}

.active-filter-remove {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.1rem;
  border-radius: 50%;
  transition: background var(--transition);
}

.active-filter-remove:hover { background: rgba(0,87,255,0.15); }
.active-filter-remove svg { width: 12px; height: 12px; }

/* Product List */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-list-item {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.product-list-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  color: inherit;
}

.pli-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pli-icon svg { width: 26px; height: 26px; color: var(--primary); }

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

.pli-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  font-family: var(--font-mono);
  margin-bottom: 0.25rem;
}

.pli-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pli-category, .pli-manufacturer {
  font-size: 0.8rem;
  color: var(--text-light);
}

.pli-specs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.pli-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Grid view */
.products-grid-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 2rem;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn svg { width: 16px; height: 16px; }
.page-btn.wide { width: auto; padding: 0 0.75rem; }

/* ===== Product Detail Page ===== */
.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2.5rem;
  padding: 2.5rem 0;
}

.product-detail-main { min-width: 0; }
.product-detail-side { }

/* Product Info Card */
.product-info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.product-detail-name {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--dark);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}

.product-detail-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.product-detail-desc {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* Specs Table */
.specs-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.specs-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.specs-header h3 { font-size: 1rem; font-weight: 700; }

.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table tr:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.specs-table tr:hover { background: var(--bg); }

.specs-table td {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
}

.specs-table td:first-child {
  font-weight: 600;
  color: var(--text-light);
  width: 40%;
}

.specs-table td:last-child {
  color: var(--dark);
  font-family: var(--font-mono);
}

/* Applications */
.applications-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.applications-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.applications-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.app-tag {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.35rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  color: var(--text);
}

.app-tag svg { width: 14px; height: 14px; color: var(--primary); }

/* Related Products */
.related-products {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.related-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.related-list { padding: 0.75rem; }

.related-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: inherit;
}

.related-item:hover { background: var(--bg); }

.related-item-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.related-item-icon svg { width: 18px; height: 18px; color: var(--primary); }
.related-item-name { font-size: 0.875rem; font-weight: 600; font-family: var(--font-mono); color: var(--dark); }
.related-item-cat { font-size: 0.75rem; color: var(--text-light); }

/* Inquiry Card (sidebar) */
.inquiry-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: sticky;
  top: 88px;
}

.inquiry-header {
  background: var(--dark);
  padding: 1.5rem;
  text-align: center;
}

.inquiry-header h3 { color: var(--white); font-size: 1.1rem; margin-bottom: 0.375rem; }
.inquiry-header p { color: rgba(255,255,255,0.6); font-size: 0.85rem; }

.inquiry-body { padding: 1.5rem; }

.inquiry-form .form-control { font-size: 0.875rem; padding: 0.5rem 0.75rem; }

.inquiry-quick-contacts {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.quick-contact-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.quick-contact-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 0.625rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
}

.quick-contact-btn:last-child { margin-bottom: 0; }

.quick-contact-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.quick-contact-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Stock Card */
.stock-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.stock-title { font-size: 0.875rem; font-weight: 700; margin-bottom: 1rem; }

.stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-light);
}

.stock-item:last-child { border-bottom: none; padding-bottom: 0; }
.stock-location { font-size: 0.875rem; color: var(--text); }
.stock-qty { font-size: 0.875rem; font-weight: 600; color: var(--dark); }

/* Datasheet Button */
.datasheet-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 1.25rem;
  text-decoration: none;
  color: var(--text);
}

.datasheet-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.datasheet-icon {
  width: 40px;
  height: 40px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.datasheet-icon svg { width: 20px; height: 20px; color: var(--danger); }
.datasheet-name { font-weight: 600; font-size: 0.875rem; }
.datasheet-size { font-size: 0.75rem; color: var(--text-muted); }

/* Tab navigation */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .products-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .product-detail-layout { grid-template-columns: 1fr; }
  .inquiry-card { position: static; }
  .products-grid-view { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .products-grid-view { grid-template-columns: 1fr; }
  .product-list-item { flex-direction: column; align-items: flex-start; }
  .pli-right { align-items: flex-start; }
}
