/**
 * Enhanced Styles for X-Ray Bone Fracture Detection System
 * 2026 Modern Design Standards with Dark Mode, RTL Support, and Glassmorphism
 * Addresses accessibility, responsiveness, and visual design issues
 */

/* ============================================================
   0. GOOGLE FONTS - Playfair Display (Luxury) + Inter + Cairo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Cairo:wght@400;500;600;700&display=swap');

/* ============================================================
   1. CSS CUSTOM PROPERTIES (Design System Tokens) - 2026 Edition
   ============================================================ */

:root {
    /* ========== 2026 Modern Color Palette ========== */

    /* Primary Colors - Vibrant Indigo/Purple */
    --xray-primary: #6366f1;
    --xray-primary-hover: #4f46e5;
    --xray-primary-light: #eef2ff;
    --xray-primary-dark: #3730a3;

    /* Secondary Accent - Purple */
    --xray-secondary: #8b5cf6;
    --xray-secondary-hover: #7c3aed;
    --xray-secondary-light: #f3e8ff;

    /* Modern Gradients */
    --xray-gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --xray-gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
    --xray-gradient-success: linear-gradient(135deg, #10b981 0%, #22c55e 100%);
    --xray-gradient-danger: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);
    --xray-gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --xray-gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* Status Colors - Enhanced for 2026 */
    --xray-success: #22c55e;
    --xray-success-light: #dcfce7;
    --xray-danger: #ef4444;
    --xray-danger-light: #fee2e2;
    --xray-warning: #f59e0b;
    --xray-warning-light: #fef3c7;
    --xray-info: #06b6d4;
    --xray-info-light: #cffafe;

    /* Semantic Colors for Medical Context */
    --xray-fractured: var(--xray-danger);
    --xray-fractured-bg: var(--xray-danger-light);
    --xray-healthy: var(--xray-success);
    --xray-healthy-bg: var(--xray-success-light);

    /* ========== Light Mode Neutral Colors ========== */
    --xray-bg: #f8fafc;
    --xray-surface: #ffffff;
    --xray-surface-elevated: #ffffff;
    --xray-text: #0f172a;
    --xray-text-muted: #64748b;
    --xray-border: #e2e8f0;

    --xray-white: #ffffff;
    --xray-gray-50: #f8fafc;
    --xray-gray-100: #f1f5f9;
    --xray-gray-200: #e2e8f0;
    --xray-gray-300: #cbd5e1;
    --xray-gray-400: #94a3b8;
    --xray-gray-500: #64748b;
    --xray-gray-600: #475569;
    --xray-gray-700: #334155;
    --xray-gray-800: #1e293b;
    --xray-gray-900: #0f172a;

    /* ========== Glassmorphism ========== */
    --xray-glass-bg: rgba(255, 255, 255, 0.7);
    --xray-glass-border: rgba(255, 255, 255, 0.3);
    --xray-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --xray-blur: blur(20px);

    /* ========== Spacing Scale ========== */
    --xray-space-1: 0.25rem;
    --xray-space-2: 0.5rem;
    --xray-space-3: 1rem;
    --xray-space-4: 1.5rem;
    --xray-space-5: 2rem;
    --xray-space-6: 3rem;

    /* ========== Typography - Luxury Fonts ========== */
    --xray-font-family: 'Inter', 'Cairo', system-ui, -apple-system, sans-serif;
    --xray-font-family-heading: 'Playfair Display', 'Cairo', Georgia, serif;
    --xray-font-family-ar: 'Cairo', 'Playfair Display', system-ui, sans-serif;
    --xray-font-size-xs: 0.75rem;
    --xray-font-size-sm: 0.875rem;
    --xray-font-size-base: 1rem;
    --xray-font-size-lg: 1.125rem;
    --xray-font-size-xl: 1.25rem;
    --xray-font-size-2xl: 1.5rem;
    --xray-font-size-3xl: 1.875rem;
    --xray-font-size-4xl: 2.25rem;
    --xray-font-weight-normal: 400;
    --xray-font-weight-medium: 500;
    --xray-font-weight-semibold: 600;
    --xray-font-weight-bold: 700;
    --xray-line-height-tight: 1.25;
    --xray-line-height-normal: 1.5;
    --xray-line-height-relaxed: 1.75;

    /* ========== Border Radius - Softer Corners ========== */
    --xray-radius-sm: 0.5rem;
    --xray-radius-md: 0.75rem;
    --xray-radius-lg: 1rem;
    --xray-radius-xl: 1.5rem;
    --xray-radius-2xl: 2rem;
    --xray-radius-full: 9999px;

    /* ========== Modern Shadows ========== */
    --xray-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --xray-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --xray-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --xray-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --xray-shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --xray-shadow-glow-success: 0 0 20px rgba(34, 197, 94, 0.3);
    --xray-shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.3);

    /* ========== Transitions - Smoother ========== */
    --xray-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --xray-transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --xray-transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ========== Z-Index Scale ========== */
    --xray-z-dropdown: 1000;
    --xray-z-sticky: 1020;
    --xray-z-fixed: 1030;
    --xray-z-modal-backdrop: 1040;
    --xray-z-modal: 1050;
    --xray-z-popover: 1060;
    --xray-z-tooltip: 1070;
    --xray-z-toast: 1080;
}

