/* 🌟 ENT Clinic Management System - STUNNING DARK THEME 🌟 */
/* Revolutionary Design by Advanced AI */

/* Reset & Base */
* {
    font-family: 'Cairo', sans-serif;
    box-sizing: border-box;
}

/* Prevent horizontal scrollbar on mobile */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Prevent overflow in all containers */
* {
    max-width: 100%;
}

/* Fix flex containers to prevent overflow */
.flex,
.inline-flex {
    max-width: 100%;
}

/* Grid containers */
.grid {
    max-width: 100%;
}

/* Fix for flex children that might overflow */
.flex>*,
.inline-flex>* {
    min-width: 0;
}

/* Mobile-specific overflow fixes */
@media (max-width: 768px) {

    /* Ensure all containers respect viewport width */
    main,
    .tab-content,
    nav {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Fix tab-content specifically */
    .tab-content {
        width: 100%;
        min-width: 0;
    }

    /* Fix flex items with text */
    .flex.items-center {
        max-width: 100%;
    }

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

    /* Fix glass containers */
    .glass {
        max-width: 100%;
        overflow: hidden;
    }

    /* Fix all grid elements */
    .grid>* {
        min-width: 0;
    }
}

/* Mobile bottom navigation spacing (prevents fixed bottom nav from covering content) */
@media (max-width: 1023px) {
    main {
        padding-bottom: 5.5rem;
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
}

#mobileBottomNav {
    padding-bottom: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

/* Custom CSS Variables - Revolutionary Color System */
:root {
    /* Core Backgrounds - Deep Cosmic Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #0f0f23;
    --bg-tertiary: #161633;
    --bg-glass: rgba(15, 15, 35, 0.9);
    --bg-overlay: rgba(10, 10, 15, 0.95);

    /* Premium Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #f8fafc;
    --text-tertiary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Stunning Accent Colors */
    --accent-primary: #8b5cf6;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #f59e0b;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;

    /* Advanced Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-tertiary: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    --gradient-danger: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    --gradient-cosmic: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    --gradient-aurora: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);

    /* Premium Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.25);
    --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.4);
    --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);
    --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);
    --shadow-glow-gold: 0 0 20px rgba(245, 158, 11, 0.3);

    /* Animation Timings - LIGHT & SNAPPY */
    --transition-fast: 0.015s ease-out;
    --transition-normal: 0.04s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.06s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fix number input width */
input[type="number"] {
    min-width: 100px;
    width: 100%;
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* Ensure hidden class always works - CRITICAL */
.hidden {
    display: none !important;
}

/* Fix lg:hidden and lg:flex classes */
@media (min-width: 1024px) {
    .lg\:hidden {
        display: none !important;
    }

    .lg\:flex {
        display: flex !important;
    }
}

@media (max-width: 1023px) {
    .hidden.lg\:flex {
        display: none !important;
    }
}

/* 🌟 REVOLUTIONARY SCROLLBAR DESIGN 🌟 */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-tertiary));
    box-shadow: var(--shadow-glow-purple);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 🌟 PREMIUM GLASS EFFECT REINVENTED 🌟 */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(6px) saturate(100%);
    -webkit-backdrop-filter: blur(6px) saturate(100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 🌟 ADVANCED GLOW EFFECTS 🌟 */
.glow {
    box-shadow: var(--shadow-glow-purple);
}

.glow-cyan {
    box-shadow: var(--shadow-glow-cyan);
}

.glow-gold {
    box-shadow: var(--shadow-glow-gold);
}

.glow-success {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.glow-warning {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.glow-danger {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* 🌟 SPECTACULAR ANIMATIONS 🌟 */
.pulse-dot {
    animation: pulseGlow 2s infinite;
    will-change: opacity, transform;
}

@keyframes pulseGlow {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 5px rgba(34, 197, 94, 0.5);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(34, 197, 94, 0.8);
    }
}

.slide-in-left {
    animation: slideInLeftSpectacular 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
}

@keyframes slideInLeftSpectacular {
    0% {
        transform: translateX(-100%) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.slide-in-right {
    animation: slideInRightSpectacular 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
}

@keyframes slideInRightSpectacular {
    0% {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.fade-in {
    animation: fadeInSpectacular 0.2s ease-out;
    will-change: opacity;
}

@keyframes fadeInSpectacular {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Floating Animation */
.float {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Pulse Animation for Status */
.pulse-ring {
    animation: pulseRing 1s infinite;
}

@keyframes pulseRing {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* 🌟 REVOLUTIONARY LOADER 🌟 */
.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 92, 246, 0.3);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spinSpectacular 0.8s linear infinite;
    position: relative;
}

@keyframes spinSpectacular {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 🌟 ADVANCED TAB SYSTEM 🌟 */
.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    white-space: nowrap;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    will-change: transform, background-color, border-color;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.tab-btn:hover::before {
    transform: translateX(100%);
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

.tab-btn.active {
    background: var(--gradient-primary);
    border: 1px solid var(--accent-primary);
    box-shadow: var(--shadow-xl), var(--shadow-glow-purple);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--accent-tertiary);
    border-radius: 2px;
    animation: slideInBottom 0.3s ease-out;
}

/* 🌟 COMPACT TABS - MINIMAL SPACE 🌟 */
.tab-btn-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 25px;
    white-space: nowrap;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    will-change: transform, background-color, border-color;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.tab-btn-compact i {
    font-size: 0.875rem;
}

.tab-btn-compact:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    transform: translateY(-1px);
}

.tab-btn-compact.active {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

.tab-btn-compact.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-tertiary);
    border-radius: 2px;
}

@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.tab-btn-mobile {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    border-radius: 25px;
    white-space: nowrap;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
}

.tab-btn-mobile:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    transform: translateY(-1px);
}

.tab-btn-mobile.active {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

/* 🌟 MOBILE NAV TABS - ELEGANT HEADER TABS 🌟 */
.mobile-nav-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease-out;
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(71, 85, 105, 0.3);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.mobile-nav-tab i {
    font-size: 0.875rem;
}

.mobile-nav-tab:hover {
    background: rgba(71, 85, 105, 0.6);
    color: var(--text-secondary);
}

.mobile-nav-tab:active {
    transform: scale(0.95);
}

.mobile-nav-tab.active {
    background: var(--gradient-primary);
    border-color: rgba(139, 92, 246, 0.5);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* 🌟 QUICK ACTION BUTTONS - PREMIUM DESIGN 🌟 */
.quick-action-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text-tertiary);
    position: relative;
    overflow: hidden;
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.quick-action-btn:hover::before {
    opacity: 1;
}

.quick-action-btn:hover {
    transform: translateY(-3px) scale(1.05);
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xl), var(--shadow-glow-purple);
}

.quick-action-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* 🌟 NOTIFICATION BADGE - ULTRA-VISIBLE 🌟 */
#alertsBadge,
.notification-badge {
    position: absolute;
    top: 6px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6), 0 0 0 2px rgba(10, 10, 15, 0.85);
    transform: scale(1);
    will-change: transform;
    z-index: 10;
}

#alertsBadge.hidden,
.notification-badge.hidden {
    display: none !important;
}

#alertsBadge.count-1-digit,
.notification-badge.count-1-digit {
    min-width: 20px;
}

#alertsBadge.count-2-digit,
.notification-badge.count-2-digit {
    min-width: 24px;
    font-size: 10px;
    height: 20px;
}

#alertsBadge.count-3-digit,
.notification-badge.count-3-digit {
    min-width: 28px;
    font-size: 9px;
    height: 20px;
}

#alertsBadge:empty:not(.hidden),
.notification-badge:empty:not(.hidden) {
    display: none;
}

/* Badge pulse animation */
#alertsBadge:not(.empty),
.notification-badge:not(.empty) {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5), 0 0 0 2px rgba(10, 10, 15, 0.8);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.7), 0 0 0 3px rgba(10, 10, 15, 0.8);
    }
}

/* 🌟 ADVANCED FILTER CONTROLS 🌟 */
.filter-select {
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 1rem;
    padding: 0.75rem 2.5rem 0.75rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 0.875rem;
    color: var(--text-tertiary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a855f7'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    backdrop-filter: blur(4px);
}

.filter-select:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-glow-purple);
    transform: translateY(-1px);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), var(--shadow-glow-purple);
}

/* 🌟 SPECTACULAR QUICK FILTERS BAR 🌟 */
.quick-filters-bar {
    background: var(--gradient-cosmic);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 1.5rem;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    overflow-x: hidden;
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 100%;
}

/* Mobile filter bar improvements */
@media (max-width: 768px) {
    .quick-filters-bar {
        padding: 0.75rem 1rem;
    }
}

.quick-filters-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent);
}

