/* product_c1.css - Product details sidebar styles */

/* ========== PRODUCT SIDEBAR ========== */
.product-sidebar {
  position: fixed;
  top: 70px; /* Match header height exactly */
  right: -400px; /* Hidden by default */
  width: 400px;
  height: calc(100vh - 70px); /* Full height minus header */
  background: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease-in-out;
  z-index: 5; /* Below header but above main content */
  display: flex;
  flex-direction: row;
}

.product-sidebar.visible {
  right: 0;
}

/* Adjust main content when sidebar is open */
body.product-sidebar-open main {
  margin-right: 400px;
  transition: margin-right 0.3s ease-in-out;
}

/* Footer positioning - keep footer full width but center form in available space */
body.product-sidebar-open footer {
  padding-right: 400px; /* Add padding to account for sidebar */
  transition: padding-right 0.3s ease-in-out;
}

/* ========== RESIZER ========== */
.product-resizer {
  width: 6px;
  background: #e5e5e5;
  cursor: ew-resize;
  border-right: 1px solid #ddd;
  flex-shrink: 0;
  position: relative;
}

.product-resizer:hover {
  background: #ccc;
}

.product-resizer::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 30px;
  background: #999;
  border-radius: 1px;
}

/* ========== SIDEBAR CONTENT ========== */
.product-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

/* ========== CLOSE BUTTON ========== */
.product-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 10;
}

.product-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* ========== LOADING STATE ========== */
.product-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #666;
}

.product-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: productSpin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes productSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== PRODUCT HEADER ========== */
.product-header {
  margin-bottom: 25px;
  padding-right: 40px; /* Space for close button */
}

.product-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: #2563eb;
}

/* ========== SPECIFICATIONS TABLE ========== */
.product-content .product-characteristics {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 15px;
}

.product-content .product-characteristics tr:nth-child(even) {
  background: #f8f9fa;
}

.product-content .product-characteristics td {
  padding: 8px 10px;
  border-bottom: 1px solid #e9ecef;
}

.product-content .char-label {
  font-weight: 500;
  color: #555;
  width: 40%;
}

.product-content .char-value {
  color: #333;
}

/* ========== MAIN CONTENT (IMAGE + DESCRIPTION) ========== */
.product-content {
  display: block;
  font-size: 14px;
  line-height: 1.5;
  color: #555;
}

.product-content .product-image {
  float: left;
  width: 140px;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  object-fit: cover;
  max-height: 180px;
  margin: 0 20px 15px 0;
}

.product-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
}

.product-content h3:first-of-type {
  margin-top: 0; /* No top margin for first Description heading */
}

.product-content p {
  margin: 10px 0;
}

.product-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.product-content li {
  margin: 5px 0;
}

/* Clear float before specifications */
.product-content h3:last-of-type {
  clear: both;
  margin-top: 25px;
}

/* ========== ERROR STATE ========== */
.product-error {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.product-error h3 {
  color: #d32f2f;
  margin-bottom: 10px;
}

/* ========== HOVER EFFECTS FOR SEARCH RESULTS ========== */
.product-item {
  transition: background-color 0.2s ease;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px !important; /* Override existing padding */
}

.product-item:hover {
  background-color: #f8f9fa;
}

/* ========== MOBILE RESPONSIVENESS ========== */
@media (max-width: 768px) {
  .product-sidebar {
    width: 100vw;
    right: -100vw;
  }
  
  .product-sidebar.visible {
    right: 0;
  }
  
  body.product-sidebar-open main,
  body.product-sidebar-open footer {
    margin-right: 0; /* No margin adjustment on mobile */
  }
  
  .product-flow-content .product-image {
    float: none; /* Remove float on mobile */
    display: block;
    margin: 0 auto 15px auto; /* Center image */
    max-width: 200px;
    width: auto;
  }
  
  .product-resizer {
    display: none; /* Hide resizer on mobile */
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  /* Tablet adjustments */
  .product-sidebar {
    width: 350px;
    right: -350px;
  }
  
  body.product-sidebar-open main,
  body.product-sidebar-open footer {
    margin-right: 350px;
  }
}

/* ========== NEW/UPDATED SEARCH RESULTS STYLING ========== */

/* Search explanation styling - moved from inline */
.search-explanation {
  margin: 12px 0;
  padding: 10px;
  font-size: 11px;
  background: #f8f9fa;
  border-radius: 6px;
  font-style: italic;
  color: #495057;
}

/* Products list container */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 0px; /* Reduced from default 10px for tighter spacing */
}

/* Individual product item - improved layout */
.search-results .product-item {
  display: flex;
  align-items: center; /* Vertically center content with image */
  gap: 8px;
  padding: 4px; /* Reduced from 12px */
  margin-bottom: 0; /* Remove margin since we use gap in container */
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s;
  border: 1px solid transparent; /* Invisible border for hover effect */
}

.search-results .product-item:hover {
  background-color: #f8f9fa;
  border-color: #e9ecef;
}

/* Product image - fixed size and centered */
.search-results .product-item .product-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0; /* Prevent image from shrinking */
  border: 1px solid #e5e5e5;
}