/* ============================================================
   DARK MODE SUPPORT
   ============================================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --xray-bg: #0f172a;
        --xray-surface: #1e293b;
        --xray-surface-elevated: #334155;
        --xray-text: #f1f5f9;
        --xray-text-muted: #94a3b8;
        --xray-border: #334155;

        --xray-primary-light: rgba(99, 102, 241, 0.2);
        --xray-secondary-light: rgba(139, 92, 246, 0.2);
        --xray-success-light: rgba(34, 197, 94, 0.2);
        --xray-danger-light: rgba(239, 68, 68, 0.2);
        --xray-warning-light: rgba(245, 158, 11, 0.2);
        --xray-info-light: rgba(6, 182, 212, 0.2);

        --xray-gray-50: #1e293b;
        --xray-gray-100: #334155;
        --xray-gray-200: #475569;
        --xray-gray-300: #64748b;
        --xray-gray-400: #94a3b8;
        --xray-gray-500: #94a3b8;
        --xray-gray-600: #cbd5e1;
        --xray-gray-700: #e2e8f0;
        --xray-gray-800: #f1f5f9;
        --xray-gray-900: #f8fafc;

        --xray-glass-bg: rgba(30, 41, 59, 0.8);
        --xray-glass-border: rgba(51, 65, 85, 0.5);
        --xray-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

        --xray-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
        --xray-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
        --xray-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
        --xray-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }
}

/* Manual Dark Mode Toggle Class */
[data-theme="dark"] {
    --xray-bg: #0f172a;
    --xray-surface: #1e293b;
    --xray-surface-elevated: #334155;
    --xray-text: #f1f5f9;
    --xray-text-muted: #94a3b8;
    --xray-border: #334155;

    --xray-primary-light: rgba(99, 102, 241, 0.2);
    --xray-success-light: rgba(34, 197, 94, 0.2);
    --xray-danger-light: rgba(239, 68, 68, 0.2);

    --xray-gray-50: #1e293b;
    --xray-gray-100: #334155;
    --xray-glass-bg: rgba(30, 41, 59, 0.8);
    --xray-glass-border: rgba(51, 65, 85, 0.5);
}

/* ============================================================
   RTL (Right-to-Left) SUPPORT FOR ARABIC
   ============================================================ */

[dir="rtl"],
html[lang="ar"] {
    font-family: var(--xray-font-family-ar);
    direction: rtl;
}

[dir="rtl"] .me-1,
[dir="rtl"] .me-2,
[dir="rtl"] .me-3,
[dir="rtl"] .me-4,
[dir="rtl"] .me-5 {
    margin-right: 0 !important;
}

[dir="rtl"] .me-1 {
    margin-left: 0.25rem !important;
}

[dir="rtl"] .me-2 {
    margin-left: 0.5rem !important;
}

[dir="rtl"] .me-3 {
    margin-left: 1rem !important;
}

[dir="rtl"] .me-4 {
    margin-left: 1.5rem !important;
}

[dir="rtl"] .me-5 {
    margin-left: 3rem !important;
}

[dir="rtl"] .ms-1,
[dir="rtl"] .ms-2,
[dir="rtl"] .ms-3,
[dir="rtl"] .ms-4,
[dir="rtl"] .ms-5 {
    margin-left: 0 !important;
}

[dir="rtl"] .ms-1 {
    margin-right: 0.25rem !important;
}

[dir="rtl"] .ms-2 {
    margin-right: 0.5rem !important;
}

[dir="rtl"] .ms-3 {
    margin-right: 1rem !important;
}

[dir="rtl"] .ms-4 {
    margin-right: 1.5rem !important;
}

[dir="rtl"] .ms-5 {
    margin-right: 3rem !important;
}

[dir="rtl"] .text-start {
    text-align: right !important;
}

[dir="rtl"] .text-end {
    text-align: left !important;
}

[dir="rtl"] .border-start {
    border-left: none !important;
    border-right: var(--bs-border-width) solid var(--bs-border-color) !important;
}

[dir="rtl"] .border-end {
    border-right: none !important;
    border-left: var(--bs-border-width) solid var(--bs-border-color) !important;
}

[dir="rtl"] .dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
}

