/* =============================================================================
   Custom CSS for CDM Chatbot Admin - Purchases Module
   ============================================================================= */

/* =============================================================================
   CSS Custom Properties (Variables)
   ============================================================================= */

:root {
  --brand-primary: #022FA4;
  --brand-secondary: #17ff44;
  --border-color: #e3e6f0;
  --text-muted: #858796;
  --text-dark: #212529;
  --text-gray-600: #6c757d;
  --bg-light: #f8f9fa;
  --shadow-color: rgba(0, 0, 0, 0.15);
  --focus-border: #86b7fe;
  --focus-shadow: rgba(13, 110, 253, 0.25);
  --font-size-sm: 0.875rem;
  --font-size-xs: 0.75rem;
}

/* =============================================================================
   Brand Colors and Utilities
   ============================================================================= */

.bg-brand-primary {
  background-color: var(--brand-primary);
}

.bg-brand-secondary {
  background-color: var(--brand-secondary);
}

.text-brand-primary {
  color: var(--brand-primary);
}

.text-brand-secondary {
  color: var(--brand-secondary);
}

.border-left-brand-secondary {
  border-left: 0.25rem solid var(--brand-secondary) !important;
}

/* =============================================================================
   Button Overrides
   ============================================================================= */

.btn-primary {
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: #011f78;
  --bs-btn-hover-border-color: #011f78;
  --bs-btn-active-bg: #00174f;
  --bs-btn-active-border-color: #00174f;
}

/* =============================================================================
   Form and Modal Styling
   ============================================================================= */

.modal legend {
  font-size: 1rem;
  position: relative;
  top: -0.75rem;
  background-color: white;
}

.modal fieldset {
  padding-top: 0 !important;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* =============================================================================
   DataTable Controls
   ============================================================================= */

#dataTable_length, #dataTable_filter button {
  font-size: var(--font-size-sm);
}

#dataTable_length select {
  max-width: 80px;
}

#dataTable_length select option {
  text-align: center;
}

#dataTable_length label {
  margin-bottom: 0;
}

/* =============================================================================
   Receipt Image Container (Both Edit and View Modals)
   ============================================================================= */

.receipt-image-container {
  position: relative;
  overflow: hidden;
  border-radius: 0.375rem;
  cursor: zoom-in;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-image-container img {
  width: 100%;
  height: auto;
  display: block;
  transform-origin: center center;
  transition: transform 0.3s ease-out;
}

.receipt-image-container:hover img {
  transform: scale(2);
  cursor: move;
}

/* Image loading spinner positioning for both modals */

#edit-image-loading-spinner, #view-image-loading-spinner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* =============================================================================
   Participant Information Container
   ============================================================================= */

.purchase-info-container {
  position: relative;
  min-height: 60px;
}

/* =============================================================================
   Select2 Bootstrap 5 Integration
   ============================================================================= */

/* Base styling */

.select2-container--bootstrap-5 .select2-selection {
  border-color: var(--border-color) !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
  color: var(--text-muted) !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  color: var(--bs-body-color);
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Dropdown styling */

.select2-dropdown {
  border-color: var(--border-color) !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
  color: var(--bs-body-color) !important;
  border-color: var(--border-color) !important;
  font-size: var(--font-size-sm) !important;
}

.select2-results__option {
  font-size: var(--font-size-sm) !important;
}

/* Selection states */

.select2-results__option--selected {
  background-color: #e7f3ff !important;
  color: var(--text-dark) !important;
}

.select2-results__option--selected.select2-results__option--highlighted {
  background-color: #cce7ff !important;
  color: var(--text-dark) !important;
}

/* Remove validation styling - consolidated selectors */

.select2-container .is-valid ~ .select2-container--bootstrap-5 .select2-selection, .select2-container .is-invalid ~ .select2-container--bootstrap-5 .select2-selection, .select2-container--bootstrap-5 .select2-selection.is-valid, .select2-container--bootstrap-5 .select2-selection.is-invalid, #tax-identification-number.is-valid + .select2-container--bootstrap-5 .select2-selection, #tax-identification-number.is-invalid + .select2-container--bootstrap-5 .select2-selection {
  border-color: var(--border-color) !important;
  box-shadow: none !important;
}

/* Remove validation styling when focused */

.select2-container .is-valid ~ .select2-container--bootstrap-5.select2-container--focus .select2-selection, .select2-container .is-invalid ~ .select2-container--bootstrap-5.select2-container--focus .select2-selection, .select2-container--bootstrap-5.select2-container--focus .select2-selection.is-valid, .select2-container--bootstrap-5.select2-container--focus .select2-selection.is-invalid, #tax-identification-number.is-valid + .select2-container--bootstrap-5.select2-container--focus .select2-selection, #tax-identification-number.is-invalid + .select2-container--bootstrap-5.select2-container--focus .select2-selection {
  border-color: var(--focus-border) !important;
  box-shadow: 0 0 0 0.25rem var(--focus-shadow) !important;
}

/* =============================================================================
   Tooltip Custom Styling
   ============================================================================= */

.tooltip-small-text .tooltip-inner {
  font-size: var(--font-size-xs);
  line-height: 1.3;
  max-width: 200px;
}

.tooltip-small-text .tooltip-arrow {
  transform: scale(0.9);
}

/* =============================================================================
   View Modal Specific Styling (for Approved Purchases)
   ============================================================================= */

/* =============================================================================
   View Modal Items Table
   ============================================================================= */

/* Enhanced table styling for view modal */

#view-receipt-modal .table, #edit-receipt-items-table .table {
  margin-bottom: 0;
  font-size: var(--font-size-xs);
}

#view-receipt-modal .table th, #edit-receipt-items-table .table th {
  background-color: var(--bg-light);
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

#view-receipt-modal .table td, #edit-receipt-items-table .table td {
  vertical-align: middle;
  border-color: var(--border-color);
  /*padding: 0.5rem 0.75rem;*/
}

/* No items message styling */

#view-receipt-no-items, #edit-receipt-no-items {
  font-style: italic;
  color: var(--text-muted);
  background-color: var(--bg-light);
  border-radius: 0 0 0.375rem 0.375rem;
  /*border: 1px dashed var(--border-color);*/
}

#view-receipt-no-items i, #edit-receipt-no-items i {
  opacity: 0.7;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

/* Select2 mobile adjustments */

@media (max-width: 576px) {
  .select2-dropdown {
    font-size: 0.8125rem;
  }
}

@media (max-width: 576px) {
  .select2-results__option {
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem !important;
  }
}

@media (max-width: 576px) {
  .select2-results__option .fw-bold {
    font-size: 0.8125rem;
  }
}

@media (max-width: 576px) {
  .select2-results__option .text-muted {
    font-size: 0.7rem;
  }
}

/* Receipt image mobile adjustments */

@media (max-width: 576px) {
  .receipt-image-container {
    min-height: 150px;
  }
}