.filter-chip {
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    white-space: nowrap;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

/* Mobile filter chip adjustments */
@media (max-width: 768px) {
    .filter-chip {
        padding: 0.5rem 1rem;
        font-size: 0.7rem;
    }
}

.filter-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-aurora);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.filter-chip:hover::before {
    opacity: 0.1;
}

.filter-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

.filter-chip.active {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl), var(--shadow-glow-purple);
    transform: translateY(-1px);
}

.filter-chip.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-tertiary);
    border-radius: 50px;
    transform: translate(-50%, -50%);
    animation: pulseRing 2s infinite;
}

/* 🌟 REVOLUTIONARY PATIENT CARDS 🌟 */
.patient-card {
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1.5rem;
    padding: 1.5rem;
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, color 0.08s ease-out;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    box-shadow: var(--shadow-lg);
}

.patient-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-overlay);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

/* Card Content Styling */
.patient-card h3 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.patient-card p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.patient-card .text-muted {
    color: var(--text-muted);
}

/* 🌟 PREMIUM STATUS PILLS 🌟 */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-preop {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.3));
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.status-postop {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.3));
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.status-inpatient {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.3));
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.status-outpatient {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.2), rgba(156, 163, 175, 0.3));
    color: #9ca3af;
    border-color: rgba(107, 114, 128, 0.4);
}

.status-discharged {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.2), rgba(209, 213, 219, 0.3));
    color: #d1d5db;
    border-color: rgba(156, 163, 175, 0.4);
}

/* 🌟 ADVANCED CARD ACTIONS 🌟 */
.card-action-btn {
    padding: 0.75rem;
    border-radius: 0.75rem;
    transition: all var(--transition-normal);
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
}

