/**
 * Utility CSS Classes
 * POF v8.3 - Inline Style Removal
 * v11.1.3 - Extended for CSP compliance
 * 
 * Common utility classes to replace inline styles
 * SOP-compliance: SOP-DRY.md, SOP-KISS.md
 */

/* ========================================
   DISPLAY UTILITIES
   ======================================== */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* ========================================
   GRID UTILITIES
   ======================================== */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.grid-cols-auto-fit { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important; }
.grid-cols-auto-fill { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important; }

/* Grid Gap */
.gap-10px { gap: 10px !important; }
.gap-15px { gap: 15px !important; }
.gap-20px { gap: 20px !important; }

/* ========================================
   FLEXBOX UTILITIES
   ======================================== */
.flex { display: flex; }
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/* Justify Content */
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/* Align Items */
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.align-center { align-items: center; }
.align-baseline { align-items: baseline; }
.align-stretch { align-items: stretch; }

/* ========================================
   SPACING UTILITIES
   ======================================== */
/* Margin */
.m-0 { margin: 0 !important; }
.m-1 { margin: 0.25rem !important; }
.m-2 { margin: 0.5rem !important; }
.m-3 { margin: 1rem !important; }
.m-4 { margin: 1.5rem !important; }
.m-5 { margin: 3rem !important; }
.m-auto { margin: auto !important; }

/* Margin Top */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

/* Margin Bottom */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

/* Margin Left */
.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }
.ml-auto { margin-left: auto !important; }

/* Margin Right */
.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mr-5 { margin-right: 3rem !important; }
.mr-auto { margin-right: auto !important; }
.mr-10px { margin-right: 10px !important; }

/* Margin X (left + right) */
.mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mx-1 { margin-left: 0.25rem !important; margin-right: 0.25rem !important; }
.mx-2 { margin-left: 0.5rem !important; margin-right: 0.5rem !important; }
.mx-3 { margin-left: 1rem !important; margin-right: 1rem !important; }
.mx-12px { margin-left: 12px !important; margin-right: 12px !important; }

/* Margin Y (top + bottom) */
.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: 0.25rem !important; margin-bottom: 0.25rem !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.my-5 { margin-top: 3rem !important; margin-bottom: 3rem !important; }
.my-12px { margin-top: 12px !important; margin-bottom: 12px !important; }
.my-20px { margin-top: 20px !important; margin-bottom: 20px !important; }

/* Extended px-based spacing utilities */
.mb-12px { margin-bottom: 12px !important; }
.mb-15px { margin-bottom: 15px !important; }
.mb-20px { margin-bottom: 20px !important; }
.mt-10px { margin-top: 10px !important; }
.mt-20px { margin-top: 20px !important; }
.mt-30px { margin-top: 30px !important; }
.mt-32px { margin-top: 32px !important; }
.m-12px { margin: 12px !important; }
.m-20px { margin: 20px !important; }
.my-10px { margin-top: 10px !important; margin-bottom: 10px !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }

