/* ========================================
   BOOTSTRAP TEXT UTILITIES - MOBILE OPTIMIZED
   Dennis Gutjahr - Tierisch Tiergesundheit
   ======================================== */

/* === BOOTSTRAP TEXT TRUNCATION === */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === BOOTSTRAP TEXT WRAPPING === */
.text-wrap {
    white-space: normal !important;
}

.text-nowrap {
    white-space: nowrap !important;
}

/* === BOOTSTRAP TEXT BREAKING === */
.text-break {
    word-wrap: break-word !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

/* === BOOTSTRAP TEXT ALIGNMENT === */
.text-start {
    text-align: left !important;
}

.text-end {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

.text-justify {
    text-align: justify !important;
}

/* === BOOTSTRAP TEXT TRANSFORMATION === */
.text-lowercase {
    text-transform: lowercase !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

.text-capitalize {
    text-transform: capitalize !important;
}

/* === BOOTSTRAP 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;
}

/* === BOOTSTRAP TEXT WEIGHT === */
.fw-light {
    font-weight: 300 !important;
}

.fw-normal {
    font-weight: 400 !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-bolder {
    font-weight: bolder !important;
}

/* === BOOTSTRAP TEXT STYLE === */
.fst-italic {
    font-style: italic !important;
}

.fst-normal {
    font-style: normal !important;
}

/* === BOOTSTRAP 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;
}

/* === MOBILE-SPECIFIC TEXT OPTIMIZATIONS === */

/* Responsive Text Sizing */
@media (max-width: 767px) {
    .text-responsive {
        font-size: clamp(0.875rem, 2.5vw, 1rem) !important;
        line-height: 1.4 !important;
    }
    
    .text-responsive-lg {
        font-size: clamp(1rem, 3vw, 1.25rem) !important;
        line-height: 1.3 !important;
    }
    
    .text-responsive-xl {
        font-size: clamp(1.125rem, 4vw, 1.5rem) !important;
        line-height: 1.2 !important;
    }
}

/* Mobile Text Container Fixes */
@media (max-width: 767px) {
    .container,
    .container-fluid,
    .row,
    .col,
    [class*="col-"] {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Fix for long words that don't break */
    p, div, span, h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }
    
    /* Special handling for URLs and long strings */
    a, .url, .email {
        word-break: break-all;
        overflow-wrap: anywhere;
    }
}

/* === BOOTSTRAP TEXT COLORS === */
.text-primary {
    color: var(--primary, #4a7c59) !important;
}

.text-secondary {
    color: var(--secondary, #7fb069) !important;
}

.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

.text-light {
    color: #f8f9fa !important;
}

.text-dark {
    color: #212529 !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-white {
    color: #fff !important;
}

/* === BOOTSTRAP TEXT BACKGROUND === */
.bg-primary {
    background-color: var(--primary, #4a7c59) !important;
}

.bg-secondary {
    background-color: var(--secondary, #7fb069) !important;
}

.bg-success {
    background-color: #198754 !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

.bg-warning {
    background-color: #ffc107 !important;
}

.bg-info {
    background-color: #0dcaf0 !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.bg-dark {
    background-color: #212529 !important;
}

.bg-white {
    background-color: #fff !important;
}

/* === MOBILE TEXT OVERFLOW FIXES === */
@media (max-width: 767px) {
    /* Fix for cards and containers */
    .card,
    .card-body,
    .card-header,
    .card-footer {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    /* Fix for navigation */
    .navbar,
    .nav-link,
    .navbar-brand {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix for buttons */
    .btn {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: center;
    }
    
    /* Fix for forms */
    .form-control,
    .form-label,
    .form-text {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix for tables */
    .table,
    .table td,
    .table th {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
}

/* === BOOTSTRAP RESPONSIVE TEXT UTILITIES === */
@media (max-width: 575.98px) {
    .text-xs-start { text-align: left !important; }
    .text-xs-end { text-align: right !important; }
    .text-xs-center { text-align: center !important; }
    .text-xs-justify { text-align: justify !important; }
}

@media (min-width: 576px) {
    .text-sm-start { text-align: left !important; }
    .text-sm-end { text-align: right !important; }
    .text-sm-center { text-align: center !important; }
    .text-sm-justify { text-align: justify !important; }
}

@media (min-width: 768px) {
    .text-md-start { text-align: left !important; }
    .text-md-end { text-align: right !important; }
    .text-md-center { text-align: center !important; }
    .text-md-justify { text-align: justify !important; }
}

@media (min-width: 992px) {
    .text-lg-start { text-align: left !important; }
    .text-lg-end { text-align: right !important; }
    .text-lg-center { text-align: center !important; }
    .text-lg-justify { text-align: justify !important; }
}

@media (min-width: 1200px) {
    .text-xl-start { text-align: left !important; }
    .text-xl-end { text-align: right !important; }
    .text-xl-center { text-align: center !important; }
    .text-xl-justify { text-align: justify !important; }
}

/* === BOOTSTRAP TEXT DISPLAY UTILITIES === */
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
.d-grid { display: grid !important; }
.d-table { display: table !important; }
.d-table-row { display: table-row !important; }
.d-table-cell { display: table-cell !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-none { display: none !important; }

/* === MOBILE-SPECIFIC DISPLAY UTILITIES === */
@media (max-width: 575.98px) {
    .d-xs-none { display: none !important; }
    .d-xs-inline { display: inline !important; }
    .d-xs-inline-block { display: inline-block !important; }
    .d-xs-block { display: block !important; }
    .d-xs-flex { display: flex !important; }
    .d-xs-inline-flex { display: inline-flex !important; }
}

@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-inline-block { display: inline-block !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
    .d-sm-inline-flex { display: inline-flex !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-inline-block { display: inline-block !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-inline-flex { display: inline-flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-inline { display: inline !important; }
    .d-lg-inline-block { display: inline-block !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-inline-flex { display: inline-flex !important; }
}

@media (min-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-inline { display: inline !important; }
    .d-xl-inline-block { display: inline-block !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
    .d-xl-inline-flex { display: inline-flex !important; }
}

/* === BOOTSTRAP FLEX UTILITIES === */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-row-reverse { flex-direction: row-reverse !important; }
.flex-column-reverse { flex-direction: column-reverse !important; }

.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-wrap-reverse { flex-wrap: wrap-reverse !important; }

.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.justify-content-evenly { justify-content: space-evenly !important; }

.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch { align-items: stretch !important; }

/* === MOBILE TEXT PERFORMANCE OPTIMIZATIONS === */
@media (max-width: 767px) {
    /* Optimize text rendering for mobile */
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    /* Improve text readability on small screens */
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* === BOOTSTRAP TEXT ACCESSIBILITY === */
.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:active,
.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* === BOOTSTRAP TEXT PRINT STYLES === */
@media print {
    .text-print-start { text-align: left !important; }
    .text-print-end { text-align: right !important; }
    .text-print-center { text-align: center !important; }
    .text-print-justify { text-align: justify !important; }
    
    .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; }
}