[dir="rtl"] .nav-link i,
[dir="rtl"] .btn i {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* ============================================================
   LUXURY TYPOGRAPHY - Playfair Display for Headings
   ============================================================ */

h1,
h2,
h3,
h4,
h5,
h6,
.display-1,
.display-2,
.display-3,
.display-4,
.display-5,
.display-6,
.card-title,
.dashboard-header h1,
.gradient-header h1,
.hero-title,
.section-title {
    font-family: var(--xray-font-family-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ============================================================
   UNIFIED COLOR SCHEME - Primary Indigo/Purple Throughout
   ============================================================ */

/* Override Bootstrap text-* color classes for consistency */
.text-primary {
    color: var(--xray-primary) !important;
}

.text-secondary {
    color: var(--xray-secondary) !important;
}

/* All icons should use primary gradient or primary color */
.card-body .fa-2x,
.card-body .fa-3x,
.stats-card i,
.action-card i:not(.btn i),
.feature-icon i {
    background: var(--xray-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* All buttons should use primary gradient */
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-secondary {
    background: var(--xray-gradient-primary) !important;
    border: none !important;
    color: white !important;
    box-shadow: var(--xray-shadow-glow);
    transition: all var(--xray-transition-base);
}

.btn-primary:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4) !important;
    color: white !important;
}

.btn-primary:focus,
.btn-success:focus,
.btn-info:focus,
.btn-warning:focus,
.btn-secondary:focus {
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25) !important;
}

/* Stats card borders - unified to primary gradient top border */
.stats-card {
    border-left: none !important;
    border-top: 4px solid transparent !important;
    border-image: var(--xray-gradient-primary) 1 !important;
}

/* Badge styling - unified */
.badge.bg-success,
.badge.bg-info,
.badge.bg-warning,
.badge.bg-secondary,
.badge.bg-danger {
    background: var(--xray-gradient-primary) !important;
}

/* ============================================================
   GLASSMORPHISM UTILITIES
   ============================================================ */

.glass {
    background: var(--xray-glass-bg);
    backdrop-filter: var(--xray-blur);
    -webkit-backdrop-filter: var(--xray-blur);
    border: 1px solid var(--xray-glass-border);
    box-shadow: var(--xray-glass-shadow);
}

.glass-card {
    background: var(--xray-glass-bg);
    backdrop-filter: var(--xray-blur);
    -webkit-backdrop-filter: var(--xray-blur);
    border: 1px solid var(--xray-glass-border);
    border-radius: var(--xray-radius-xl);
    box-shadow: var(--xray-glass-shadow);
}

.glass-navbar {
    background: var(--xray-glass-bg);
    backdrop-filter: var(--xray-blur);
    -webkit-backdrop-filter: var(--xray-blur);
    border-bottom: 1px solid var(--xray-glass-border);
}

/* ============================================================
   MODERN GRADIENT UTILITIES
   ============================================================ */

.bg-gradient-primary {
    background: var(--xray-gradient-primary);
}

.bg-gradient-secondary {
    background: var(--xray-gradient-secondary);
}

.bg-gradient-success {
    background: var(--xray-gradient-success);
}

.bg-gradient-danger {
    background: var(--xray-gradient-danger);
}

.bg-gradient-dark {
    background: var(--xray-gradient-dark);
}

.text-gradient {
    background: var(--xray-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Dashboard Header Wrapper */
.dashboard-header {
    background: var(--xray-gradient-primary);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    border-radius: var(--xray-radius-lg);
}

.dashboard-header .text-white-50 {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Ensure icons inside header are white */
.dashboard-header i {
    color: white !important;
}

/* Stats Card Unified Style */
.stats-card {
    border: none;
    background: var(--xray-surface);
    box-shadow: var(--xray-shadow-sm);
    transition: var(--xray-transition-base);
    position: relative;
    overflow: hidden;
    /* Critical for clipping the top border */
    border-radius: var(--xray-radius-md) !important;
    /* Force rounded corners */
}

/* Fix for browser rendering of overflow:hidden with border-radius */
.stats-card {
    mask-image: -webkit-radial-gradient(white, black);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    transform: translateZ(0);
    /* Force GPU rendering to fix clipping */
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--xray-gradient-primary);
    z-index: 1;
}

.stats-card:hover {
    transform: translateY(-5px) translateZ(0);
    box-shadow: var(--xray-shadow-lg);
}

.stats-card i {
    background: var(--xray-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Modern Button Gradients */
.btn-gradient-primary {
    background: var(--xray-gradient-primary);
    border: none;
    color: white;
    transition: all var(--xray-transition-base);
    box-shadow: var(--xray-shadow-glow);
}

.btn-gradient-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    color: white;
}

/* ============================================================
   2. BASE & RESET ENHANCEMENTS
   ============================================================ */

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--xray-font-family);
    line-height: var(--xray-line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   3. ACCESSIBILITY ENHANCEMENTS
   ============================================================ */

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--xray-primary);
    color: var(--xray-white);
    padding: var(--xray-space-2) var(--xray-space-4);
    border-radius: 0 0 var(--xray-radius-md) var(--xray-radius-md);
    text-decoration: none;
    font-weight: var(--xray-font-weight-semibold);
    z-index: var(--xray-z-tooltip);
    transition: top var(--xray-transition-fast);
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--xray-warning);
    outline-offset: 2px;
}

/* Focus Visible Enhancement (TASK-014) */
:focus-visible {
    outline: 3px solid var(--xray-primary);
    outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* Additional focus indicators for interactive elements (TASK-014) */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 3px solid var(--xray-primary);
    outline-offset: 2px;
    border-radius: var(--xray-radius-sm);
}

/* Card and clickable elements */
.card:focus-visible,
.upload-area:focus-visible {
    outline: 3px solid var(--xray-primary);
    outline-offset: 4px;
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border: 1px solid currentColor;
    }

    .badge {
        border: 1px solid currentColor;
    }
}

/* ============================================================
   4. NAVIGATION ENHANCEMENTS
   ============================================================ */

.navbar {
    box-shadow: var(--xray-shadow-md);
}

.navbar-brand {
    font-weight: var(--xray-font-weight-bold);
    display: flex;
    align-items: center;
    gap: var(--xray-space-2);
}

.nav-link {
    transition: color var(--xray-transition-fast),
        background-color var(--xray-transition-fast);
    border-radius: var(--xray-radius-sm);
    padding: var(--xray-space-2) var(--xray-space-3) !important;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: var(--xray-font-weight-medium);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile Navigation Improvements */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--xray-primary);
        margin: var(--xray-space-2) calc(-1 * var(--xray-space-3));
        padding: var(--xray-space-3);
        border-radius: var(--xray-radius-md);
    }

    .nav-link {
        padding: var(--xray-space-3) !important;
    }
}

/* ============================================================
   5. CARD ENHANCEMENTS
   ============================================================ */

.card {
    border: none;
    border-radius: var(--xray-radius-lg);
    box-shadow: var(--xray-shadow-md);
    transition: transform var(--xray-transition-fast),
        box-shadow var(--xray-transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--xray-shadow-lg);
}

/* Mobile Card Adjustments */
@media (max-width: 768px) {
    .card {
        margin-bottom: var(--xray-space-4);
    }

    .card-body {
        padding: var(--xray-space-3);
    }

    .card-header {
        padding: var(--xray-space-3);
    }

    .card:hover {
        transform: none;
        /* تعطيل التحويم على الهاتف */
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: var(--xray-space-2);
    }

    .card-header {
        padding: var(--xray-space-2);
        font-size: var(--xray-font-size-base);
    }
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--xray-gray-100);
    font-weight: var(--xray-font-weight-semibold);
}

