/* RFQ Form Enhancements (rfq-from-styles)
   Purpose: Complete RFQ form styling - Single Source of Truth
   Scope: All RFQ form styling consolidated here. No dependencies on other CSS files.
*/

:root {
  /* Align with RFQ form RGB(0,0,102) theme */
  --copilot-primary-blue: rgb(0,0,102);
  --copilot-primary-green: #006600;
  --copilot-alt-green: rgb(0,102,0);
  --copilot-luminous-green: rgb(204,255,204);
  --copilot-white: #ffffff;
  --copilot-dark: #1e293b;
  --copilot-gray-50: #f8fafc;
  --copilot-gray-100: #f1f5f9;
  --copilot-gray-200: #e2e8f0;
  --copilot-gray-300: #cbd5e1;
  --copilot-gray-400: #94a3b8;
  --copilot-shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --copilot-shadow-md: 0 4px 10px rgba(0,0,0,0.08);
  --copilot-radius: 10px;
  --copilot-btn-h: 42px;
  
  /* Additional colors for comprehensive styling */
  --copilot-danger: #dc2626;
  --copilot-warning: #f59e0b;
  --copilot-info: #06b6d4;
  --copilot-success: #10b981;
}

/* Base typography and global styles */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--copilot-dark);
}

/* Comprehensive Form Control Styles - Base Layer */
.form-control {
  border: 1px solid var(--copilot-gray-300);
  border-radius: 6px;
  padding: 0.625rem 1rem;
  background-color: var(--copilot-gray-50);
  color: var(--copilot-dark);
  font-size: 0.875rem;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-control:hover {
  border-color: var(--copilot-gray-400);
  background-color: var(--copilot-white);
}

.form-control:focus {
  border-color: var(--copilot-primary-blue);
  background-color: var(--copilot-white);
  box-shadow: 0 0 0 3px rgba(0, 0, 102, 0.1);
  outline: none;
}

/* Select field comprehensive styling */
select.form-control,
select.form-control option {
  color: var(--copilot-dark);
  background-color: var(--copilot-white);
}

select.form-control:focus {
  background-color: var(--copilot-white);
  border-color: var(--copilot-primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 0, 102, 0.1);
  color: var(--copilot-dark);
}

/* Transaction type select specific styling */
select#transaction-type.form-control {
  height: 38px;
  padding: 0.375rem 0.75rem;
  font-size: 12px !important; /* Override inline style */
  line-height: 1.5;
  border-radius: 6px;
  background-color: var(--copilot-white);
  border: 1px solid var(--copilot-gray-300);
  appearance: auto;
}

/* Creation date input styling */
#creation-date.form-control {
  font-size: 12px !important;
}

/* Labels - All form labels consolidated styling */
label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--copilot-dark);
  margin-bottom: 0.5rem;
  display: block;
}

/* RFQ Form specific labels - 12px font size for all form labels */
#rfq-form label,
#rfq-form .form-group label {
  font-size: 12px !important;
}

/* Specific form field labels */
label[for="creation-date"],
label[for="transaction-type"], 
label[for="service-type"],
label[for="additional-info"],
label[for="main-attachments-input"] {
  font-size: 12px !important;
}

/* Textarea styling */
textarea.form-control {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

/* Form Container - Improved Stability */
#rfq-form.rfq-form {
  max-width: 1400px;
  margin: 0.5rem auto 1.5rem auto;
  background: var(--copilot-white);
  border: 1px solid var(--copilot-gray-200);
  border-radius: var(--copilot-radius);
  box-shadow: var(--copilot-shadow-md);
  padding: 2rem !important;
  overflow: hidden;
}

/* Form Container Responsive */
@media (max-width: 1200px) {
  #rfq-form.rfq-form {
    margin: 0.25rem;
    padding: 1.5rem !important;
  }
}

@media (max-width: 768px) {
  #rfq-form.rfq-form {
    margin: 0.125rem;
    padding: 1rem !important;
  }
}

/* General Form Improvements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Improved Button Styling */
.btn-standard {
  border: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.btn-standard:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-standard:active {
  transform: translateY(0);
}

/* Remove problematic CSS rules that cause layout conflicts */
#rfq-form .form-container > .row {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

#rfq-form .form-container > .row:last-of-type {
  margin-bottom: 0 !important;
}

/* Clean up service type styling conflicts */
#rfq-form #service-type.form-control {
  height: auto !important;
  line-height: normal !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 14px !important;
  vertical-align: middle !important;
  border-radius: 4px !important;
}

/* Clean up conflicting service type styles */
#rfq-form #add-service-type-btn {
  height: 38px !important;
  width: auto !important;
  padding: 0 12px !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgb(0,102,0) !important;
  color: white !important;
  border: 1px solid rgb(0,102,0) !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  position: relative !important;
  z-index: 1 !important;
  transition: all 0.2s ease !important;
}

/* Clean up additional info styling */
#additional-info.form-control {
  width: 100% !important;
  min-height: 80px !important;
  padding: 0.5rem !important;
  margin: 0 !important;
  border-radius: 4px !important;
  border: 1px solid var(--copilot-gray-300) !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  resize: vertical !important;
}

/* Consistent inputs */
#rfq-form .form-control {
  background: var(--copilot-gray-50);
  border: 1px solid var(--copilot-gray-300);
}
#rfq-form .form-control:focus {
  background: #fff;
  border-color: var(--copilot-primary-blue);
  box-shadow: 0 0 0 3px rgba(0,0,102,0.12);
}

/* Header fields compact alignment */
#rfq-form .row .form-group label {
  color: var(--copilot-primary-blue);
  font-weight: 600;
}