/* Padding Top */
.pt-0 { padding-top: 0 !important; }
.pt-1 { padding-top: 0.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pt-5 { padding-top: 3rem !important; }

/* Padding Bottom */
.pb-0 { padding-bottom: 0 !important; }
.pb-1 { padding-bottom: 0.25rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pb-5 { padding-bottom: 3rem !important; }

/* Padding Left */
.pl-0 { padding-left: 0 !important; }
.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pl-4 { padding-left: 1.5rem !important; }
.pl-5 { padding-left: 3rem !important; }

/* Padding Right */
.pr-0 { padding-right: 0 !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pr-3 { padding-right: 1rem !important; }
.pr-4 { padding-right: 1.5rem !important; }
.pr-5 { padding-right: 3rem !important; }

/* Padding X (left + right) */
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-20px { padding-left: 20px !important; padding-right: 20px !important; }

/* Padding Y (top + bottom) */
.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-8px { padding-top: 8px !important; padding-bottom: 8px !important; }

/* Extended px-based padding utilities */
.p-8px { padding: 8px !important; }
.p-12px { padding: 12px !important; }
.p-15px { padding: 15px !important; }
.p-16px { padding: 16px !important; }
.max-w-940px { max-width: 940px !important; }
.m-auto { margin: auto !important; }
.p-20px { padding: 20px !important; }
.p-30px { padding: 30px !important; }
.mb-10px { margin-bottom: 10px !important; }
.mb-30px { margin-bottom: 30px !important; }
.rounded-12px { border-radius: 12px !important; }
.opacity-90 { opacity: 0.9 !important; }
.opacity-50 { opacity: 0.5 !important; }
.pointer-events-none { pointer-events: none !important; }
.flex-1 { flex: 1 !important; }
.text-muted-light { color: var(--text-muted-light, #adb5bd) !important; }
.border-light { border-bottom: 1px solid var(--border-light, #f1f3f4) !important; }
.mb-5px { margin-bottom: 5px !important; }
.px-20px { padding-left: 20px !important; padding-right: 20px !important; }
.p-10px { padding: 10px !important; }
.gap-15px { gap: 15px !important; }

/* ========================================
   TEXT UTILITIES
   ======================================== */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-justify { text-align: justify !important; }

.text-bold { font-weight: bold !important; }
.text-normal { font-weight: normal !important; }
.text-light { font-weight: 300 !important; }
.text-2rem { font-size: 2rem !important; }
.text-1_5rem { font-size: 1.5rem !important; }
.text-1_2rem { font-size: 1.2rem !important; }
.text-1_1rem { font-size: 1.1rem !important; }
.text-0_95rem { font-size: 0.95rem !important; }
.text-0_9rem { font-size: 0.9rem !important; }
.text-0_85rem { font-size: 0.85rem !important; }
.text-0_8rem { font-size: 0.8rem !important; }
.text-0_75rem { font-size: 0.75rem !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

.text-uppercase { text-transform: uppercase !important; }
.text-capitalize { text-transform: capitalize !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-capitalize { text-transform: capitalize !important; }
.text-decoration-none { text-decoration: none !important; }

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-nowrap { white-space: nowrap !important; }
.text-wrap { white-space: normal !important; }

/* Font Sizes */
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.875rem !important; }
.text-base { font-size: 1rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }
.text-2xl { font-size: 1.5rem !important; }
.text-3xl { font-size: 1.875rem !important; }

/* Extended font size utilities (em-based) */
.text-2_5rem { font-size: 2.5rem !important; }
.text-1_1rem { font-size: 1.1rem !important; }
.text-0_8em { font-size: 0.8em !important; }
.text-0_9em { font-size: 0.9em !important; }
.text-0_95em { font-size: 0.95em !important; }
.text-1_05em { font-size: 1.05em !important; }

/* Line Height Utilities */
.leading-tight { line-height: 1.2 !important; }
.leading-normal { line-height: 1.4 !important; }
.leading-relaxed { line-height: 1.65 !important; }

/* ========================================
   COLOR UTILITIES (Using CSS Variables)
   ======================================== */
/* Text Colors */
.text-muted { color: var(--text-muted, #666) !important; }
.text-dark { color: var(--text-primary, #333) !important; }
.text-white { color: #fff !important; }
.text-success { color: var(--success-color, #28a745) !important; }
.text-primary { color: var(--primary-color, #007bff) !important; }
.text-danger { color: var(--danger-color, #dc3545) !important; }
.text-warning { color: var(--warning-color, #856404) !important; }
.text-warning-dark { color: #856404 !important; }
.text-purple { color: #6f42c1 !important; }

/* Background Colors */
.bg-light { background-color: var(--bg-secondary, #f1f3f6) !important; }
.bg-white { background-color: var(--bg-card, #ffffff) !important; }
.bg-dark { background-color: var(--bg-dark, #222) !important; }
.bg-muted { background-color: var(--bg-muted, #f8f9fa) !important; }
.bg-success-light { background-color: var(--success-bg-light, #e9ecef) !important; }
.bg-warning { background-color: var(--warning-bg, #fff3cd) !important; }
.bg-info { background-color: var(--info-bg, #e7f3ff) !important; }
.bg-success { background-color: var(--success-color, #28a745) !important; }
.bg-danger { background-color: var(--danger-color, #dc3545) !important; }

/* Gradient Backgrounds */
.hero-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* ========================================
   WIDTH & HEIGHT UTILITIES
   ======================================== */
.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; }

.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; }

.max-w-full { max-width: 100% !important; }
.max-height-300 { max-height: 300px !important; }
.max-h-full { max-height: 100% !important; }

/* ========================================
   BORDER UTILITIES
   ======================================== */
.border { border: 1px solid var(--border-color, #dee2e6) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid var(--border-color, #dee2e6) !important; }
.border-bottom { border-bottom: 1px solid var(--border-color, #dee2e6) !important; }
.border-left { border-left: 1px solid var(--border-color, #dee2e6) !important; }
.border-right { border-right: 1px solid var(--border-color, #dee2e6) !important; }
.border-warning { border: 1px solid var(--warning-border, #ffeaa7) !important; }
.border-info { border: 1px solid var(--info-border, #b3d9ff) !important; }

.rounded { border-radius: 0.25rem !important; }
.rounded-lg { border-radius: 0.5rem !important; }
.rounded-md { border-radius: 6px !important; }
.rounded-full { border-radius: 9999px !important; }
.rounded-0 { border-radius: 0 !important; }
.rounded-4px { border-radius: 4px !important; }
.rounded-6px { border-radius: 6px !important; }
.rounded-8px { border-radius: 8px !important; }
.rounded-pill { border-radius: 9999px !important; }

/* ========================================
   POSITION UTILITIES
   ======================================== */
.position-static { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

/* ========================================
   OVERFLOW UTILITIES
   ======================================== */
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-visible { overflow: visible !important; }
.overflow-scroll { overflow: scroll !important; }

.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }
.overflow-x-hidden { overflow-x: hidden !important; }
.overflow-y-hidden { overflow-y: hidden !important; }

/* ========================================
   VISIBILITY UTILITIES
   ======================================== */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

.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; }

/* ========================================
   CURSOR UTILITIES
   ======================================== */
.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }
.cursor-wait { cursor: wait !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* ========================================
   Z-INDEX UTILITIES
   ======================================== */
.z-0 { z-index: 0 !important; }
.z-10 { z-index: 10 !important; }
.z-20 { z-index: 20 !important; }
.z-30 { z-index: 30 !important; }
.z-40 { z-index: 40 !important; }
.z-50 { z-index: 50 !important; }

/* ========================================
   SHADOW UTILITIES
   ======================================== */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important; }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important; }

/* ========================================
   GAP UTILITIES (for flex/grid)
   ======================================== */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */
@media (max-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
}

@media (max-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

@media (max-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
}

@media (max-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-block { display: block !important; }
}

/* Payment table column widths */
.payment-col-number { width: 60px; }
.payment-col-date { width: 20%; }
.payment-col-amount { width: 15%; }
.payment-col-status { width: 20%; }
.payment-col-method { width: 25%; }
.payment-col-actions { width: 120px; }

/* Dashboard spacing utilities */
.mb-20px { margin-bottom: 20px !important; }

/* Citation management table styles */
.citation-table {
    width: 100%;
    border-collapse: collapse;
}

.citation-table-header {
    background-color: #f0f0f0;
}

/* Margin left utility */
.ml-10px { margin-left: 10px !important; }

/* Citation inline table column widths */
.citation-col-number { width: 60px; }
.citation-col-text { width: 60%; }
.citation-col-url { width: 30%; }
.citation-col-actions { width: 120px; }

/* CSS variable-based spacing utilities */
.mt-space-4 { margin-top: var(--space-4) !important; }
.mb-space-2 { margin-bottom: var(--space-2) !important; }
.mb-1rem { margin-bottom: 1rem !important; }
.mt-1rem { margin-top: 1rem !important; }
.mb-1_5rem { margin-bottom: 1.5rem !important; }

/* Text utilities */
.text-inherit { color: inherit !important; }
.gap-0_5rem { gap: 0.5rem !important; }
.font-italic { font-style: italic !important; }

/* Display utilities */
.d-inline { display: inline !important; }
.m-0 { margin: 0 !important; }
.p-0 { padding: 0 !important; }

/* Question preview utilities */
.mt-15px { margin-top: 15px !important; }
.pt-15px { padding-top: 15px !important; }
.border-top-metadata {
    border-top: 1px solid #dee2e6 !important;
}

/* Disease autocomplete widget */
.disease-autocomplete-label {
    font-weight: bold;
}

.autocomplete-results {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    max-height: 200px;
    overflow-y: auto;
}

.disease-json-display {
    width: 100%;
    min-width: 200px;
    max-width: 100%;
    min-height: 40px;
    max-height: 400px;
    margin-top: 8px;
    font-family: monospace;
    font-size: 0.95em;
    background: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: both;
    overflow: auto;
}

/* Header utilities */
.header-container-max-width {
    max-width: 940px !important;
}

.header-logo-link {
    color: white !important;
    text-decoration: none !important;
}

/* Admin title actions */
.admin-title-actions {
    float: right;
    margin-top: -40px;
}

.mr-10px { margin-right: 10px !important; }
.p-40px { padding: 40px !important; }
.my-20px { margin-top: 20px !important; margin-bottom: 20px !important; }

/* Citation form title */
.citation-form-title {
    color: #68D391;
    margin-bottom: 20px;
}

/* Payment summary container */
.payment-summary-container {
    max-width: 900px;
    margin-top: 20px;
}

/* Question changelist header */
.question-changelist-header {
    padding: 16px;
    background: #f0f4fa;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 1.2em;
    font-weight: bold;
    color: #2563eb;
}

/* Learning list category color (handled via JavaScript) */
.item-category[data-category-color] {
    /* Color will be set via JavaScript from data-category-color attribute */
}