/* Dashboard Action Cards */
.card-action {
    border-top: 4px solid var(--xray-primary);
    text-align: center;
    padding: var(--xray-space-5);
}

.card-action .card-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--xray-font-size-2xl);
    margin-bottom: var(--xray-space-3);
}

.card-action.card-primary .card-icon {
    background-color: var(--xray-primary-light);
    color: var(--xray-primary);
}

.card-action.card-success .card-icon {
    background-color: var(--xray-success-light);
    color: var(--xray-success);
}

.card-action.card-warning .card-icon {
    background-color: var(--xray-warning-light);
    color: var(--xray-gray-700);
}

.card-action.card-info .card-icon {
    background-color: var(--xray-info-light);
    color: var(--xray-info);
}

/* ============================================================
   6. FORM ENHANCEMENTS
   ============================================================ */

.form-label {
    font-weight: var(--xray-font-weight-medium);
    margin-bottom: var(--xray-space-2);
}

.form-control,
.form-select {
    border-radius: var(--xray-radius-md);
    padding: var(--xray-space-2) var(--xray-space-3);
    transition: border-color var(--xray-transition-fast),
        box-shadow var(--xray-transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--xray-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Mobile Form Enhancements */
@media (max-width: 768px) {

    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    textarea {
        font-size: 16px !important;
        /* منع iOS zoom */
        min-height: 44px;
    }

    textarea.form-control {
        min-height: 100px;
    }

    .form-label {
        font-size: var(--xray-font-size-sm);
        margin-bottom: var(--xray-space-2);
    }

    .form-text {
        font-size: 0.8rem;
    }
}

/* Validation States */
.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--xray-success);
    background-image: none;
    /* Remove default checkmark */
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--xray-danger);
    background-image: none;
    /* Remove default X */
}

.invalid-feedback {
    color: var(--xray-danger);
    font-size: var(--xray-font-size-sm);
    margin-top: var(--xray-space-1);
    display: flex;
    align-items: center;
    gap: var(--xray-space-1);
}

.invalid-feedback::before {
    content: '\f06a';
    /* Font Awesome exclamation-circle */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.valid-feedback {
    color: var(--xray-success);
    font-size: var(--xray-font-size-sm);
}

/* Input Groups */
.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child,
.input-group> :first-child:not(.dropdown-toggle):not(.dropdown-menu) {
    border-top-left-radius: var(--xray-radius-md);
    border-bottom-left-radius: var(--xray-radius-md);
}

.input-group .form-control:last-child,
.input-group> :last-child:not(.dropdown-toggle):not(.dropdown-menu) {
    border-top-right-radius: var(--xray-radius-md);
    border-bottom-right-radius: var(--xray-radius-md);
}

.input-group-text {
    background-color: var(--xray-gray-50);
    border-color: var(--xray-gray-200);
}

/* ============================================================
   7. BUTTON ENHANCEMENTS
   ============================================================ */

.btn {
    border-radius: var(--xray-radius-md);
    font-weight: var(--xray-font-weight-medium);
    padding: var(--xray-space-2) var(--xray-space-4);
    transition: all var(--xray-transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--xray-space-2);
}

.btn:active {
    transform: scale(0.98);
}

/* Touch-Friendly Button Sizing */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: var(--xray-space-3) var(--xray-space-4);
    }

    .btn-sm {
        min-height: 38px;
        min-width: 38px;
        padding: var(--xray-space-2) var(--xray-space-3);
    }

    .btn-lg {
        min-height: 52px;
        padding: var(--xray-space-4) var(--xray-space-5);
        font-size: var(--xray-font-size-lg);
    }

    .btn-group .btn {
        flex: 1;
    }
}

@media (max-width: 576px) {
    .btn:not(.btn-sm):not(.btn-group .btn) {
        width: 100%;
        display: flex;
    }
}

.btn-lg {
    padding: var(--xray-space-3) var(--xray-space-5);
    font-size: var(--xray-font-size-lg);
}

.btn-sm {
    padding: var(--xray-space-1) var(--xray-space-3);
    font-size: var(--xray-font-size-sm);
}

/* Loading State */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spinner 0.75s linear infinite;
}

@keyframes btn-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   8. MODERN PAGE HEADER & GRADIENTS (T221)
   ============================================================ */

.bg-gradient-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
}

/* ============================================================
   9. AVATAR & USER ELEMENTS (T222)
   ============================================================ */

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--xray-font-weight-bold);
    font-size: var(--xray-font-size-lg);
    text-transform: uppercase;
}

.avatar-circle.sm {
    width: 32px;
    height: 32px;
    font-size: var(--xray-font-size-base);
}

.avatar-circle.lg {
    width: 56px;
    height: 56px;
    font-size: var(--xray-font-size-xl);
}

/* ============================================================
   10. TABLE ENHANCEMENTS (T224)
   ============================================================ */

.table-hover .hover-row {
    transition: background-color var(--xray-transition-fast);
}

.table-hover .hover-row:hover {
    background-color: var(--xray-gray-50);
}

.table-responsive-cards .table {
    margin-bottom: 0;
}

.table-responsive-cards thead th {
    border-bottom: 2px solid var(--xray-gray-200);
    padding: var(--xray-space-3);
}

.table-responsive-cards tbody td {
    padding: var(--xray-space-3);
    vertical-align: middle;
}

/* ============================================================
   11. HOVER & MICRO-INTERACTIONS (T225)
   ============================================================ */

.hover-lift {
    transition: transform var(--xray-transition-fast),
        box-shadow var(--xray-transition-fast);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--xray-shadow-md);
}

