// ==========================================================================
// DISPLAY UTILITIES
// ==========================================================================
// Utility classes for display, visibility, and text formatting
// Theme-agnostic display and layout helpers
// ==========================================================================

// TEXT ALIGNMENT
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-justify { text-align: justify !important; }
.text-start { text-align: left !important; }
.text-end { text-align: right !important; }

// Responsive text alignment - Using base breakpoint tokens
@media (max-width: #{$base-breakpoint-xs - 1px}) {
  .text-xs-left { text-align: left !important; }
  .text-xs-right { text-align: right !important; }
  .text-xs-center { text-align: center !important; }
  .text-xs-start { text-align: left !important; }
  .text-xs-end { text-align: right !important; }
}

@media (min-width: #{$base-breakpoint-sm}) {
  .text-sm-left { text-align: left !important; }
  .text-sm-right { text-align: right !important; }
  .text-sm-center { text-align: center !important; }
  .text-sm-start { text-align: left !important; }
  .text-sm-end { text-align: right !important; }
}

@media (min-width: #{$base-breakpoint-md}) {
  .text-md-left { text-align: left !important; }
  .text-md-right { text-align: right !important; }
  .text-md-center { text-align: center !important; }
  .text-md-start { text-align: left !important; }
  .text-md-end { text-align: right !important; }
}

@media (min-width: #{$base-breakpoint-lg}) {
  .text-lg-left { text-align: left !important; }
  .text-lg-right { text-align: right !important; }
  .text-lg-center { text-align: center !important; }
  .text-lg-start { text-align: left !important; }
  .text-lg-end { text-align: right !important; }
}