/* RFQ Action Bar - Improved Responsive Layout */
.rfq-action-bar {
  background: var(--copilot-gray-50);
  border: 1px solid var(--copilot-gray-200);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.rfq-action-bar.d-flex {
  gap: 1rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.rfq-action-bar .btn {
  min-width: 160px;
  height: 42px;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.rfq-action-bar .btn i {
  font-size: 14px;
}

/* Responsive Action Bar */
@media (max-width: 768px) {
  .rfq-action-bar {
    padding: 1rem;
  }

  .rfq-action-bar.d-flex {
    gap: 0.75rem;
  }

  .rfq-action-bar .btn {
    min-width: 140px;
    height: 38px;
    font-size: 13px;
  }
}

@media (max-width: 576px) {
  .rfq-action-bar.d-flex {
    flex-direction: column;
    align-items: stretch;
  }

  .rfq-action-bar .btn {
    min-width: auto;
    width: 100%;
  }
}

/* Smart paste button specific styling */
.btn-smart-paste {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
  border-color: #138496 !important;
  box-shadow: 0 2px 4px rgba(23, 162, 184, 0.2) !important;
}

.btn-smart-paste:hover {
  background: linear-gradient(135deg, #138496 0%, #117a8b 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3) !important;
}

/* Copy again button styling */
.btn-copy-again {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%) !important;
  border-color: #5a6268 !important;
}

.btn-copy-again:hover {
  background: linear-gradient(135deg, #5a6268 0%, #495057 100%) !important;
  transform: translateY(-1px);
}
#rfq-form .btn-standard {
  height: var(--copilot-btn-h);
  min-width: 180px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--copilot-primary-green) !important;
  color: #fff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: var(--copilot-shadow-sm);
}
#rfq-form .btn-standard.btn-success {
  background: var(--copilot-luminous-green) !important;
  color: #fff !important;
}
#rfq-form .btn-standard.btn-info {
  background: var(--copilot-primary-green) !important;
}
#rfq-form .btn-standard:hover { filter: brightness(1.05); }

/* Import tools alignment stable */
#rfq-form .import-tools-container {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap !important;
  justify-content: flex-end;
}
#rfq-form .import-tools-container .btn { min-width: 180px; height: var(--copilot-btn-h); }

/* Service Type Container - Fixed Overlap Issues */
.service-type-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  overflow: visible !important;
}

.service-type-container .form-control {
  width: 100% !important;
  min-width: 0 !important;
  margin-bottom: 0 !important;
}

.service-type-container .btn {
  width: auto !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  height: 38px !important;
  padding: 0 12px !important;
}

/* Override any conflicting service type button styles */
#rfq-form #add-service-type-btn,
#rfq-form .service-type-container .btn,
.service-type-container #add-service-type-btn {
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgb(0,102,0) !important;
  color: white !important;
  border: 1px solid rgb(0,102,0) !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

#rfq-form #add-service-type-btn:hover,
.service-type-container #add-service-type-btn:hover {
  background: rgb(0, 80, 0) !important;
  border-color: rgb(0, 80, 0) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0,102,0,0.3) !important;
}

/* Remove old conflicting service type styles */
#rfq-form #service-type.form-control,
select#service-type.form-control {
  height: 38px !important;
  line-height: normal !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 14px !important;
  vertical-align: middle !important;
  border-radius: 4px !important;
  margin-bottom: 0 !important;
}

#rfq-form #service-type.form-control option,
select#service-type.form-control option {
  padding: 4px 8px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
}

/* Service type add button: match compact select height - Higher Specificity */
#rfq-form #add-service-type-btn,
button#add-service-type-btn {
  height: 38px !important; /* match select height */
  min-width: 40px !important; /* smaller button size */
  width: auto !important; /* auto width in container */
  flex-shrink: 0 !important; /* don't shrink */
  margin-left: 0 !important; /* no left margin */
  margin-top: 0 !important; /* no top margin */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgb(0,102,0) !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 12px !important; /* smaller icon size */
  position: relative !important;
  z-index: auto !important; /* remove high z-index to prevent overlap */
}

#add-service-type-btn:hover {
  filter: brightness(1.1) !important;
  transform: none !important;
}

/* Service type flex container: MUCH MORE spacing for clear visual separation */
#rfq-form .col-md-4 .d-flex:has(#service-type) {
  align-items: flex-start !important;
  gap: 6px !important; /* reduced gap */
  position: relative !important;
  z-index: 1 !important;
  overflow: visible !important;
  max-width: 100% !important; /* prevent container from expanding too much */
  margin-bottom: 1.5rem !important; /* Reasonable gap for clear separation from Additional Information */
}

/* Ensure proper spacing around service type with MAXIMUM visual separation */
#rfq-form .col-md-4:has(#service-type) {
  overflow: visible !important;
  position: relative !important;
  z-index: 1 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0.5rem !important; /* Slight margin for separation */
}

/* CRITICAL FIX: Additional Information excessive spacing removal */
.col-md-6 .form-group,
.col-md-6 .form-group label,
.col-md-6 .form-group #additional-info,
#additional-info.form-control,
textarea#additional-info,
textarea[name="details_description"] {
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

/* Force Additional Information container to normal spacing */
.col-md-6:has(#additional-info),
.col-md-6:has([name="details_description"]) {
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* Override any Bootstrap margin classes */
.col-md-4 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Additional Information: normalized styling */
#additional-info.form-control {
  max-width: 100%;
  width: 100% !important;
  min-height: 80px;
  line-height: 1.4;
  padding: 8px 12px !important;
  margin: 0 !important;
  border-radius: 6px;
  border: 1px solid var(--copilot-gray-300);
  font-size: 12px !important; /* Override inline style */
  resize: vertical !important;
}

/* Main attachments list styling */
#main-attachments-list {
  font-size: 10px !important;
}

/* Main attachment button styling */
#main-attachment-btn {
  min-width: 180px; 
  height: 35px !important; /* match other buttons */
  white-space: nowrap !important;
}