.card-action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card-action-btn:hover::before {
    opacity: 1;
}

.card-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 🌟 SPECTACULAR MODAL SYSTEM 🌟 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay:not(.hidden) {
    display: flex !important;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: var(--bg-glass);
    backdrop-filter: blur(10px) saturate(100%);
    -webkit-backdrop-filter: blur(10px) saturate(100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 2rem;
    width: 100%;
    max-width: 95vw;
    max-height: 90vh;
    max-height: 90dvh;
    /* Dynamic viewport for mobile */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-2xl), var(--shadow-glow-purple);
    color: var(--text-secondary);
    animation: modalSlideIn 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Modal Header - defined later in the file with more complete styles */

.modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    flex: 1;
    min-height: 0;
    /* Critical for flex scrolling */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.5) transparent;
}

/* Ensure scrollbar is visible in webkit browsers */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}

/* Modal Footer Buttons - always sticky at bottom of scrollable area */
.modal-content .flex.justify-end,
.modal-content form .flex.justify-end,
.modal-footer,
.modal-body>.flex.justify-end:last-child,
.modal-body form>.flex.justify-end:last-child,
.modal-body>form>.flex.justify-end:last-child {
    position: sticky;
    bottom: -1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    margin: 1rem -1.5rem -1.5rem -1.5rem;
    border-top: 1px solid rgba(139, 92, 246, 0.3);
    z-index: 10;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        border-radius: 1.5rem 1.5rem 0 0;
        max-height: 95vh;
        max-height: 95dvh;
        width: 100vw;
        max-width: 100vw;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem;
        padding-bottom: 1rem;
    }

    /* Footer buttons - ensure always visible on mobile */
    .modal-content .flex.justify-end,
    .modal-content form .flex.justify-end,
    .modal-footer,
    .modal-body>.flex.justify-end:last-child,
    .modal-body form>.flex.justify-end:last-child,
    .modal-body>form>.flex.justify-end:last-child {
        position: sticky !important;
        bottom: -1rem !important;
        left: 0;
        right: 0;
        margin: 1rem -1rem -1rem -1rem;
        padding: 0.75rem 1rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
        gap: 0.5rem;
        background: var(--bg-glass);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(139, 92, 246, 0.3);
        z-index: 20;
    }

    /* Make buttons wrap onto multiple lines if needed */
    .modal-content .flex.justify-end,
    .modal-content form .flex.justify-end {
        flex-wrap: wrap;
    }

    .modal-content .flex.justify-end button,
    .modal-content form .flex.justify-end button {
        flex: 1;
        min-width: 0;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-aurora);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 📅 RELATIVE DATE INPUT COMPONENT 📅 */
.relative-date-input {
    min-width: 0;
    overflow: hidden;
}

.relative-date-input .form-label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.relative-date-input input[type="date"] {
    min-width: 0;
    flex: 1;
}

.relative-date-input input[type="text"] {
    flex-shrink: 0;
}

/* Mobile-specific for relative date input */
@media (max-width: 768px) {
    .relative-date-input input[type="date"] {
        font-size: 0.875rem;
        padding: 0.5rem;
    }

    .relative-date-input input[type="text"] {
        width: 3rem;
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    /* Preset buttons scrollable row */
    .relative-date-input .flex.gap-1 {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .relative-date-input .flex.gap-1::-webkit-scrollbar {
        display: none;
    }
}

.modal-header {
    position: sticky;
    top: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    color: var(--text-primary);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 🌟 ADVANCED FORM ELEMENTS 🌟 */
.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    transition: all var(--transition-normal);
    font-size: 0.875rem;
    color: var(--text-secondary);
    backdrop-filter: blur(4px);
}

/* Prevent form inputs from causing horizontal overflow on mobile */
@media (max-width: 768px) {
    .form-input {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
    }
}

.form-input::placeholder {
    color: var(--text-dim);
    opacity: 0.8;
}

.form-input:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-glow-purple);
    transform: translateY(-1px);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2), var(--shadow-glow-purple);
    background: var(--bg-overlay);
    transform: translateY(-1px);
}

/* 🌟 QUICK ACTION CARDS - PREMIUM DESIGN 🌟 */
.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: var(--bg-glass);
    border-radius: 1.5rem;
    transition: all var(--transition-slow);
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(6px);
}

.quick-action-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.quick-action-card:hover::before {
    opacity: 1;
}

.quick-action-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-xl), var(--shadow-glow-purple);
}

/* 🌟 BOTTOM NAVIGATION - REVOLUTIONARY 🌟 */
.bottom-nav-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.25rem;
    color: var(--text-muted);
    font-size: 0.625rem;
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: transparent;
    border: 1px solid transparent;
    transition: transform var(--transition-normal), background-color var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal);
}

.bottom-nav-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.bottom-nav-btn.active {
    background: rgba(139, 92, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.35);
    color: var(--text-secondary);
}

.bottom-nav-btn.active::before {
    opacity: 0.14;
}

.bottom-nav-btn:active {
    transform: scale(0.98);
}

