/* Quote Cart */
.quote-cart {
  position: fixed;
  top: 0px;
  right: -350px;
  width: 350px;
  height: 100%;
  background-color: var(--white);
  box-shadow: var(--box-shadow);
  z-index: 9999;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  border-radius: 0 0 0 8px;
  overflow: visible;
}

.quote-cart.open {
  right: 0;
  bottom: env(safe-area-inset-bottom);
}

.modal-datasheet-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none; /* This is optional but definitively prevents any click actions */
}

/* Arrow Toggle for Quote Panel */
.quote-cart-toggle {
  position: absolute;
  top: 50%;
  left: -40px;
  width: 40px;
  height: 40px;
  background-color: var(--primary-color, #2196f3);
  color: var(--white, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px 0 0 4px;
  box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 990;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-right: none;
}

/* Arrow Icon using CSS */
.toggle-arrow {
  width: 12px;
  height: 12px;
  border-top: 2px solid white;
  border-right: 2px solid white;
  transform: rotate(-135deg); /* Points right by default (closed state) */
  transition: transform 0.3s ease;
}


/* Updated CSS for the Quote Panel Close Button with padding */
.quote-cart-close {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0; /* Remove default button padding */
}

.quote-cart-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* SVG icon container to provide padding */
.quote-cart-close-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 6px; /* This creates padding around the SVG */
}

/* SVG itself takes full space of the container */
.quote-cart-close-icon svg {
  width: 100%;
  height: 100%;
}

/* Update the header to accommodate the close button */
.quote-cart-header {
  position: relative;
  padding: 15px 20px;
  background-color: var(--secondary-color);
  color: var(--white);
}

.quote-cart-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.quote-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Item container with subtle border and spacing */
.quote-cart-item {
  display: flex;
  margin-bottom: 15px;
  padding: 0;
  border: 1px solid #eee;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quote-cart-item:last-child {
  margin-bottom: 0;
}

.quote-cart-item-image {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  margin-right: 12px;
  border: 1px solid #e0e0e0;
}

.quote-cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quote-cart-item-details {
  flex: 1;
}

/* Header with light background */
.quote-cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background-color: #f7f9fc;
  border-bottom: 1px solid #eee;
}

/* Product title styling */
.quote-cart-item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #333;
}

/* Close button styling - distinct from quantity buttons */
.quote-cart-item-remove {
  background-color: transparent;
  border: none;
  color: #999;
  font-size: 18px;
  font-weight: normal;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.2s;
  border-radius: 4px;
}

.quote-cart-item-remove:hover {
  background-color: #ffebee;
  color: #f44336;
}

/* Quantity controls container */
.quote-cart-item-quantity {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  height: auto;
  margin-top: 0;
}

/* Quantity buttons with consistent styling */
.quantity-btn {
  touch-action: manipulation;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 4px;
  border: 1px solid #d0e4fa;
  background-color: #f0f7ff;
  color: #2196f3;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 0 2px;
}

.quantity-btn:hover {
  background-color: #e3f2fd;
}

.quantity-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #e1e1e1;
  color: #bdbdbd;
  background-color: #f5f5f5;
}

/* Input with suffix styling */
.quantity-input-container {
  position: relative;
  flex-grow: 1;
  margin: 0 10px;
}

.quantity-input-with-suffix {
  width: 100%;
  height: 36px;
  text-align: right;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0 40px 0 8px; /* Extra right padding for the suffix */
  -moz-appearance: textfield;
  color: #333;
}

/* Hide the number input spinners */
.quantity-input-with-suffix::-webkit-inner-spin-button,
.quantity-input-with-suffix::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #757575;
  font-size: 14px;
  pointer-events: none; /* Makes sure the suffix doesn't interfere with input clicks */
}

/* Minimum order note */
.min-order-note {
  font-size: 12px;
  color: #757575;
  margin: 0 12px 10px 12px;
  font-style: italic;
}

.quote-cart-footer {
  margin-top: auto;
  padding: 20px;
  background-color: var(--light-gray);
  border-top: 1px solid var(--medium-gray);
}