/* Additional Information field container: ensure minimal spacing */
.col-md-4:has(#additional-info) .form-group {
  margin-bottom: 0 !important;
  padding: 0 !important;
}

.col-md-4:has(#additional-info) {
  padding-left: 15px !important;
  padding-right: 15px !important;
}

/* Additional info container: ensure MAXIMUM spacing from service type with huge visual separation */
#rfq-form .row.mb-4:has(#additional-info) {
  margin-top: 1.5rem !important; /* Reasonable gap between Service Type and Additional Information */
  clear: both !important;
  position: relative !important;
  z-index: 0 !important; /* lower z-index than service type button */
}

/* RFQ Header Section - Improved Responsive Layout */
.rfq-header-section {
  background: var(--copilot-gray-50);
  border: 1px solid var(--copilot-gray-200);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.rfq-header-section .row {
  margin-bottom: 1rem;
}

.rfq-header-section .row:last-child {
  margin-bottom: 0;
}

/* Service Type Container - Improved Layout */
.service-type-container {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.service-type-container .form-control {
  flex: 1;
  min-width: 0;
}

.service-type-container .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Main Attachments Container */
.main-attachments-container .btn {
  width: 100%;
  justify-content: center;
}

.main-attachments-container .attached-files-list {
  max-height: 60px;
  overflow-y: auto;
  font-size: 11px;
}

/* Responsive Service Type Container */
@media (max-width: 768px) {
  .service-type-container {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .service-type-container .btn {
    align-self: flex-start !important;
    width: auto !important;
    min-width: 100px !important;
  }
}

@media (max-width: 576px) {
  .service-type-container .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* UOM select inside table: slightly wider than column to improve readability but not break layout */
#rfq-table select[name="uom[]"] {
  min-width: 130px !important; /* was 120 */
  width: 100%;
  font-size: 12px !important;
}

/* RFQ Table - Improved Responsive Design */
#rfq-table.rfq-table {
  table-layout: auto !important; /* Changed from fixed to auto for better content adaptation */
  width: 100%;
  border: 1px solid var(--copilot-gray-200);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

#rfq-table thead th {
  background: var(--copilot-primary-blue) !important;
  color: #fff !important;
  text-transform: none !important;
  vertical-align: middle !important;
  padding: 0.75rem 0.5rem !important;
  font-size: 12px !important;
  font-weight: 600;
  text-align: left !important;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

#rfq-table td {
  vertical-align: top !important;
  padding: 0.75rem 0.5rem !important;
  border-bottom: 1px solid var(--copilot-gray-200);
}

/* Improved Column Widths - More Flexible */
#rfq-table th:nth-child(1),
#rfq-table td:nth-child(1) { min-width: 80px; width: 8%; } /* Item No */

#rfq-table th:nth-child(2),
#rfq-table td:nth-child(2) { min-width: 200px; width: 25%; } /* Description */

#rfq-table th:nth-child(3),
#rfq-table td:nth-child(3) { min-width: 100px; width: 12%; } /* Quantity */

#rfq-table th:nth-child(4),
#rfq-table td:nth-child(4) { min-width: 120px; width: 10%; } /* UOM */

#rfq-table th:nth-child(5),
#rfq-table td:nth-child(5) { min-width: 150px; width: 20%; } /* Vendors */

#rfq-table th:nth-child(6),
#rfq-table td:nth-child(6) { min-width: 80px; width: 8%; } /* Urgency */

#rfq-table th:nth-child(7),
#rfq-table td:nth-child(7) { min-width: 180px; width: 17%; } /* Actions */

/* Responsive Table */
@media (max-width: 1200px) {
  #rfq-table th:nth-child(2),
  #rfq-table td:nth-child(2) { width: 20%; }

  #rfq-table th:nth-child(5),
  #rfq-table td:nth-child(5) { width: 18%; }

  #rfq-table th:nth-child(7),
  #rfq-table td:nth-child(7) { width: 15%; }
}

@media (max-width: 768px) {
  #rfq-table {
    font-size: 11px;
  }

  #rfq-table th,
  #rfq-table td {
    padding: 0.5rem 0.25rem !important;
  }

  #rfq-table th:nth-child(1),
  #rfq-table td:nth-child(1) { width: 60px; }

  #rfq-table th:nth-child(2),
  #rfq-table td:nth-child(2) { width: 150px; }

  #rfq-table th:nth-child(7),
  #rfq-table td:nth-child(7) { width: 140px; }
}

/* Action Buttons Container - Improved Layout */
#rfq-table td:last-child {
  text-align: center;
  white-space: nowrap;
}

#rfq-table .btn-group {
  display: flex !important;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

#rfq-table .btn-group .btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

#rfq-table .btn-group .btn i {
  font-size: 11px;
}

/* Mobile: Stack action buttons vertically */
@media (max-width: 576px) {
  #rfq-table .btn-group {
    flex-direction: column;
    gap: 2px;
  }

  #rfq-table .btn-group .btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
}

/* Vendor list: stable height with scroll, avoid pushing layout */
#rfq-table .vendor-list {
  max-height: 80px;
  overflow-y: auto;
  background: var(--copilot-gray-50);
  border: 1px solid var(--copilot-gray-200);
  border-radius: 6px;
  padding: 6px;
}
.vendor-badge { white-space: nowrap; }

/* Form controls within table - consistent sizing */
#rfq-table .form-control {
  width: 100% !important;
  min-height: auto !important;
  font-size: 12px !important;
  border: 1px solid var(--copilot-gray-300) !important;
  border-radius: 4px !important;
}

#rfq-table textarea.form-control {
  min-height: 4em !important;
  resize: vertical !important;
}