/* Apply hover effects only on hover-capable devices (prevents double-tap issues on touch screens) */
@media (hover: hover) and (pointer: fine) {
    .bottom-nav-btn:hover::before {
        opacity: 1;
    }

    .bottom-nav-btn:hover {
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }
}

.bottom-nav-btn i {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

.bottom-nav-btn span {
    line-height: 1;
}

.bottom-nav-btn-primary {
    flex: 0 0 auto;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl), var(--shadow-glow-purple);
    transition: transform var(--transition-normal), filter var(--transition-normal);
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-btn-primary:active {
    transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
    .bottom-nav-btn-primary:hover {
        transform: translateY(-2px);
        filter: brightness(1.05);
    }
}

/* 🌟 REVOLUTIONARY BUTTON SYSTEM 🌟 */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    cursor: pointer;
    border: 1px solid;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    outline: none;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn-primary {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow-purple);
}

.btn-secondary {
    background: var(--bg-glass);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--text-tertiary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--gradient-success);
    border-color: var(--accent-success);
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 20px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: var(--gradient-warning);
    border-color: var(--accent-warning);
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.btn-danger {
    background: var(--gradient-danger);
    border-color: var(--accent-danger);
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* 🌟 TABLE STYLING - PREMIUM 🌟 */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table th {
    background: var(--bg-glass);
    color: var(--text-tertiary);
    font-weight: 700;
    padding: 1rem;
    text-align: right;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

table tr {
    transition: transform var(--transition-normal), background-color var(--transition-normal);
}

table tr:hover {
    background: rgba(139, 92, 246, 0.05);
    transform: scale(1.01);
}

/* 🌟 DATE INPUTS - STYLISH 🌟 */
.relative-date-input {
    position: relative;
}

.relative-date-input .form-input {
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem;
    transition: all var(--transition-normal);
}

/* 🌟 COSMIC BACKGROUND EFFECTS 🌟 */
body {
    background: var(--gradient-cosmic);
    min-height: 100vh;
    color: var(--text-secondary);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* 🌟 AURORA BORDER EFFECTS 🌟 */
.aurora-border {
    position: relative;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary), var(--accent-primary));
    background-size: 400% 400%;
    animation: auroraShift 4s ease-in-out infinite;
}

.aurora-border::before {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--bg-primary);
    border-radius: calc(1rem - 1px);
    z-index: 1;
}

.aurora-border>* {
    position: relative;
    z-index: 2;
}

@keyframes auroraShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* 🌟 TEXT GRADIENT EFFECTS 🌟 */
.text-gradient {
    background: var(--gradient-aurora);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-success {
    background: var(--gradient-success);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 🌟 LOADING STATES 🌟 */
.loading-shimmer {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* 🌟 UTILITY CLASSES 🌟 */
.backdrop-blur {
    backdrop-filter: blur(6px);
}

.border-gradient {
    border: 1px solid;
    border-image: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary)) 1;
}

.hover-lift {
    transition: transform var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* Performance: smoother hover on desktop (GPU hint for transform-heavy elements) */
@media (hover: hover) and (pointer: fine) {

    .tab-btn,
    .tab-btn-mobile,
    .filter-chip,
    .patient-card,
    .quick-action-btn,
    .bottom-nav-btn,
    .btn,
    table tr {
        will-change: transform;
        backface-visibility: hidden;
    }
}

/* 🌟 RESPONSIVE DESIGN ENHANCEMENTS 🌟 */
@media (max-width: 768px) {
    /* Note: .modal-content mobile styles are handled in the main modal system section */

    .patient-card {
        padding: 1rem;
        border-radius: 1rem;
        max-width: 100%;
        overflow: hidden;
    }

    .quick-filters-bar {
        padding: 0.75rem 1rem;
        border-radius: 1rem;
    }

    /* Comprehensive mobile overflow fixes */
    * {
        box-sizing: border-box;
    }

    /* Fix all forms and inputs */
    input,
    select,
    textarea,
    button {
        max-width: 100%;
    }

    /* Don't override Tailwind's flex wrap utilities globally (can break fixed nav/header layouts) */

    /* Fix tables */
    table {
        width: 100%;
        max-width: 100%;
        table-layout: fixed;
    }

    th,
    td {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Fix buttons with icons */
    .flex.items-center.gap-2 button {
        min-width: auto;
    }
}

/* RTL-specific overflow fixes for Arabic */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .modal-content {
    text-align: right;
}

/* Prevent horizontal scrollbar on all levels */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Ensure all containers respect this */
* {
    max-width: 100vw;
}

/* Special fix for modal children to prevent overflow */
.modal-content>* {
    max-width: 100%;
    overflow-x: hidden;
}

.modal-content form {
    max-width: 100%;
}

.modal-content .grid,
.modal-content .space-y-4,
.modal-content .space-y-3 {
    max-width: 100%;
}

.modal-content .grid>* {
    min-width: 0;
    max-width: 100%;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    max-width: 100%;
    width: 100%;
}

.modal-content .flex {
    flex-wrap: wrap;
    max-width: 100%;
}

.modal-content .flex>* {
    min-width: 0;
}

/* 🌟 DARK THEME ENHANCEMENTS 🌟 */
.dark-theme {
    color-scheme: dark;
}

.dark-theme ::selection {
    background: rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
}

.dark-theme ::-moz-selection {
    background: rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
}

/* 🌟 ACCESSIBILITY ENHANCEMENTS 🌟 */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for accessibility */
.btn:focus,
.form-input:focus,
.tab-btn:focus,
.filter-select:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-glass: rgba(0, 0, 0, 0.95);
        --text-secondary: #ffffff;
        --accent-primary: #ffffff;
    }
}

/* 🔄 OFFLINE SYNC UI ANIMATIONS 🔄 */
@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-subtle {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-slide-in-right {
    animation: slide-in-right 0.3s ease-out;
}

#offline-sync-status {
    transition: all 0.3s ease;
}

#offline-sync-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

#sync-icon.fa-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.pulse-dot {
    animation: pulse-subtle 2s ease-in-out infinite;
}

