/* Quote Request System Styles */

/* Popup Styles */
.quote-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quote-popup {
  background: #fff;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.quote-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.quote-popup-header h3 {
  margin: 0;
  color: #333;
}

.quote-popup-close {
  font-size: 24px;
  cursor: pointer;
  color: #999;
  transition: color 0.3s;
}

.quote-popup-close:hover {
  color: #333;
}

.quote-popup-content {
  padding: 20px;
}

.product-info {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.product-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 15px;
}

.product-details h4 {
  margin: 0 0 10px 0;
  color: #333;
}

.product-details p {
  margin: 5px 0;
  color: #666;
}

/* Form Styles */
.quote-form .form-row,
#final-quote-form .form-row {
  margin-bottom: 15px;
}

.quote-form label,
#final-quote-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
  font-size: 0.8em;
}

.quote-form input[type="number"],
.quote-form input[type="text"],
.quote-form input[type="email"],
.quote-form textarea,
#final-quote-form input[type="number"],
#final-quote-form input[type="text"],
#final-quote-form input[type="email"],
#final-quote-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.quote-form .field-hint,
#final-quote-form .field-hint {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
  line-height: 18px;
  display: inline-block;
  margin-top: 6px;
}

.quote-form input:focus,
.quote-form textarea:focus,
#final-quote-form input:focus,
#final-quote-form textarea:focus {
  border-color: #0073aa;
  outline: none;
  box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.form-row-inline {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.form-col {
  flex: 1;
}

.form-col:first-child {
  flex: 2;
}

/* Radio button styles */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 5px;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal !important;
  margin-bottom: 0 !important;
}

.radio-label input[type="radio"] {
  width: auto !important;
  margin-right: 8px;
  margin-bottom: 0;
}

.radio-label span {
  font-size: 14px;
  color: #333;
}

/* Button Styles */
.quote-request-btn,
.add-to-quote-btn,
.update-table-btn,
.submit-quote-btn {
  background: #0073aa;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.quote-request-btn:hover,
.add-to-quote-btn:hover,
.update-table-btn:hover,
.submit-quote-btn:hover {
  background: #005a87;
}

.add-to-quote-btn {
  width: 100%;
  margin-top: 10px;
}

.remove-item-btn {
  background: #dc3232;
  color: white;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.remove-item-btn:hover {
  background: #a00;
}

/* Table Styles */
.quote-table-wrapper {
  margin-bottom: 30px;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.quote-table th,
.quote-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.quote-table th {
  background: #f9f9f9;
  font-weight: bold;
}

.product-image-cell {
  width: 80px;
}

.product-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.editable-field {
  width: 100%;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.table-actions {
  text-align: right;
}

/* Final Form Styles */
.quote-final-form {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 4px;
  margin-top: 30px;
}

.quote-final-form h3 {
  margin-top: 0;
  color: #333;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 8px;
}

/* Message Styles */
.quote-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px;
  border-radius: 4px;
  color: white;
  z-index: 10000;
  max-width: 300px;
}

.quote-message.success {
  background: #46b450;
}

.quote-message.error {
  background: #dc3232;
}

.quote-success-message {
  text-align: center;
  padding: 40px;
  background: #f0f8f0;
  border: 2px solid #46b450;
  border-radius: 8px;
}

.quote-success-message h3 {
  color: #2e7d32;
  margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .quote-popup {
    width: 95%;
    margin: 20px;
  }

  .product-info {
    flex-direction: column;
    text-align: center;
  }

  .product-image {
    margin-right: 0;
    margin-bottom: 15px;
  }

  .quote-table {
    font-size: 12px;
  }

  .quote-table th,
  .quote-table td {
    padding: 8px 4px;
  }

  .product-thumb {
    width: 40px;
    height: 40px;
  }

  .editable-field {
    font-size: 12px;
    padding: 3px;
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .form-row-inline {
    flex-direction: column;
    gap: 15px;
  }

  .radio-group {
    flex-direction: row;
    gap: 15px;
  }
}

/* Quick Add Widget Styles */
.quick-add-widget {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.quick-add-widget h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #495057;
  font-size: 18px;
}

.widget-form .form-row {
  margin-bottom: 15px;
}

.widget-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #495057;
  font-size: 18px;
  line-height: 22px;
}

.widget-form .field-hint {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.6);
  line-height: 18px;
  display: inline-block;
  margin-top: 6px;
  font-style: italic;
}

.widget-form select,
.widget-form input[type="text"],
.widget-form input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

.widget-form select:focus,
.widget-form input:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: #f0f8ff;
  border: 1px solid #d0e8ff;
  border-radius: 6px;
  font-size: 14px;
  color: #007cba;
  font-weight: 500;
  margin-top: 10px;
}

.loading-spinner .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #d0e8ff;
  border-top: 3px solid #007cba;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner .text {
  color: #007cba;
  font-weight: 500;
}

.loading-spinner.hidden {
  display: none;
}

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

.widget-message {
  padding: 10px 15px;
  border-radius: 4px;
  margin-top: 15px;
  font-weight: 500;
}

.widget-message.success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.widget-message.error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.form-row-inline {
  display: flex;
  gap: 15px;
}

.form-col {
  flex: 1;
}

.radio-group {
  display: flex;
  gap: 15px;
  margin-top: 5px;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal;
}

.radio-label input[type="radio"] {
  width: auto;
  margin-right: 5px;
}

#confirm-widget-add {
  background: #007cba;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-top: 15px;
  transition: background-color 0.2s;
}

#confirm-widget-add:hover:not(:disabled) {
  background: #005a87;
}

#confirm-widget-add:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
  .form-row-inline {
    flex-direction: column;
    gap: 10px;
  }

  .radio-group {
    flex-direction: column;
    gap: 10px;
  }
}

/* Inline Group Layout - Single Row */
/* Inline Group Layout - Bootstrap-like Grid */
.widget-row-group {
  display: flex;
  flex-flow: row nowrap;
  margin-left: -5px;
  margin-right: -5px;
  width: calc(100% + 10px);
  margin-bottom: 20px;
  align-items: flex-start;
}

.widget-field-wrapper {
  display: contents;
}

.widget-row-group .form-row,
.widget-row-group .loading-spinner {
  flex: 0 0 25%;
  max-width: 25%;
  padding-left: 5px;
  padding-right: 5px;
  margin-bottom: 0 !important;
  box-sizing: border-box;
}

/* Adjust spinner in row */
.widget-row-group .loading-spinner {
  margin-top: 27px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 10px 5px; /* Keep horizontal padding for gutter */
}

/* Specific fix for radio group in narrow columns */
.widget-row-group .radio-group {
  margin-top: 0;
}

.widget-row-group .radio-label {
  white-space: normal; /* Allow wrapping */
}

.widget-row-group .radio-label span {
  font-size: 11px; /* Smaller text for options on mobile */
  line-height: 1.2;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
  .widget-row-group .form-row label {
    font-size: 10px; /* Even smaller labels */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .widget-row-group select,
  .widget-row-group input {
    padding: 4px; /* Very compact padding */
    font-size: 11px;
    height: 28px; /* Fixed height to align */
  }

  .widget-row-group .loading-spinner {
    margin-top: 20px;
  }

  .widget-row-group .loading-spinner .text {
    display: none; /* Hide loading text on mobile */
  }
}