#rfq-table input[type="number"].form-control,
#rfq-table input[type="text"].form-control {
  height: 38px !important;
  line-height: 1.5 !important;
}

#rfq-table select.form-control {
  height: 38px !important;
  line-height: 1.5 !important;
}

/* Prevent flex wrapping only in critical areas on zoom */
#rfq-form .form-group.row .text-center.d-flex.justify-content-around { flex-wrap: nowrap; }
#rfq-form .import-tools-container { flex-wrap: nowrap; }
#rfq-form .attached-files-list { overflow: hidden; text-overflow: ellipsis; }

/* Modals: unified RGB(0,0,102) theme for all modals */
#rfq-form .modal-header,
.modal-header {
  background-color: rgb(0,0,102) !important;
  color: #fff !important;
}
#rfq-form .modal-title,
.modal-title {
  color: #fff !important;
}
#rfq-form .modal-header .close,
.modal-header .close {
  color: #fff !important;
  opacity: 0.8;
}
#rfq-form .modal-header .close:hover,
.modal-header .close:hover {
  color: #fff !important;
  opacity: 1;
}

/* Keep DataTables header/body aligned on zoom */
.dataTables_wrapper .dataTables_scrollHeadInner,
.dataTables_wrapper .dataTables_scrollHeadInner table { width: 100% !important; }

/* Ensure select UOM visibility and size stability */
#rfq-table select[name="uom[]"] {
  height: 38px !important;
  min-width: 120px !important;
  background: #fff !important;
  border: 1px solid var(--copilot-gray-300) !important;
  font-size: 12px !important;
  padding: 6px !important;
}

/* DataTables specific overrides to maintain column alignment */
.dataTables_wrapper {
  width: 100% !important;
}

.dataTables_wrapper .dataTable {
  table-layout: fixed !important;
  width: 100% !important;
}

.dataTables_wrapper .dataTable thead th,
.dataTables_wrapper .dataTable tbody td {
  box-sizing: border-box !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Force consistent table rendering */
#rfq-table.dataTable {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#rfq-table.dataTable thead th {
  border-bottom: 2px solid var(--copilot-primary-blue) !important;
  position: relative !important;
}

#rfq-table.dataTable tbody td {
  border-bottom: 1px solid var(--copilot-gray-200) !important;
}

/* Prevent DataTables from overriding our column widths */
#rfq-table.dataTable.no-footer {
  border-bottom: none !important;
}

/* DataTables header alignment fixes */
.dataTables_scrollHead,
.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
  width: 100% !important;
  table-layout: fixed !important;
}

/* Disable DataTables sorting icons that might interfere with alignment */
#rfq-table.dataTable thead th.sorting,
#rfq-table.dataTable thead th.sorting_asc,
#rfq-table.dataTable thead th.sorting_desc {
  background-image: none !important;
}

/* Ensure DataTables doesn't add extra padding/margins */
#rfq-table.dataTable thead th,
#rfq-table.dataTable tbody td {
  padding: 0.5rem !important;
}

/* Specific fixes for alignment issues */
#rfq-table th:first-child,
#rfq-table td:first-child {
  text-align: center !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

#rfq-table th:last-child,
#rfq-table td:last-child {
  text-align: center !important;
  white-space: nowrap !important;
}

/* Urgency checkbox and label stability */
#rfq-table .urgency-checkbox + label { display: inline-block; vertical-align: middle; }

/* Ensure main attachment button doesn’t jump */
/* Ensure main attachment button doesn't jump */
#main-attachment-btn { min-width: 180px; height: var(--copilot-btn-h); }

/* RFQ Action bar styling */
.rfq-action-bar {
  gap: 12px !important;
  flex-wrap: wrap !important;
}

/* Smart Paste and Repeat Last buttons in action bar */
.rfq-action-bar .btn-smart-paste,
.rfq-action-bar .btn-copy-again {
  height: var(--copilot-btn-h) !important;
  margin: 0 !important; /* Remove margin since parent has gap */
}

/* Ensure action bar buttons maintain consistent styling */
.rfq-action-bar .btn-smart-paste {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
  border-color: #138496 !important;
  color: white !important;
}

.rfq-action-bar .btn-copy-again {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%) !important;
  border-color: #5a6268 !important;
  color: white !important;
}

/* Submit spinner */
#submit-spinner {
  display: none;
}

/* Modal dialog sizing */
.modal-dialog {
  max-width: 700px !important;
  min-width: 600px !important;
}

/* Service Type Management table styling */
.table-responsive {
  max-height: 400px !important;
  overflow-y: auto !important;
}

#service-types-table th {
  font-size: 0.85rem;
}

#service-types-table th[data-width="50"] {
  width: 50% !important;
}

#service-types-table th[data-width="25"] {
  width: 25% !important;
}

/* JavaScript generated table rows */
.js-table-row {
  vertical-align: top !important;
}

.js-table-row td {
  min-height: 6em !important;
  vertical-align: top !important;
}

.js-table-row td[data-min-width="320"] {
  min-width: 320px !important;
}

.js-table-row textarea {
  min-height: 6em !important;
}

/* Prevent zoom-induced layout shifts by avoiding font scaling-based wraps */
#rfq-form, #rfq-form * { box-sizing: border-box; }

/* Allow horizontal scrolling instead of wrapping when space is tight */
#rfq-form .form-container { overflow-x: auto; }
#rfq-form .table-responsive, #rfq-form .dataTables_scrollBody { overflow-x: auto !important; }