/* 🩺 Evidence Display Styles 🩺 */
.evidence-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: help;
    transition: all 0.2s;
    vertical-align: middle;
    margin: 0 4px;
    border: 1px solid transparent;
}

.evidence-badge.grade-a {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.evidence-badge.grade-b {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.evidence-badge.grade-c {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.3);
}

.evidence-badge.grade-d {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.evidence-badge:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.evidence-citation {
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
    margin: 0.4rem 0;
    padding-right: 0.75rem;
    border-right: 2px solid #475569;
}

.evidence-citation a {
    color: #818cf8;
    text-decoration: none;
    transition: color 0.2s;
}

.evidence-citation a:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

.evidence-panel {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    padding: 0.85rem;
    margin: 1rem 0;
}

.evidence-panel-header {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
}

.evidence-panel-body {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #94a3b8;
}

/* Recommendation Card with Evidence */
.recommendation-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.recommendation-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(15, 23, 42, 0.8);
    transform: translateY(-2px);
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.rec-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.rec-content {
    font-size: 0.9rem;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
}

.rec-evidence {
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.evidence-explanation {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

/* 🚩 Red Flag System Animations 🚩 */
@keyframes pulse-subtle {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.85;
        transform: scale(0.99);
    }
}

.animate-pulse-subtle {
    animation: pulse-subtle 3s ease-in-out infinite;
}

#clinicalAlertsPanel {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.1);
    background: linear-gradient(to bottom, rgba(127, 29, 29, 0.1), rgba(127, 29, 29, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.compliance-badge-pulse {
    animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.0);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

.detail-tab[data-tab="compliance"].active {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.15);
    color: white;
}

/* 🌟 DETAIL TABS - MOBILE RESPONSIVE 🌟 */
.detail-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.875rem;
    border-radius: 25px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.detail-tab:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-secondary);
}

.detail-tab.active {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
}

/* Detail tabs mobile - prevent text overlap */
@media (max-width: 768px) {
    .detail-tab {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
        gap: 0.25rem;
    }

    .detail-tab i {
        font-size: 0.75rem;
    }
}

/* Extra small screens - detail tabs show only icons */
@media (max-width: 400px) {
    .detail-tab span {
        display: none;
    }

    .detail-tab i {
        margin: 0 !important;
    }

    .detail-tab {
        padding: 0.5rem 0.6rem;
    }
}

/* 🌟 PATIENT DETAIL HEADER - MOBILE COMPACT 🌟 */
@media (max-width: 768px) {

    /* Make the sticky header more compact on mobile */
    #patientDetailPanel .sticky.top-0 {
        padding: 0.5rem 0.75rem !important;
    }

    /* Header info and buttons on same row, flex-shrink enabled */
    #patientDetailPanel .sticky.top-0>.flex {
        gap: 0.5rem !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    /* Patient info section - compact */
    #patientDetailPanel .sticky.top-0 #pdHeaderInfo {
        flex: 1;
        min-width: 0;
        gap: 0.5rem !important;
    }

    /* Avatar smaller on mobile */
    #patientDetailPanel .sticky.top-0 #pdHeaderInfo>div:first-child {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1rem !important;
        flex-shrink: 0;
    }

    /* Patient name and details - truncate */
    #patientDetailPanel .sticky.top-0 #pdHeaderInfo>div:last-child {
        min-width: 0;
        overflow: hidden;
    }

    #patientDetailPanel .sticky.top-0 #pdHeaderInfo h2 {
        font-size: 0.875rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #patientDetailPanel .sticky.top-0 #pdHeaderInfo .text-sm {
        font-size: 0.65rem !important;
    }

    /* Hide the edit hint text on mobile */
    #patientDetailPanel .sticky.top-0 #pdHeaderInfo div>div.text-xs {
        display: none !important;
    }

    /* Action buttons row - compact */
    #patientDetailPanel .sticky.top-0>.flex>.flex:last-child {
        flex-shrink: 0;
        gap: 0.25rem !important;
    }

    /* Hide text labels on action buttons, keep icons only */
    #patientDetailPanel .sticky.top-0>.flex>.flex:last-child button {
        padding: 0.4rem !important;
        font-size: 0.7rem;
    }

    /* Hide button text on mobile header */
    #patientDetailPanel .sticky.top-0>.flex>.flex:last-child button span,
    #patientDetailPanel .sticky.top-0>.flex>.flex:last-child button:not(:last-child) {
        display: none;
    }

    /* Just show icons for AI Summary, Print, Delete buttons */
    #patientDetailPanel .sticky.top-0 button[onclick*="generateAISummary"],
    #patientDetailPanel .sticky.top-0 button[onclick*="printPatientDetails"],
    #patientDetailPanel .sticky.top-0 button[onclick*="deletePatientWithConfirmation"] {
        padding: 0.5rem !important;
        min-width: 0;
    }

    #patientDetailPanel .sticky.top-0 button[onclick*="generateAISummary"] i+*,
    #patientDetailPanel .sticky.top-0 button[onclick*="printPatientDetails"] i+*,
    #patientDetailPanel .sticky.top-0 button[onclick*="deletePatientWithConfirmation"] i+* {
        display: none;
    }

    /* Close button - always visible */
    #patientDetailPanel .sticky.top-0 button[onclick*="closePatientDetail"] {
        padding: 0.4rem !important;
    }
}