.hover-lift:active {
    transform: translateY(0);
}

/* Button hover effects */
.btn-primary:hover {
    background-color: var(--xray-primary-hover);
    border-color: var(--xray-primary-hover);
}

.btn-success:hover {
    background-color: #146c43;
    border-color: #146c43;
}

.btn-info:hover {
    background-color: #0aa2c0;
    border-color: #0aa2c0;
}

.btn-warning:hover {
    background-color: #ffca2c;
    border-color: #ffca2c;
}

/* Card hover effects */
.card.shadow-sm:hover {
    transform: translateY(-4px);
    box-shadow: var(--xray-shadow-lg);
    transition: transform var(--xray-transition-base),
        box-shadow var(--xray-transition-base);
}

/* ============================================================
   12. UPLOAD AREA ENHANCEMENTS
   ============================================================ */

.upload-area {
    border: 2px dashed var(--xray-gray-300);
    border-radius: var(--xray-radius-lg);
    padding: var(--xray-space-6);
    text-align: center;
    background-color: var(--xray-gray-50);
    transition: all var(--xray-transition-base);
    cursor: pointer;
}

.upload-area:hover,
.upload-area:focus-within {
    border-color: var(--xray-primary);
    background-color: var(--xray-primary-light);
}

.upload-area.dragover {
    border-color: var(--xray-primary);
    background-color: var(--xray-primary-light);
    transform: scale(1.01);
}

.upload-area.has-file {
    border-color: var(--xray-success);
    background-color: var(--xray-success-light);
}

.upload-area:focus {
    outline: 3px solid var(--xray-primary);
    outline-offset: 2px;
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--xray-space-4);
    background-color: var(--xray-primary-light);
    color: var(--xray-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Mobile Upload Area */
@media (max-width: 768px) {
    .upload-area {
        padding: var(--xray-space-5);
        min-height: 280px;
    }

    .upload-icon {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
        margin-bottom: var(--xray-space-3);
    }
}

@media (max-width: 576px) {
    .upload-area {
        padding: var(--xray-space-4);
        min-height: 240px;
    }

    .upload-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* Upload Progress */
.upload-progress {
    height: 8px;
    border-radius: var(--xray-radius-full);
    overflow: hidden;
    background-color: var(--xray-gray-100);
    margin-top: var(--xray-space-3);
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--xray-primary), var(--xray-info));
    border-radius: var(--xray-radius-full);
    transition: width var(--xray-transition-base);
    animation: progress-shimmer 2s linear infinite;
    background-size: 200% 100%;
}

@keyframes progress-shimmer {
    0% {
        background-position: -100% 0;
    }

    100% {
        background-position: 100% 0;
    }
}

/* ============================================================
   9. RESULTS PAGE ENHANCEMENTS
   ============================================================ */

/* Prediction Card */
.result-card {
    border-radius: var(--xray-radius-lg);
    border-left: 5px solid;
    overflow: hidden;
}

.result-card.result-fractured {
    border-left-color: var(--xray-danger);
    background: linear-gradient(135deg, var(--xray-danger-light) 0%, var(--xray-white) 100%);
}

.result-card.result-healthy {
    border-left-color: var(--xray-success);
    background: linear-gradient(135deg, var(--xray-success-light) 0%, var(--xray-white) 100%);
}

/* Image Responsive */
.result-card img,
.image-box img,
.preview-card img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: var(--xray-radius-md);
}

@media (max-width: 768px) {

    .result-card img,
    .image-box img {
        max-height: 400px;
    }

    .preview-card img {
        max-height: 350px;
    }
}

@media (max-width: 576px) {

    .result-card img,
    .image-box img {
        max-height: 300px;
    }

    .preview-card img {
        max-height: 280px;
    }
}

/* Confidence Bar */
.confidence-bar-container {
    position: relative;
    height: 40px;
    border-radius: var(--xray-radius-md);
    background-color: var(--xray-gray-100);
    overflow: hidden;
}

.confidence-bar {
    height: 100%;
    border-radius: var(--xray-radius-md);
    transition: width var(--xray-transition-slow);
}

.confidence-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--xray-font-weight-bold);
    font-size: var(--xray-font-size-lg);
    color: var(--xray-gray-900);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Image Comparison */
.image-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--xray-space-4);
}

.image-box {
    text-align: center;
}

.image-box img {
    max-width: 100%;
    border-radius: var(--xray-radius-lg);
    box-shadow: var(--xray-shadow-lg);
    cursor: pointer;
    transition: transform var(--xray-transition-base);
}

.image-box img:hover {
    transform: scale(1.02);
}

.image-box img:focus {
    outline: 3px solid var(--xray-primary);
    outline-offset: 4px;
}

/* Heatmap Legend */
.heatmap-legend {
    display: block;
    padding: var(--xray-space-3);
    background-color: var(--xray-gray-50);
    border-radius: var(--xray-radius-md);
    border: 1px solid var(--xray-gray-200);
}

.heatmap-legend-item {
    display: flex;
    align-items: center;
    gap: var(--xray-space-1);
    font-size: var(--xray-font-size-sm);
}

.heatmap-legend-color {
    width: 20px;
    height: 12px;
    border-radius: var(--xray-radius-sm);
}

/* Gradient Bar for TASK-006 */
.legend-gradient {
    margin: var(--xray-space-2) 0;
}