.quote-cart-footer .form-group {
  margin-bottom: 15px;
}

.quote-cart-footer input,
.quote-cart-footer textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--medium-gray);
  border-radius: 4px;
}

.quote-cart-footer textarea {
  resize: vertical;
  min-height: 80px;
}

.quote-cart-footer button {
  width: 100%;
}

.quote-cart-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--dark-gray);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .quantity-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 20px;
  }

  .quantity-input-with-suffix {
    height: 44px;
    font-size: 18px;
  }

  .quote-cart {
    width: 100%;
    right: -100%;
  }
}

/* --- Product Details Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 53, 86, 0.6); /* Dark blue overlay */
  z-index: 1010;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  overflow: hidden;
  transform: translateY(-50px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: var(--secondary-color);
  color: var(--white);
  border-bottom: 1px solid var(--medium-gray);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.modal-close-btn:hover {
  opacity: 1;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body h4 {
  margin-top: 20px;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 8px;
  color: var(--secondary-color);
}

.spec-list {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr;
  gap: 12px 20px;
}

.spec-list dt {
  font-weight: 500;
  color: var(--dark-gray);
}

.spec-list dd {
  margin: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end; /* Align buttons to the right */
  gap: 15px;
  padding: 15px 20px;
  background-color: var(--light-gray);
  text-align: right;
  border-top: 1px solid var(--medium-gray);
}

@media (max-width: 576px) {
  .spec-list {
    grid-template-columns: 1fr; /* Stack on mobile */
  }
  .spec-list dt {
    padding-bottom: 4px;
    border-bottom: 1px solid var(--medium-gray);
  }
}

.quote-cta-banner {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 30px 40px;
  border-radius: 8px;
  margin-bottom: 50px; /* Space between banner and product list */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 4px 15px rgba(231, 49, 55, 0.3); /* Subtle red glow */
}

.quote-cta-banner h3 {
  margin: 0 0 10px 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
}

.quote-cta-banner p {
  max-width: 650px;
  margin-bottom: 25px;
  font-size: 1.1rem;
  line-height: 1.7;
  opacity: 0.95;
}

.quote-cta-banner .btn.primary {
  background-color: var(--white);
  color: var(--primary-color);
  border: 2px solid var(--white);
  font-weight: 700;
  padding: 12px 28px;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.quote-cta-banner .btn.primary:hover {
  background-color: transparent;
  color: var(--white);
  transform: translateY(-2px);
}


/* --- Autocomplete Styles for Port Input --- */
.autocomplete-container {
  position: relative;
}

.port-suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--white);
  border: 1px solid var(--medium-gray);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1020; /* Ensure it's above other content */
  display: none; /* Hidden by default */
}

.port-suggestions-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.port-suggestions-list li {
  padding: 10px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.port-suggestions-list li:hover {
  background-color: var(--light-gray);
}


.port-suggestions-list li.suggestion-active {
  background-color: var(--medium-gray);
  color: var(--secondary-color);
}


.quote-cart-toggle {
  position: absolute;
  top: 50%;
  left: -40px; 
  transform: translateY(-50%); /* Center it vertically */
  width: 40px;
  height: 120px; /* Make it taller */
  background-color: var(--primary-color);
  color: var(--white);
  display: flex;
  flex-direction: column; /* Stack icon and text vertically */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px 0 0 8px; /* Slightly rounder corners */
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 990;
  transition: background-color 0.2s;
}

.quote-cart-toggle:hover {
  background-color: #c42228; /* Slightly darker red on hover */
}

.quote-toggle-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
}

.quote-toggle-icon svg {
  width: 100%;
  height: 100%;
}

.quote-toggle-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl; /* This makes the text vertical */
  text-orientation: mixed;
}

/* When cart is open, change the icon to a close (X) icon */
.quote-cart.open .quote-cart-toggle .quote-toggle-icon svg {
  display: none; /* Hide the clipboard icon */
}

.quote-cart.open .quote-cart-toggle .quote-toggle-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: center;
}