/* 🔥 Risk Heatmap Styles 🔥 */
.risk-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.risk-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.risk-badge {
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.risk-filter-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #8b5cf6;
    color: white;
}

#alertsOnlyToggle.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* Heatmap progress bars with animation */
.risk-card .h-2 {
    position: relative;
    overflow: hidden;
}

.risk-card .h-2>div {
    animation: progress-fill 0.8s ease-out;
}

@keyframes progress-fill {
    from {
        width: 0;
    }
}

/* Hover effects for risk cards */
.risk-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.risk-card[data-risk="critical"]:hover {
    box-shadow: 0 20px 40px rgba(239, 68, 68, 0.3);
}

.risk-card[data-risk="high"]:hover {
    box-shadow: 0 20px 40px rgba(249, 115, 22, 0.3);
}

.risk-card[data-risk="medium"]:hover {
    box-shadow: 0 20px 40px rgba(245, 158, 11, 0.3);
}

.risk-card[data-risk="low"]:hover {
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.2);
}

/* Stat cards animation */
#tab-risk-heatmap .glass {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for grid items */
#riskHeatmapGrid>div {
    animation: fadeInUp 0.4s ease-out backwards;
}

#riskHeatmapGrid>div:nth-child(1) {
    animation-delay: 0.05s;
}

#riskHeatmapGrid>div:nth-child(2) {
    animation-delay: 0.1s;
}

#riskHeatmapGrid>div:nth-child(3) {
    animation-delay: 0.15s;
}

#riskHeatmapGrid>div:nth-child(4) {
    animation-delay: 0.2s;
}

#riskHeatmapGrid>div:nth-child(5) {
    animation-delay: 0.25s;
}

#riskHeatmapGrid>div:nth-child(6) {
    animation-delay: 0.3s;
}

/* Alert icons in detail modal */
.patient-risk-alert {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Risk score in modal */
.patient-risk-score-display {
    background: linear-gradient(135deg, var(--bg-glass), rgba(255, 255, 255, 0.05));
    border: 2px solid;
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: currentColor;
    }

    50% {
        border-color: rgba(255, 255, 255, 0.3);
    }
}

/* 📱 AI RESPONSE MODAL - MOBILE RESPONSIVE FIXES 📱 */
/* Ensures treatment dialogs display properly on mobile with header and footer visible */

/* AI Modal container - full screen display on mobile */
[id^="aiModal_"] {
    padding: 0.5rem;
}