/* Responsive fixes for service type section with compact field height */
@media (max-width: 768px) {
  #rfq-form .col-md-4 .d-flex:has(#service-type) {
    flex-direction: column !important;
    align-items: stretch !important;
    margin-bottom: 5rem !important; /* even more spacing on mobile for better separation */
  }
  
  #add-service-type-btn {
    margin-left: 0 !important;
    margin-top: 8px !important;
    width: 100% !important;
    max-width: 200px !important;
    height: 35px !important; /* maintain compact height on mobile */
  }
  
  #service-type.form-control {
    max-width: none !important;
    width: 100% !important;
    height: 26px !important; /* maintain compact height on mobile - 25% smaller */
  }
}

/* =============================
   Attachments UI (modern, stable)
   ============================= */
#rfq-form .upload-area {
  background: var(--copilot-gray-50);
  border: 1px solid var(--copilot-gray-200);
  border-radius: 10px;
}

#rfq-form .file-drop-zone {
  border: 2px dashed var(--copilot-gray-300);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#rfq-form .file-drop-zone:hover {
  border-color: var(--copilot-primary-blue);
  box-shadow: 0 0 0 3px rgba(0,0,102,0.06);
}

#rfq-form #main-uploaded-files-list,
#rfq-form #uploaded-files-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

#rfq-form #main-uploaded-files-list .file-item,
#rfq-form #uploaded-files-list .file-item {
  border: 1px solid var(--copilot-gray-200);
  border-radius: 8px;
  padding: 10px;
  background: var(--copilot-white);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--copilot-shadow-sm);
}

#rfq-form .file-item .file-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#rfq-form .file-item .btn {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 6px;
}

#rfq-form .file-item .btn i { margin-right: 6px; }

#rfq-form .view-file-btn { background: #06b6d4; color: #fff; }
#rfq-form .download-file-btn { background: #10b981; color: #fff; }
#rfq-form .remove-main-file,
#rfq-form .remove-file-btn { background: #ef4444; color: #fff; }

/* Inline attachments next to main button (if populated) */
#rfq-form #main-attachments-list {
  display: inline-flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  max-width: 50%;
  overflow: hidden;
}

#rfq-form #main-attachments-list .attached-file {
  background: var(--copilot-gray-100);
  border: 1px solid var(--copilot-gray-200);
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#rfq-form #main-attachments-list .attached-file .remove-attachment {
  background: transparent;
  border: none;
  color: #ef4444;
}

#rfq-form .modal-footer .btn {
  min-width: 120px;
  height: 38px;
}

/* Row-level attachments list (inside table) */
#rfq-table .attached-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 90px;
  overflow: auto;
  padding: 6px 0;
}

#rfq-table .attached-files-list .attached-file {
  background: var(--copilot-gray-100);
  border: 1px solid var(--copilot-gray-200);
  border-radius: 9999px;
  padding: 3px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

#rfq-table .attached-files-list .remove-attachment {
  background: transparent;
  border: none;
  color: #ef4444;
}

/* =============================
   Sticky toolbar and table focus
   ============================= */
.rfq-toolbar {
  position: sticky;
  top: 0; /* under header */
  z-index: 20;
  background: #fff;
  padding: 10px 0;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--copilot-gray-200);
}
.rfq-toolbar .btn-standard { min-width: 160px; height: 38px; }
.rfq-toolbar .copy-db-btn { min-width: 180px; height: 38px; }

/* Description cell: show 4 lines by default, allow expand */
#rfq-table tbody td:nth-child(2) textarea.form-control {
  min-height: calc(1.2em * 4 + 10px);
  max-height: 200px;
  resize: vertical;
  line-height: 1.2em;
}

/* Keep submission area below, not sticky */
#submit-all { position: static; }

/* Utility: wide action buttons for consistent sizing */
.btn-wide {
  min-width: 180px;
}

/* Vendor remove button inside badge (replaces inline styles) */
.vendor-badge .remove-vendor-btn {
  font-size: 0.5rem;
  padding: 0.05rem 0.2rem;
  width: auto;
  line-height: 1;
}

/* Ensure dynamic button containers after table align consistently */
#rfq-table + .d-flex.mt-2 .btn {
  margin-right: 0.5rem;
}
#rfq-table + .d-flex.mt-2 .btn:last-child {
  margin-right: 0;
}

/* Inline upload spinner block injected by JS */
#upload-spinner.rfq-upload-spinner {
  display: none;
  margin-top: 8px;
  color: var(--copilot-dark);
}
#upload-spinner .fa-spin { margin-right: 6px; }

/* Toasts/notifications injected by showNotification() */
.rfq-toast {
  top: 20px;
  right: 20px;
  z-index: 1060;
  min-width: 300px;
}

/* Smart paste notification styling */
.smart-paste-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border: 2px solid #17a2b8;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(23, 162, 184, 0.2);
  z-index: 1070;
  animation: smartPulse 2s ease-in-out infinite;
  min-width: 300px;
  text-align: center;
}

@keyframes smartPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(23, 162, 184, 0.2); }
  50% { box-shadow: 0 8px 32px rgba(23, 162, 184, 0.4); }
}

/* Ripple effect for dynamic buttons (Excel paste UI) */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 600ms linear;
  background-color: rgba(0,0,0,0.2);
  pointer-events: none;
}
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Paste notification overlay */
.paste-notification {
  border-radius: 8px;
}
.rfq-center-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 20px;
  background: rgba(0, 51, 102, 0.9);
  color: #fff;
  z-index: 1000;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
  transition: all 0.3s ease;
}

/* =============================================================
   MIGRATED STYLES (from rfq-form.css) - Single Source of Truth
   - Unified navy button scheme (except submit green)
   - Enhanced vendor badges with multi-line clamp & remove button
   - Option 5 NDA vs TEMP access indicators
   ============================================================= */