/* Product content area */
.search-results .product-content {
  flex: 1;
  min-width: 0; /* Allow text to wrap properly */
}

/* Product header with name and price */
.search-results .product-header {
  margin-bottom: 6px; /* Reduced from 8px */
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.search-results .product-number {
  font-weight: 600;
  color: #666;
  font-size: 0.9em;
}

.search-results .product-name {
  font-weight: 600;
  color: #333;
  flex: 1;
  min-width: 0; /* Allow name to wrap if needed */
}

.search-results .product-price {
  color: #2563eb;
  font-weight: 700;
  font-size: 1em;
  white-space: nowrap; /* Prevent price from wrapping */
}

/* Product reason/description */
.search-results .product-reason {
  color: #666;
  font-size: 0.95em;
  line-height: 1.4;
  margin: 0;
}

/* No results message */
.no-results {
  text-align: center;
  padding: 30px 20px;
  color: #666;
  font-style: italic;
}

/* ========== MOBILE RESPONSIVENESS FOR SEARCH RESULTS ========== */
@media (max-width: 768px) {
  /* Mobile search results adjustments */
  .search-results .product-item {
    gap: 12px;
    padding: 8px;
  }

  .search-results .product-item .product-image {
    width: 60px;
    height: 60px;
  }

  .search-results .product-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .search-results .product-price {
    align-self: flex-end;
    margin-top: -20px; /* Align with product name line */
  }
}

/* ========== Catalog Section Styles ========== */

.catalog-section {
    width: fit-content; /* Shrink to content width */
    max-width: 90%; /* Don't exceed 90% of parent */
    margin: 20px 0 0 auto; /* Right-align */
    padding: 16px 20px;
    background: #f5f7fa;
    border-radius: 10px;
    border: 1px solid #e1e8ed;
    text-align: right; /* Right-align all content inside */
}

.catalog-text {
    margin: 0 0 14px 0;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
    text-align: right;
    white-space: normal; /* Allow text to wrap */
}

.catalog-btn {
    display: inline-block; /* Shrink to content width */
    padding: 12px 24px; /* Comfortable padding around text */
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
    white-space: nowrap; /* Prevent text wrapping */
    width: auto; /* Auto width based on content */
    min-width: auto; /* Remove any minimum width constraint */
}

.catalog-btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.catalog-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.catalog-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .catalog-section {
        width: 100%;
        max-width: 100%;
        margin: 16px 0 0 0;
        text-align: center;
    }
    
    .catalog-text {
        font-size: 13px;
        text-align: center;
    }
    
    .catalog-btn {
        display: block;
        width: 100%;
        padding: 11px 20px;
        font-size: 14px;
    }
}

/* Process explanation bubble */
.process-explanation {
    width: fit-content; /* Shrink to content */
    max-width: 90%; /* Match catalog-section max-width */
    margin: 16px 0 0 auto; /* Right-align with margin-left: auto */
    border-left: 3px solid #4a9eba;
    padding: 14px 18px;
    font-size: 13px;
    border-radius: 8px;
}

.process-text {
    line-height: 1.6;
    color: #2c5f6f;
    text-align: left; /* Left-align text inside */
}

.process-text strong {
    color: #1a3d4a;
    display: block;
    margin-bottom: 0px;
    font-weight: 600;
    font-size: 14px;
}