/* AI Modal content box responsive */
[id^="aiModal_"]>div {
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    /* Dynamic viewport height for mobile */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 768px) {

    /* AI Modal - ensure full mobile viewport usage */
    [id^="aiModal_"] {
        padding: 0.25rem;
        align-items: flex-start;
    }

    [id^="aiModal_"]>div {
        max-height: calc(100vh - 0.5rem);
        max-height: calc(100dvh - 0.5rem);
        width: 100%;
        margin: 0 auto;
        border-radius: 1rem;
    }

    /* AI Modal header - compact on mobile */
    [id^="aiModal_"] .glass.border-b {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }

    [id^="aiModal_"] .glass.border-b h2 {
        font-size: 0.9rem;
    }

    [id^="aiModal_"] .glass.border-b p {
        font-size: 0.65rem;
    }

    /* AI Modal content scrollable area */
    [id^="aiModal_"] .overflow-y-auto {
        flex: 1;
        min-height: 0;
        max-height: none !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* AI Modal footer - compact and always visible */
    [id^="aiModal_"] .glass.border-t {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
        gap: 0.35rem;
    }

    [id^="aiModal_"] .glass.border-t button {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        flex: 1;
        min-width: 0;
    }

    /* AI Modal icon size reduction on mobile */
    [id^="aiModal_"] .w-12.h-12 {
        width: 2.5rem;
        height: 2.5rem;
    }

    [id^="aiModal_"] .w-12.h-12 i {
        font-size: 1rem;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    [id^="aiModal_"]>div {
        border-radius: 0.75rem;
    }

    [id^="aiModal_"] .glass.border-b,
    [id^="aiModal_"] .glass.border-t {
        padding: 0.5rem 0.75rem;
    }

    [id^="aiModal_"] .glass.border-t button {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }

    [id^="aiModal_"] .glass.border-t button i {
        display: none;
        /* Hide icons to save space */
    }
}

/* Apply/Edit overlays - same treatment */
.fixed.inset-0.bg-black\/90,
.fixed.inset-0.bg-black\/80 {
    padding: 0.5rem;
}

@media (max-width: 768px) {

    .fixed.inset-0.bg-black\/90>div,
    .fixed.inset-0.bg-black\/80>div {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .fixed.inset-0.bg-black\/90>div>.overflow-y-auto,
    .fixed.inset-0.bg-black\/80>div>.overflow-y-auto,
    .fixed.inset-0.bg-black\/90>div>.p-4.overflow-y-auto,
    .fixed.inset-0.bg-black\/80>div>.p-4.overflow-y-auto {
        flex: 1;
        min-height: 0;
        max-height: none !important;
    }
}

/* Landscape mode safety */
@media (max-height: 500px) {
    [id^="aiModal_"]>div {
        max-height: calc(100vh - 0.5rem);
        max-height: calc(100dvh - 0.5rem);
    }

    [id^="aiModal_"] .glass.border-b,
    [id^="aiModal_"] .glass.border-t {
        padding: 0.5rem 0.75rem;
    }

    [id^="aiModal_"] .overflow-y-auto {
        padding: 0.5rem;
    }
}

/* ================================================= */
/* 🚀 PERFORMANCE OPTIMIZATIONS 🚀                   */
/* ================================================= */

/* CSS Containment for patient cards - isolates layout/paint calculations */
.patient-card {
    contain: layout style paint;
}

/* Content visibility for off-screen content - skip rendering until visible */
.tab-content.hidden {
    content-visibility: hidden;
}

.tab-content:not(.hidden) {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
    /* Estimated size for smooth scrolling */
}

/* Virtual scroll container styles */
.virtual-scroll-content {
    contain: layout style;
}

.virtual-scroll-item {
    contain: layout style paint;
    content-visibility: auto;
}

/* Lazy render item styles */
.lazy-render-item {
    contain: layout style paint;
    content-visibility: auto;
    contain-intrinsic-size: 0 120px;
}

/* Will-change hints for animated elements */
.slide-in-left,
.slide-in-right,
.fade-in {
    will-change: transform, opacity;
}

/* Optimize hover transitions - reduce repaints */
.patient-card,
.tab-btn,
.filter-chip,
.quick-action-btn {
    will-change: auto;
    /* Reset to auto when not hovering */
}

.patient-card:hover,
.tab-btn:hover,
.filter-chip:hover,
.quick-action-btn:hover {
    will-change: transform, box-shadow;
}

/* Reduce backdrop-filter usage on mobile for performance */
@media (max-width: 768px) {
    .glass {
        backdrop-filter: blur(4px) saturate(100%);
        -webkit-backdrop-filter: blur(4px) saturate(100%);
    }

    /* Simpler glass effect for cards on mobile */
    .patient-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(15, 15, 35, 0.95);
    }

    /* Reduced animations on mobile for smoother performance */
    .pulse-dot {
        animation-duration: 3s;
        /* Slower animation */
    }

    /* Disable some expensive animations on mobile */
    .float {
        animation: none;
    }
}

/* Optimize scrolling performance */
#patientsGrid,
#evidenceHubGrid,
#appointmentsList {
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

/* GPU acceleration for modals */
.modal-overlay,
.modal-content,
#patientDetailPanel,
#patientDetailPanel>div {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Reduce paint area for large scrollable containers - ONLY for grids, not navigation */
#patientsGrid,
#evidenceHubGrid,
#appointmentsList,
.detail-tab-content {
    contain: content;
}

/* Ensure horizontal scroll areas don't clip icons */
.scrollbar-hide,
#mobileTabsStrip,
.quick-filters-bar {
    contain: none;
    overflow-x: auto;
    overflow-y: visible;
}

/* Optimize table rendering */
table {
    table-layout: fixed;
}

/* Efficient text rendering */
body {
    text-rendering: optimizeSpeed;
}

h1,
h2,
h3,
h4,
.font-bold,
.font-black {
    text-rendering: optimizeLegibility;
}

/* Loading and empty states - don't clip text */
#loadingState,
#emptyState,
#evidenceHubLoadingState {
    contain: none;
    /* Don't clip loading indicators */
    overflow: visible;
}

/* Prefers reduced motion support */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .pulse-dot,
    .float,
    .pulse-ring {
        animation: none !important;
    }
}

/* ========================================
   🔪 SURGERY TAB - ENHANCED DESIGN SYSTEM
   ======================================== */

/* Surgery Statistics - Animated Gradient Cards */
.surgery-stat-card {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.9) 0%, rgba(20, 20, 40, 0.95) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.surgery-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.surgery-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
}

.surgery-stat-card:hover::before {
    opacity: 1;
}

.surgery-stat-card.stat-today {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(20, 20, 40, 0.95) 100%);
}

.surgery-stat-card.stat-today::before {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.surgery-stat-card.stat-ready {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(20, 20, 40, 0.95) 100%);
}