/* Unified button scheme */
#rfq-form .btn-copy-add-item {
  background: var(--copilot-luminous-green) !important;
  color: #fff !important;
  border: none !important;
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--copilot-btn-h);
  min-width: 180px;
  padding: 0 18px;
  border-radius: 8px;
  text-transform: none;
  transition: all .18s ease;
  box-shadow: var(--copilot-shadow-sm);
}
#rfq-form .btn-alt-green {
  background: var(--copilot-alt-green) !important;
  color: #fff !important;
  border: none !important;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--copilot-btn-h);
  min-height: var(--copilot-btn-h);
  padding: 0 16px;
  border-radius: 8px;
  text-transform: none;
  transition: all .18s ease;
  box-shadow: var(--copilot-shadow-sm);
}
#rfq-form .btn,
#rfq-form .btn-action,
#rfq-form .rfq-action-bar .btn,
.nav button,
.menad button {
  background: rgb(0,102,0) !important;
  color: #fff !important;
  border: none !important;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--copilot-btn-h);
  min-height: var(--copilot-btn-h);
  padding: 0 16px;
  border-radius: 8px;
  text-transform: none;
  transition: all .18s ease;
  box-shadow: var(--copilot-shadow-sm);
}
#rfq-table .remove-item-btn,
#rfq-table .copy-item-btn,
#rfq-table .attach-file-btn,
#rfq-table .select-vendor-btn {
  background: unset !important;
}
#rfq-table .select-vendor-btn { background: #10b981 !important; color: #fff !important; }
#rfq-table .remove-item-btn { background: #d32f2f !important; color: #fff !important; }
#rfq-table .copy-item-btn { background: #1976d2 !important; color: #fff !important; }
#rfq-table .attach-file-btn { background: #ffa726 !important; color: #fff !important; }
#rfq-form .btn:hover { filter: brightness(1.12); transform: translateY(-2px); }
#rfq-form .btn:active { transform: translateY(0); filter: brightness(1.0); }

/* Icon-only action buttons sizing (keep square) */
#rfq-form td:nth-child(7) .btn-group .btn,
#rfq-form .btn-action { width: 42px; min-width:42px; padding:0; }

/* Submit button green */
#rfq-form #submit-all {
  background: rgb(0, 176, 80) !important;
}
#rfq-form #submit-all:hover {
  filter: brightness(1.15);
}

/* Enhanced vendor badge */
#rfq-form .vendor-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--copilot-gray-100);
  border: 1px solid var(--copilot-gray-300);
  border-radius: 6px;
  padding: 4px 20px 4px 8px; /* space for remove X */
  margin: 2px;
  font-size: 11px;
  line-height: 1.15;
  max-width: 200px;
  min-width: 80px;
  overflow: hidden;
  gap: 4px;
  cursor: default;
}
#rfq-form .vendor-badge .vendor-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  max-height: 2.3em;
}
#rfq-form .vendor-badge.compact { max-width: 140px; }
#rfq-form .vendor-badge .remove-vendor {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  background: linear-gradient(145deg,#ef4444,#dc2626);
  border: none;
  color: #fff;
  width: 16px;
  height:16px;
  padding:0;
  line-height: 14px;
  text-align:center;
  font-size:11px;
  border-radius: 50%;
  cursor: pointer;
}
#rfq-form .vendor-badge .remove-vendor:hover { filter: brightness(1.15); }

/* Option 5 access type pills */
#rfq-form .vendor-badge.vendor-nda { border-color:#b45309; background:#fff7ed; }
#rfq-form .vendor-badge.vendor-temp { border-color:#0369a1; background:#f0f9ff; }
#rfq-form .vendor-badge .vendor-access {
  display:inline-block;
  font-size:9px;
  padding:2px 6px;
  line-height:1;
  border-radius:10px;
  font-weight:600;
  letter-spacing:.5px;
  white-space:nowrap;
  background:#64748b;
  color:#fff;
}
#rfq-form .vendor-badge .vendor-access.vendor-nda { background:#f59e0b; }
#rfq-form .vendor-badge .vendor-access.vendor-temp { background:#0ea5e9; }

/* Option source color variants (Option 1-4 + NDA/TEMP already handled) */
#rfq-form .vendor-badge.option1 { border-color:#2563eb; background:#eff6ff; }
#rfq-form .vendor-badge.option2 { border-color:#7c3aed; background:#f5f3ff; }
#rfq-form .vendor-badge.option3 { border-color:#059669; background:#ecfdf5; }
#rfq-form .vendor-badge.option4 { border-color:#1e40af; background:#dbeafe; color:#1e3a8a; } /* Changed from red to blue */
#rfq-form .vendor-badge.option4 .vendor-name { color:#1e3a8a; } /* Changed from red to blue */
#rfq-form .vendor-badge.option1 .vendor-access { background:#3b82f6; }
#rfq-form .vendor-badge.option2 .vendor-access { background:#8b5cf6; }
#rfq-form .vendor-badge.option3 .vendor-access { background:#10b981; }
#rfq-form .vendor-badge.option4 .vendor-access { background:#3b82f6; } /* Changed from pink to blue */

/* Attach paperclip badge alignment (row attachments) */
#rfq-form .attach-file-btn { position:relative; overflow:visible; }
#rfq-form .attach-file-btn .file-count-badge {
  position:absolute; top:-6px; right:-6px; font-size:10px; padding:2px 4px; line-height:1;
  border-radius:10px; background:#fff; color:#111; border:1px solid #ccc; box-shadow:0 0 0 1px rgba(0,0,0,0.05);
}

/* 2x2 action grid (if DataTables redraw modifies layout ensure sizes fixed) */
#rfq-form td:nth-child(7) .btn-group { display:grid !important; grid-template-columns:repeat(2,42px); grid-auto-rows:42px; gap:8px; justify-content:center; }
#rfq-form td:nth-child(7) .btn-group .btn { margin:0 !important; }

.rfq-center-notice.fade-out {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
}