.gradient-bar {
    height: 24px;
    border-radius: var(--xray-radius-sm);
    /* Heatmap gradient: Blue (Low) -> Green -> Yellow -> Orange -> Red (Critical) */
    background: linear-gradient(to right,
            #0000ff 0%,
            /* Blue - Low */
            #00ffff 25%,
            /* Cyan */
            #00ff00 37.5%,
            /* Green */
            #ffff00 50%,
            /* Yellow - Medium */
            #ff9900 62.5%,
            /* Orange */
            #ff6600 75%,
            /* Deep Orange - High */
            #ff0000 100%
            /* Red - Critical */
        );
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--xray-gray-300);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--xray-space-1);
    font-size: var(--xray-font-size-xs);
    font-weight: var(--xray-font-weight-medium);
    color: var(--xray-gray-700);
}

/* ============================================================
   10. TABLE ENHANCEMENTS
   ============================================================ */

.table {
    border-radius: var(--xray-radius-lg);
    overflow: hidden;
}

.table thead th {
    background-color: var(--xray-gray-50);
    font-weight: var(--xray-font-weight-semibold);
    text-transform: uppercase;
    font-size: var(--xray-font-size-xs);
    letter-spacing: 0.05em;
    color: var(--xray-gray-500);
    padding: var(--xray-space-3);
}

.table tbody td {
    padding: var(--xray-space-3);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: var(--xray-primary-light);
}

/* Responsive Table Cards for Mobile */
@media (max-width: 768px) {
    .table-responsive-cards {
        display: block;
    }

    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody {
        display: block;
    }

    .table-responsive-cards tbody tr {
        display: block;
        background: var(--xray-white);
        border-radius: var(--xray-radius-md);
        box-shadow: var(--xray-shadow-sm);
        margin-bottom: var(--xray-space-3);
        padding: var(--xray-space-3);
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--xray-space-2) 0;
        border: none;
        border-bottom: 1px solid var(--xray-gray-100);
    }

    .table-responsive-cards tbody td:last-child {
        border-bottom: none;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: var(--xray-font-weight-semibold);
        color: var(--xray-gray-500);
        font-size: var(--xray-font-size-sm);
    }
}

/* ============================================================
   11. BADGE ENHANCEMENTS
   ============================================================ */

.badge {
    font-weight: var(--xray-font-weight-semibold);
    padding: 0.4em 0.8em;
    border-radius: var(--xray-radius-full);
}

.badge-prediction {
    font-size: var(--xray-font-size-base);
    padding: 0.5em 1em;
}