.surgery-stat-card.stat-ready::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.surgery-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.surgery-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.surgery-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Time Block Grouping Headers */
.time-block-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    margin: 1rem 0 0.5rem 0;
    position: relative;
}

.time-block-header::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}

.time-block-badge {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.375rem 0.875rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.time-block-badge i {
    color: #a78bfa;
}

.time-block-count {
    background: rgba(139, 92, 246, 0.3);
    padding: 0.125rem 0.5rem;
    border-radius: 50px;
    font-size: 0.65rem;
}

/* Elegant Surgery Cards */
.surgery-card-elegant {
    background: linear-gradient(135deg, rgba(25, 25, 45, 0.95) 0%, rgba(15, 15, 35, 0.98) 100%);
    border: 1px solid rgba(100, 100, 140, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.surgery-card-elegant::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #ef4444, #f97316);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.surgery-card-elegant:hover {
    transform: translateY(-2px);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.surgery-card-elegant.is-today {
    border-color: rgba(239, 68, 68, 0.4);
}

.surgery-card-elegant.is-completed::before {
    background: linear-gradient(180deg, #10b981, #34d399);
}

/* Surgery Time Badge */
.surgery-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fca5a5;
}

.surgery-time-badge.time-morning {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fcd34d;
}

.surgery-time-badge.time-afternoon {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
    color: #fdba74;
}

/* Duration Bar */
.surgery-duration-bar {
    height: 4px;
    background: rgba(100, 100, 140, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.surgery-duration-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    border-radius: 2px;
}

/* Quick Action Buttons */
.surgery-quick-actions {
    display: flex;
    gap: 0.375rem;
}

.surgery-quick-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.surgery-quick-btn.btn-complete {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.surgery-quick-btn.btn-edit {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.surgery-quick-btn.btn-patient {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.3);
}

/* Pre-Op Readiness Pill */
.preop-readiness-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 600;
}

.preop-readiness-pill.ready {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.preop-readiness-pill.caution {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.preop-readiness-pill.not-ready {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* OR Room Compact */
.or-room-compact {
    background: linear-gradient(135deg, rgba(25, 25, 45, 0.95) 0%, rgba(15, 15, 35, 0.98) 100%);
    border: 1px solid rgba(100, 100, 140, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.or-room-indicator {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.or-room-indicator.busy {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Surgery Grid */
.surgery-grid {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .surgery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1280px) {
    .surgery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   📋 PRE-OP TAB - ENHANCED DESIGN SYSTEM
   ======================================== */

/* Pre-Op Stats Dashboard */
.preop-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .preop-stats-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.preop-stat-card {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.9) 0%, rgba(20, 20, 40, 0.95) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.preop-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
}

/* Circular Progress Ring */
.progress-ring {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke-width: 5;
}

.progress-ring-bg {
    stroke: rgba(100, 100, 140, 0.2);
}

.progress-ring-fill {
    transition: stroke-dashoffset 0.5s ease;
    stroke-linecap: round;
}

.progress-ring-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Pre-Op Card - Elegant */
.preop-card-elegant {
    background: linear-gradient(135deg, rgba(25, 25, 45, 0.95) 0%, rgba(15, 15, 35, 0.98) 100%);
    border: 1px solid rgba(100, 100, 140, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.preop-card-elegant::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.preop-card-elegant:hover {
    transform: translateY(-2px);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.preop-card-elegant.status-ready::before {
    background: linear-gradient(180deg, #10b981, #34d399);
}

.preop-card-elegant.status-caution::before {
    background: linear-gradient(180deg, #f59e0b, #fbbf24);
}

.preop-card-elegant.status-not-ready::before {
    background: linear-gradient(180deg, #ef4444, #f87171);
}

/* Pre-Op Inline Checklist */
.preop-checklist-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.preop-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(100, 100, 140, 0.1);
    border-radius: 0.375rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.preop-checklist-item.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.preop-checklist-item.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.preop-checklist-item i {
    font-size: 0.6rem;
}

/* Quick Checklist Stats Row */
.preop-quick-stats {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(100, 100, 140, 0.15);
}

.preop-quick-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.preop-quick-stat .stat-value {
    font-weight: 600;
    color: var(--text-secondary);
}

.preop-quick-stat.labs {
    color: #60a5fa;
}

.preop-quick-stat.consents {
    color: #a78bfa;
}

.preop-quick-stat.evaluations {
    color: #34d399;
}

.preop-quick-stat.preparations {
    color: #fbbf24;
}

/* Pre-Op Action Buttons */
.preop-actions {
    display: flex;
    gap: 0.375rem;
}

.preop-action-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.preop-action-btn.btn-ready {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.preop-action-btn.btn-edit {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.preop-action-btn.btn-surgery {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Progress Bar Inline */
.preop-progress-bar {
    height: 4px;
    background: rgba(100, 100, 140, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.preop-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.preop-progress-fill.ready {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.preop-progress-fill.caution {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.preop-progress-fill.not-ready {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Pre-Op Grid Layout */
.preop-grid {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .preop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1280px) {
    .preop-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Days Until Surgery Badge */
.days-until-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.days-until-badge.urgent {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.days-until-badge.soon {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.days-until-badge.normal {
    background: rgba(100, 100, 140, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(100, 100, 140, 0.2);
}