/* Modal media default sizing */
.modal .pdf-viewer iframe,
.modal .document-viewer iframe {
  width: 100%;
  height: 500px;
  border: 0;
}
.modal .img-fluid { max-height: 500px; }

/* Form validation styles (used by JS error-field) */
.error-field {
  border: 2px solid #dc3545 !important;
  background-color: #fff !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15) !important;
}

/* ===== FINAL CRITICAL FIX: ADDITIONAL INFO SPACING ===== */
/* Override ALL possible spacing issues for Additional Information field */

/* Remove margin-bottom override for col-md-4 so gap can show between Service Type and Additional Information */
.form-container .row .col-md-4:not(:has(#service-type)) {
  margin-bottom: 0 !important;
}
.form-container .row .col-md-4:has(#service-type) {
  margin-bottom: 1.5rem !important;
}
.form-container .row .col-md-4 .form-group,
.form-container .row .col-md-4 .form-group label,
.form-container .row .col-md-6 #additional-info,
.form-container .row .col-md-6 textarea[name="details_description"],
#additional-info,
textarea[name="details_description"] {
  margin: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Specific Additional Information field styling - Enhanced for wider layout */
#additional-info.form-control,
textarea[name="details_description"].form-control {
  margin: 0 !important;
  padding: 12px 16px !important;
  border-radius: 6px !important;
  min-height: 90px !important;
  max-height: 250px !important;
  line-height: 1.5 !important;
  font-size: 0.9rem !important;
  width: 100% !important;
  resize: vertical !important;
}

/* Labels should have minimal spacing */
.form-container .row .col-md-6 .form-group label[for="additional-info"] {
  margin-bottom: 6px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

/* Force all header columns to have consistent spacing */
.form-container > .row.mb-4 > .col-md-2,
.form-container > .row.mb-4 > .col-md-6 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ===== ENHANCED SERVICE TYPE MANAGEMENT MODAL STYLES ===== */

/* Navigation menu styling - Following RFQ Overview reference */

.nav, .menad {
  background: rgb(0, 0, 102) !important;
  color: #ffffff !important;
  padding: 15px 20px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}
.nav h2 {
  color: #ffffff !important;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  padding: 0 15px;
  display: block;
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
}
.nav ul li {
  margin: 0;
}
.nav ul li a {
  color: #ffffff !important;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
}
.nav ul li a:hover,
.nav ul li.active a {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff !important;
  transform: translateY(-1px);
}

.nav a, .menad a {
  color: #fff;
  font-family: inherit;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
  font-size: inherit;
}

.nav a:hover, .menad a:hover, .nav a.active, .menad a.active {
  background: #38b2ac;
  color: #fff;
}

.menad {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menad button {
  background: rgb(0,0,102);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: inherit;
  padding: 0.5rem 1.2rem;
  margin-right: 0.5rem;
  transition: background 0.2s;
}

.menad button:hover {
  background: #2a4365;
}

/* All nav-tabs styling - Vendor Modal + Service Type Modal */
#vendorTabs.nav-tabs,
#serviceTypeTabs.nav-tabs,
.nav-tabs {
  border-bottom: 2px solid rgb(0,0,102);
  background: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

#vendorTabs .nav-link,
#serviceTypeTabs .nav-link,
.nav-tabs .nav-link {
  color: var(--copilot-gray-400);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-weight: 500;
  border-radius: 8px 8px 0 0;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

#vendorTabs .nav-link:hover,
#serviceTypeTabs .nav-link:hover,
.nav-tabs .nav-link:hover {
  border-color: var(--copilot-gray-300);
  color: rgb(0,0,102);
  background-color: rgba(0,0,102,0.1);
  text-decoration: none;
}

#vendorTabs .nav-link.active,
#serviceTypeTabs .nav-link.active,
.nav-tabs .nav-link.active {
  color: white !important;
  background-color: rgb(0,0,102) !important;
  border-bottom-color: rgb(0,0,102);
  font-weight: 600;
}

/* Ensure icons in nav-tabs are also white when active */
#vendorTabs .nav-link.active i,
#serviceTypeTabs .nav-link.active i,
.nav-tabs .nav-link.active i {
  color: white !important;
}

/* Service Type Management Modal */
#addServiceTypeModal .modal-lg {
  max-width: 800px;
}

/* Service Types Table */
#service-types-table {
  font-size: 0.9rem;
}

#service-types-table thead th {
  background-color: var(--copilot-gray-100);
  color: var(--copilot-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--copilot-gray-300);
  font-size: 0.85rem;
}

#service-types-table tbody tr {
  transition: all 0.2s ease;
}

#service-types-table tbody tr:hover {
  background-color: var(--copilot-gray-50);
}

/* Action buttons in table */
.edit-service-btn {
  color: var(--copilot-warning);
  border-color: var(--copilot-warning);
}

.edit-service-btn:hover {
  background-color: var(--copilot-warning);
  color: white;
}

.delete-service-btn {
  color: var(--copilot-danger);
  border-color: var(--copilot-danger);
}

.delete-service-btn:hover {
  background-color: var(--copilot-danger);
  color: white;
}

/* Modal styling - All modals use consistent RGB(0,0,102) theme */
#editServiceTypeModal .modal-header,
#deleteServiceTypeModal .modal-header,
#addServiceTypeModal .modal-header,
#vendorModal .modal-header,
#mainAttachmentModal .modal-header,
#fileUploadModal .modal-header,
#copyFromDbModal .modal-header {
  background-color: rgb(0,0,102) !important;
  color: white !important;
}

/* Service notification positioning */
.service-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 300px;
  box-shadow: var(--copilot-shadow-md);
  border-radius: var(--copilot-radius);
}