.badge-status {
    font-size: var(--xray-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================================
   12. TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
    z-index: var(--xray-z-toast);
}

.toast {
    border-radius: var(--xray-radius-md);
    box-shadow: var(--xray-shadow-lg);
    backdrop-filter: blur(10px);
}

.toast-body {
    padding: var(--xray-space-3);
    display: flex;
    align-items: center;
    gap: var(--xray-space-2);
}

/* ============================================================
   13. LOADING STATES
   ============================================================ */

/* Overlay Loading */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.loading-overlay-content {
    text-align: center;
}

/* Skeleton Loading */
.skeleton-loading {
    position: relative;
    overflow: hidden;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg,
            var(--xray-gray-100) 25%,
            var(--xray-gray-50) 50%,
            var(--xray-gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--xray-radius-sm);
    margin-bottom: var(--xray-space-2);
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

/* ============================================================
   BREADCRUMB MODERN STYLES
   ============================================================ */

.breadcrumb {
    background: var(--xray-surface);
    border-radius: var(--xray-radius-full);
    padding: 0.75rem 1.5rem;
    box-shadow: var(--xray-shadow-sm);
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    /* Fit content */
    border: 1px solid var(--xray-border);
}

.breadcrumb-item a {
    color: var(--xray-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--xray-primary);
}

.breadcrumb-item.active {
    color: var(--xray-primary);
    font-weight: 600;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "\f054";
    /* FontAwesome chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--xray-gray-400);
    padding: 0 0.75rem;
    align-self: center;
}

[data-theme="dark"] .breadcrumb {
    background: var(--xray-gray-800);
    border-color: var(--xray-gray-700);
}

/* ============================================================
   14. PRINT STYLES
   ============================================================ */

@media print {

    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--xray-gray-200);
    }

    .result-card {
        border-width: 3px;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    h1,
    h2,
    h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
    }

    .image-comparison {
        display: flex;
        gap: 1cm;
    }
}

/* ============================================================
   15. IMMERSIVE BACKGROUND
   ============================================================ */

    body {
        background-color: var(--xray-bg);
        min-height: 100vh;
    }

    .main-content-wrapper {
        position: relative;
        z-index: 1;
    }

    [data-theme="dark"] body {
        background-color: var(--xray-bg);
    }

    /* ============================================================
   15. RESPONSIVE ADJUSTMENTS
   ============================================================ */

    @media (max-width: 576px) {
        :root {
            --xray-space-3: 0.75rem;
            --xray-space-4: 1rem;
            --xray-space-5: 1.5rem;
            --xray-space-6: 2rem;
        }

        .container {
            padding-left: var(--xray-space-3);
            padding-right: var(--xray-space-3);
        }

        .display-6 {
            font-size: 1.5rem;
        }

        .upload-area {
            padding: var(--xray-space-4);
        }

        .upload-icon {
            width: 60px;
            height: 60px;
            font-size: 1.5rem;
        }

        .btn-lg {
            padding: var(--xray-space-2) var(--xray-space-4);
            font-size: var(--xray-font-size-base);
        }
    }

    /* ============================================================
   16. ANIMATION UTILITIES
   ============================================================ */

    .fade-in {
        animation: fadeIn var(--xray-transition-base);
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .slide-in-right {
        animation: slideInRight var(--xray-transition-base);
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(20px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* ============================================================
   17. LOADING SKELETONS (TASK-020)
   ============================================================ */

    .skeleton {
        background: linear-gradient(90deg,
                var(--xray-gray-200) 0%,
                var(--xray-gray-100) 50%,
                var(--xray-gray-200) 100%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
        border-radius: var(--xray-radius-md);
    }

    @keyframes shimmer {
        0% {
            background-position: 200% 0;
        }

        100% {
            background-position: -200% 0;
        }
    }

    .skeleton-line {
        height: 16px;
        margin-bottom: 8px;
        width: 100%;
    }

    .skeleton-line.short {
        width: 60%;
    }

    .skeleton-line.medium {
        width: 80%;
    }

    .skeleton-heading {
        height: 24px;
        width: 40%;
        margin-bottom: 16px;
    }

    .skeleton-card {
        padding: var(--xray-space-4);
        border: 1px solid var(--xray-gray-200);
        border-radius: var(--xray-radius-lg);
    }

    .skeleton-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }

    .skeleton-button {
        height: 38px;
        width: 100px;
        border-radius: var(--xray-radius-sm);
    }

    .pulse {
        animation: pulse 2s infinite;
    }

    @keyframes pulse {

        0%,
        100% {
            opacity: 1;
        }

        50% {
            opacity: 0.5;
        }
    }

    /* ============================================================
   18. MOBILE OPTIMIZATIONS - WEEK 4
   ============================================================ */

    /* TASK-023: Responsive Table Patterns */
    @media (max-width: 768px) {

        /* Convert tables to card layout on mobile */
        .table-responsive-cards {
            display: block;
        }

        .table-responsive-cards table {
            border: 0;
        }

        .table-responsive-cards thead {
            display: none;
        }

        .table-responsive-cards tbody {
            display: block;
        }

        .table-responsive-cards tr {
            display: block;
            margin-bottom: var(--xray-space-4);
            border: 1px solid var(--xray-gray-300);
            border-radius: var(--xray-radius-lg);
            background: white;
            box-shadow: var(--xray-shadow-sm);
            padding: var(--xray-space-3);
            cursor: pointer;
            transition: box-shadow var(--xray-transition-fast);
        }

        .table-responsive-cards tr:hover {
            box-shadow: var(--xray-shadow-md);
        }

        .table-responsive-cards td {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--xray-space-2) 0;
            border: 0;
            text-align: right;
        }

        .table-responsive-cards td::before {
            content: attr(data-label);
            font-weight: 600;
            text-align: left;
            flex: 0 0 40%;
            color: var(--xray-gray-700);
            font-size: var(--xray-font-size-sm);
        }

        .table-responsive-cards td:not(:last-child) {
            border-bottom: 1px solid var(--xray-gray-200);
            padding-bottom: var(--xray-space-2);
            margin-bottom: var(--xray-space-2);
        }

        /* Action buttons in cards */
        .table-responsive-cards .btn-group {
            display: flex;
            gap: var(--xray-space-2);
            width: 100%;
        }

        .table-responsive-cards .btn-group .btn {
            flex: 1;
            min-height: 44px;
        }
    }

    /* TASK-024: Touch-Friendly Upload Area */
    @media (max-width: 768px) {
        .upload-area {
            padding: var(--xray-space-5);
            min-height: 280px;
        }

        .upload-icon {
            width: 80px;
            height: 80px;
            font-size: 2rem;
            margin-bottom: var(--xray-space-4);
        }

        .upload-area .btn {
            min-height: 48px;
            min-width: 200px;
            font-size: var(--xray-font-size-lg);
            padding: var(--xray-space-3) var(--xray-space-5);
        }

        .upload-preview {
            margin-top: var(--xray-space-4);
        }

        .upload-preview img {
            max-height: 250px;
            width: 100%;
            object-fit: contain;
        }

        .file-info {
            font-size: var(--xray-font-size-base);
            padding: var(--xray-space-3);
        }
    }

    /* TASK-025: Card Layouts on Mobile */
    @media (max-width: 576px) {

        /* Dashboard cards stack vertically */
        .dashboard-card,
        .stats-card {
            margin-bottom: var(--xray-space-4);
        }

        .dashboard-card .card-body {
            padding: var(--xray-space-4);
        }

        .dashboard-card .card-icon {
            width: 50px;
            height: 50px;
            font-size: 1.5rem;
        }

        .dashboard-card h3 {
            font-size: var(--xray-font-size-xl);
        }

        .dashboard-card .btn {
            width: 100%;
            min-height: 48px;
            font-size: var(--xray-font-size-base);
        }

        /* Statistics cards */
        .stats-card {
            padding: var(--xray-space-4);
        }

        .stats-card .stats-number {
            font-size: 2rem;
        }

        .stats-card i {
            font-size: 1.5rem;
        }

        /* Action cards full width */
        .col-md-4,
        .col-md-6,
        .col-lg-4 {
            margin-bottom: var(--xray-space-3);
        }
    }

    /* TASK-026: Touch Target Sizing (44x44px minimum) */
    @media (max-width: 768px) {

        /* Ensure all interactive elements meet 44x44px minimum */
        .btn,
        button,
        input[type="submit"],
        input[type="button"],
        a.btn {
            min-height: 44px;
            padding: var(--xray-space-2) var(--xray-space-4);
        }

        .btn-sm {
            min-height: 44px;
            padding: var(--xray-space-2) var(--xray-space-3);
            font-size: var(--xray-font-size-sm);
        }

        /* Form controls */
        .form-control,
        .form-select {
            min-height: 48px;
            font-size: 16px;
            /* Prevents zoom on iOS */
            padding: var(--xray-space-3);
        }

        .form-check-input {
            min-width: 24px;
            min-height: 24px;
            margin-right: var(--xray-space-2);
        }

        /* Icon buttons */
        .btn-icon {
            min-width: 44px;
            min-height: 44px;
            padding: var(--xray-space-2);
        }

        /* Pagination buttons */
        .pagination .page-link {
            min-width: 44px;
            min-height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* Spacing between adjacent buttons */
        .btn-group .btn+.btn,
        .btn+.btn {
            margin-left: var(--xray-space-2);
        }

        .btn-group {
            gap: var(--xray-space-2);
        }

        /* Close buttons */
        .btn-close {
            min-width: 44px;
            min-height: 44px;
            padding: var(--xray-space-3);
        }

        /* Toggle switches */
        .form-switch .form-check-input {
            min-width: 44px;
            min-height: 24px;
        }
    }

    /* TASK-027: Mobile Navigation Experience */
    @media (max-width: 991.98px) {

        /* Smooth collapse animation */
        .navbar-collapse {
            transition: max-height 0.3s ease-in-out;
            overflow: hidden;
        }

        .navbar-collapse.show,
        .navbar-collapse.collapsing {
            background: var(--xray-gray-50);
            border-radius: var(--xray-radius-md);
            margin-top: var(--xray-space-3);
            padding: var(--xray-space-3);
            box-shadow: var(--xray-shadow-md);
        }

        /* Navigation items spacing */
        .navbar-nav .nav-link {
            padding: var(--xray-space-3) var(--xray-space-4);
            margin-bottom: var(--xray-space-2);
            border-radius: var(--xray-radius-sm);
            transition: background-color var(--xray-transition-fast);
            min-height: 44px;
            display: flex;
            align-items: center;
        }

        .navbar-nav .nav-link:hover,
        .navbar-nav .nav-link:focus {
            background: white;
            box-shadow: var(--xray-shadow-sm);
        }

        .navbar-nav .nav-link.active {
            background: var(--xray-primary);
            color: white;
        }

        /* Dropdown menus */
        .navbar-nav .dropdown-menu {
            border: none;
            box-shadow: none;
            padding: 0;
            background: transparent;
        }

        .navbar-nav .dropdown-item {
            padding: var(--xray-space-3) var(--xray-space-5);
            min-height: 44px;
            margin-bottom: var(--xray-space-2);
            border-radius: var(--xray-radius-sm);
            background: white;
        }

        .navbar-nav .dropdown-item:hover {
            background: var(--xray-gray-100);
        }

        /* Hamburger button */
        .navbar-toggler {
            min-width: 44px;
            min-height: 44px;
            padding: var(--xray-space-2);
            border-radius: var(--xray-radius-sm);
        }

        .navbar-toggler:focus {
            box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
        }
    }

    /* TASK-028: Image Comparison Mobile Layout */
    @media (max-width: 768px) {
        .image-comparison {
            flex-direction: column;
        }

        .image-box {
            width: 100%;
            margin-bottom: var(--xray-space-4);
        }

        .image-box:last-child {
            margin-bottom: 0;
        }

        .image-box img {
            width: 100%;
            height: auto;
            max-height: 400px;
            object-fit: contain;
        }

        .image-box h5 {
            font-size: var(--xray-font-size-lg);
            margin-bottom: var(--xray-space-3);
            padding: var(--xray-space-2);
            background: var(--xray-gray-100);
            border-radius: var(--xray-radius-sm);
        }

        /* Maintain tap-to-enlarge functionality */
        .image-box img {
            cursor: pointer;
            transition: transform var(--xray-transition-base);
        }

        .image-box img:active {
            transform: scale(0.98);
        }
    }

    /* Additional Mobile Form Optimizations */
    @media (max-width: 768px) {

        /* Stack form fields vertically */
        .row.g-3>[class*="col-"] {
            margin-bottom: var(--xray-space-3);
        }

        /* Full-width form buttons */
        form .btn:not(.btn-group .btn) {
            width: 100%;
            margin-bottom: var(--xray-space-2);
        }

        /* Filter forms */
        .filter-card {
            padding: var(--xray-space-4);
        }

        .filter-card .row {
            gap: var(--xray-space-3);
        }

        /* Search box */
        .search-box input {
            font-size: 16px;
            padding-left: 45px;
        }

        /* Card headers */
        .card-header {
            padding: var(--xray-space-3);
            font-size: var(--xray-font-size-base);
        }

        .card-header h5 {
            font-size: var(--xray-font-size-lg);
        }
    }

    /* Mobile-Specific Utilities */
    @media (max-width: 576px) {
        .mobile-hide {
            display: none !important;
        }

        .mobile-show {
            display: block !important;
        }

        .mobile-text-center {
            text-align: center !important;
        }

        .mobile-mb-3 {
            margin-bottom: var(--xray-space-3) !important;
        }

        .mobile-p-2 {
            padding: var(--xray-space-2) !important;
        }
    }

    /* Landscape orientation optimizations */
    @media (max-width: 768px) and (orientation: landscape) {
        .upload-area {
            min-height: 200px;
        }

        .modal-dialog {
            max-height: 90vh;
            overflow-y: auto;
        }

    }

    /* ============================================================
   19. FALLING BONES ANIMATION
   ============================================================ */

    .falling-bone {
        pointer-events: auto;
        /* Allow interaction */
        cursor: grab;
        transition: color 0.3s ease;
    }

    .falling-bone:active {
        cursor: grabbing;
    }

    /* Light Mode: Purple-tinted bones */
    .falling-bone {
        color: rgba(99, 102, 241, 0.5) !important;
    }

    .falling-bone svg {
        fill: currentColor;
        filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.2));
    }

    /* Dark Mode: White bones with glow */
    [data-theme="dark"] .falling-bone {
        color: rgba(255, 255, 255, 0.7) !important;
    }

    [data-theme="dark"] .falling-bone svg {
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    }