// TEXT TRANSFORM
.text-lowercase { text-transform: lowercase !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-capitalize { text-transform: capitalize !important; }
.text-normal-case { text-transform: none !important; }

// FONT WEIGHT
.fw-light { font-weight: 300 !important; }
.fw-lighter { font-weight: lighter !important; }
.fw-normal { font-weight: 400 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-bolder { font-weight: bolder !important; }

// FONT STYLE
.fst-italic { font-style: italic !important; }
.fst-normal { font-style: normal !important; }

// TEXT DECORATION
.text-decoration-none { text-decoration: none !important; }
.text-decoration-underline { text-decoration: underline !important; }
.text-decoration-line-through { text-decoration: line-through !important; }

// LINE HEIGHT
.lh-1 { line-height: 1 !important; }
.lh-sm { line-height: 1.25 !important; }
.lh-base { line-height: 1.5 !important; }
.lh-lg { line-height: 2 !important; }

// TEXT WRAP
.text-wrap { white-space: normal !important; }
.text-nowrap { white-space: nowrap !important; }
.text-pre { white-space: pre !important; }
.text-pre-line { white-space: pre-line !important; }
.text-pre-wrap { white-space: pre-wrap !important; }

// TEXT OVERFLOW
.text-truncate {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.text-break {
  word-wrap: break-word !important;
  word-break: break-word !important;
}

// WORD BREAK
.text-break-all { word-break: break-all !important; }
.text-break-keep { word-break: keep-all !important; }

// VERTICAL ALIGNMENT
.align-baseline { vertical-align: baseline !important; }
.align-top { vertical-align: top !important; }
.align-middle { vertical-align: middle !important; }
.align-bottom { vertical-align: bottom !important; }
.align-text-bottom { vertical-align: text-bottom !important; }
.align-text-top { vertical-align: text-top !important; }

// LIST STYLES
.list-unstyled {
  padding-left: 0 !important;
  list-style: none !important;
}

.list-inline {
  padding-left: 0 !important;
  list-style: none !important;

  .list-inline-item {
    display: inline-block !important;

    &:not(:last-child) {
      margin-right: var(--list-inline-gap, 8px) !important;
    }
  }
}

// OPACITY
.opacity-0 { opacity: 0 !important; }
.opacity-25 { opacity: 0.25 !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-100 { opacity: 1 !important; }

// BORDERS
.border { border: var(--border-width, 1px) solid var(--border-color, #dee2e6) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: var(--border-width, 1px) solid var(--border-color, #dee2e6) !important; }
.border-top-0 { border-top: 0 !important; }
.border-end { border-right: var(--border-width, 1px) solid var(--border-color, #dee2e6) !important; }
.border-end-0 { border-right: 0 !important; }
.border-bottom { border-bottom: var(--border-width, 1px) solid var(--border-color, #dee2e6) !important; }
.border-bottom-0 { border-bottom: 0 !important; }
.border-start { border-left: var(--border-width, 1px) solid var(--border-color, #dee2e6) !important; }
.border-start-0 { border-left: 0 !important; }

// BORDER RADIUS - Using base border radius tokens
.rounded { border-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-0 { border-radius: #{$base-border-radius-none} !important; }
.rounded-1 { border-radius: var(--border-radius-sm, #{$base-border-radius-sm}) !important; }
.rounded-2 { border-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-3 { border-radius: var(--border-radius-lg, #{$base-border-radius-lg}) !important; }
.rounded-4 { border-radius: var(--border-radius-xl, #{$base-border-radius-xl}) !important; }
.rounded-5 { border-radius: var(--border-radius-xxl, #{$base-border-radius-2xl}) !important; }
.rounded-circle { border-radius: #{$base-border-radius-full} !important; }
.rounded-pill { border-radius: var(--rounded-pill, #{$base-border-radius-pill}) !important; }

// Individual border radius
.rounded-top { border-top-left-radius: var(--border-radius, #{$base-border-radius-md}) !important; border-top-right-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-end { border-top-right-radius: var(--border-radius, #{$base-border-radius-md}) !important; border-bottom-right-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-bottom { border-bottom-right-radius: var(--border-radius, #{$base-border-radius-md}) !important; border-bottom-left-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-start { border-bottom-left-radius: var(--border-radius, #{$base-border-radius-md}) !important; border-top-left-radius: var(--border-radius, #{$base-border-radius-md}) !important; }

.rounded-top-start { border-top-left-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-top-end { border-top-right-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-bottom-end { border-bottom-right-radius: var(--border-radius, #{$base-border-radius-md}) !important; }
.rounded-bottom-start { border-bottom-left-radius: var(--border-radius, #{$base-border-radius-md}) !important; }

// WIDTH AND HEIGHT
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

.mw-100 { max-width: 100% !important; }
.mw-75 { max-width: 75% !important; }
.mw-50 { max-width: 50% !important; }
.mw-25 { max-width: 25% !important; }

.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }

.mh-100 { max-height: 100% !important; }
.mh-75 { max-height: 75% !important; }
.mh-50 { max-height: 50% !important; }
.mh-25 { max-height: 25% !important; }

// Min width/height
.min-w-0 { min-width: 0 !important; }
.min-w-100 { min-width: 100% !important; }
.min-h-0 { min-height: 0 !important; }
.min-h-100 { min-height: 100% !important; }

// Viewport dimensions
.vw-100 { width: 100vw !important; }
.min-vw-100 { min-width: 100vw !important; }

.vh-100 { height: 100vh !important; }
.min-vh-100 { min-height: 100vh !important; }

// SHADOWS - Using base shadow tokens
.shadow-none { box-shadow: #{$base-shadow-none} !important; }
.shadow-sm { box-shadow: var(--shadow-sm, #{$base-shadow-sm}) !important; }
.shadow { box-shadow: var(--shadow, #{$base-shadow-md}) !important; }
.shadow-md { box-shadow: var(--shadow-md, #{$base-shadow-lg}) !important; }
.shadow-lg { box-shadow: var(--shadow-lg, #{$base-shadow-xl}) !important; }
.shadow-xl { box-shadow: var(--shadow-xl, #{$base-shadow-2xl}) !important; }

// FOCUS UTILITIES
.focus\:outline-none:focus {
  outline: 2px solid transparent !important;
  outline-offset: 2px !important;
}

.focus\:ring:focus {
  outline: 2px solid transparent !important;
  outline-offset: 2px !important;
  box-shadow: var(--focus-ring-shadow, 0 0 0 3px rgba(59, 130, 246, 0.5)) !important;
}

.focus\:ring-2:focus {
  outline: 2px solid transparent !important;
  outline-offset: 2px !important;
  box-shadow: var(--focus-ring-shadow, 0 0 0 2px rgba(59, 130, 246, 0.5)) !important;
}

.focus\:ring-4:focus {
  outline: 2px solid transparent !important;
  outline-offset: 2px !important;
  box-shadow: var(--focus-ring-shadow, 0 0 0 4px rgba(59, 130, 246, 0.5)) !important;
}

// SCREEN READER ONLY
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sr-only-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: inherit !important;
  margin: inherit !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

// PRINT UTILITIES
@media print {
  .d-print-none { display: none !important; }
  .d-print-inline { display: inline !important; }
  .d-print-inline-block { display: inline-block !important; }
  .d-print-block { display: block !important; }
  .d-print-flex { display: flex !important; }
  .d-print-inline-flex { display: inline-flex !important; }
  .d-print-grid { display: grid !important; }
  .d-print-table { display: table !important; }
  .d-print-table-row { display: table-row !important; }
  .d-print-table-cell { display: table-cell !important; }
}

// IMAGE UTILITIES
.img-fluid {
  max-width: 100% !important;
  height: auto !important;
}

.img-thumbnail {
  padding: var(--img-thumbnail-padding, 4px) !important;
  background-color: var(--img-thumbnail-bg, white) !important;
  border: var(--img-thumbnail-border-width, 1px) solid var(--img-thumbnail-border-color, #dee2e6) !important;
  border-radius: var(--img-thumbnail-border-radius, 6px) !important;
  max-width: 100% !important;
  height: auto !important;
}

// FIGURE
.figure {
  display: inline-block !important;

  .figure-img {
    margin-bottom: var(--figure-caption-margin-top, 8px) !important;
    line-height: 1 !important;
  }

  .figure-caption {
    font-size: var(--figure-caption-font-size, 0.875em) !important;
    color: var(--figure-caption-color, rgba(0, 0, 0, 0.6)) !important;
  }
}

// TABLE UTILITIES
.table-responsive {
  overflow-x: auto !important;

  .table {
    margin-bottom: 0 !important;
  }
}

@media (max-width: #{$base-breakpoint-xs - 1px}) {
  .table-responsive-sm {
    overflow-x: auto !important;
  }
}

@media (max-width: #{$base-breakpoint-md - 1px}) {
  .table-responsive-md {
    overflow-x: auto !important;
  }
}

@media (max-width: #{$base-breakpoint-lg - 1px}) {
  .table-responsive-lg {
    overflow-x: auto !important;
  }
}

@media (max-width: #{$base-breakpoint-xl - 1px}) {
  .table-responsive-xl {
    overflow-x: auto !important;
  }
}

// STRETCHED LINK
.stretched-link::after {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 1 !important;
  content: "" !important;
}