/* Modal content readability fixes */
#addServiceTypeModal .modal-body,
#editServiceTypeModal .modal-body,
#deleteServiceTypeModal .modal-body {
  background-color: white !important;
  color: var(--copilot-dark) !important;
}

#addServiceTypeModal .tab-content,
#editServiceTypeModal .tab-content,
#deleteServiceTypeModal .tab-content {
  background-color: white !important;
  color: var(--copilot-dark) !important;
}

/* Ensure table text is readable */
#service-types-table,
#service-types-table tbody,
#service-types-table tbody tr,
#service-types-table tbody td {
  background-color: white !important;
  color: var(--copilot-dark) !important;
}

/* Form labels and text */
#addServiceTypeModal label,
#editServiceTypeModal label,
#deleteServiceTypeModal label,
#addServiceTypeModal .form-text,
#editServiceTypeModal .form-text,
#deleteServiceTypeModal .form-text {
  color: var(--copilot-dark) !important;
}

/* Status badges */
.badge-success {
  background-color: var(--copilot-success);
}

/* Form enhancements in modals */
#addServiceTypeModal .form-control,
#editServiceTypeModal .form-control {
  border-radius: 6px;
  border: 1px solid var(--copilot-gray-300);
  padding: 0.75rem;
  font-size: 0.9rem;
}

#addServiceTypeModal .form-control:focus,
#editServiceTypeModal .form-control:focus {
  border-color: rgb(0,0,102);
  box-shadow: 0 0 0 3px rgba(0, 0, 102, 0.1);
}

/* Button enhancements - Follow RFQ form style and RGB(0,0,102) theme */
#addServiceTypeModal .btn,
#editServiceTypeModal .btn,
#deleteServiceTypeModal .btn,
#addServiceTypeModal #save-service-type-btn {
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 500;
  height: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  border: none !important;
  background-color: rgb(0,102,0) !important;
  color: white !important;
  text-decoration: none !important;
}

/* Primary buttons use RGB(0,0,102) - Higher specificity */
#addServiceTypeModal .btn.btn-success,
#addServiceTypeModal .btn.btn-primary,
#editServiceTypeModal .btn.btn-warning,
#deleteServiceTypeModal .btn.btn-danger,
#addServiceTypeModal button.btn-success,
#addServiceTypeModal button.btn-primary,
#editServiceTypeModal button.btn-warning,
#deleteServiceTypeModal button.btn-danger,
#save-service-type-btn,
#update-service-type-btn,
#confirm-delete-service-btn {
  background-color: rgb(0,102,0) !important;
  background-image: none !important;
  border-color: rgb(0,102,0) !important;
  color: white !important;
}

/* Secondary/cancel buttons - Higher specificity */
#addServiceTypeModal .btn.btn-secondary,
#editServiceTypeModal .btn.btn-secondary,
#deleteServiceTypeModal .btn.btn-secondary,
#addServiceTypeModal button.btn-secondary,
#editServiceTypeModal button.btn-secondary,
#deleteServiceTypeModal button.btn-secondary {
  background-color: #6c757d !important;
  background-image: none !important;
  border-color: #6c757d !important;
  color: white !important;
}

/* Button hover effects following RFQ form pattern */
#addServiceTypeModal .btn:hover,
#editServiceTypeModal .btn:hover,
#deleteServiceTypeModal .btn:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
  background-color: rgb(0,0,102) !important;
  color: white !important;
}

#addServiceTypeModal .btn:active,
#editServiceTypeModal .btn:active,
#deleteServiceTypeModal .btn:active {
  transform: translateY(0);
  filter: brightness(1.0);
  background-color: rgb(0,0,102) !important;
  color: white !important;
}

/* Override any Bootstrap gradients or backgrounds */
#addServiceTypeModal .btn:not(.btn-secondary),
#editServiceTypeModal .btn:not(.btn-secondary),
#deleteServiceTypeModal .btn:not(.btn-secondary) {
  background-image: none !important;
  background: rgb(0,102,0) !important;
}

#addServiceTypeModal .btn-secondary:hover,
#editServiceTypeModal .btn-secondary:hover,
#deleteServiceTypeModal .btn-secondary:hover {
  background-color: #5a6268 !important;
  background-image: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #addServiceTypeModal .modal-lg {
    max-width: 95%;
    margin: 1rem;
  }
  
  .service-notification {
    left: 10px;
    right: 10px;
    min-width: auto;
  }
}
.error-field:focus {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Row highlight animation for newly added/copied rows */
.highlight-new {
  background-color: var(--copilot-gray-100) !important;
  transition: background-color 2s ease-out;
}

#response_message .alert { margin: 10px 0; }

/* Final authoritative table header styling (prevents blue->white flash) */
#rfq-table thead th,
#rfq-table.dataTable thead th,
#rfq-table.dataTable thead th.sorting,
#rfq-table.dataTable thead th.sorting_asc,
#rfq-table.dataTable thead th.sorting_desc {
  background: var(--copilot-primary-blue) !important;
  color: #fff !important;
}

/* Removed scrollBody thead hiding rule (no internal scrolling structure now) */

/* Compact Choices.js dropdown for Service Type */
.compact-choices {
  font-size: 10px !important;
  min-height: 18px !important;
  height: 20px !important;
  max-height: 20px !important;
  padding: 0 4px !important;
  line-height: 1.1 !important;
}
.choices__inner.compact-choices {
  min-height: 20px !important;
  height: 20px !important;
  max-height: 20px !important;
  padding: 1px 4px !important;
}
.choices__list.compact-choices {
  padding: 2px 0 !important;
  max-height: calc(5 * 20px) !important;
  overflow-y: auto !important;
}
.choices__option.compact-choices {
  min-height: 18px !important;
  height: 18px !important;
  padding: 0 4px !important;
  font-size: 10px !important;
  line-height: 1.1 !important;
}
