/* ============================================================
   MODERN.CSS - Health Kiosk Machine Modern Dashboard Stylesheet
   Comprehensive CSS for Patient, Vendor, Doctor, Admin &
   Master Vendor portals
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================
   1. CSS VARIABLES
   ============================================================ */
:root {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --secondary: #764ba2;
    --accent: #4facfe;
    --success: #00b894;
    --success-dark: #00cec9;
    --warning: #fdcb6e;
    --warning-dark: #f39c12;
    --danger: #e17055;
    --danger-dark: #d63031;
    --bg: #f0f2f5;
    --bg-light: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-muted: #999999;
    --border-color: #e9ecef;
    --border-light: #f0f0f0;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 15px 40px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --navbar-height: 64px;
    --transition-base: all 0.3s ease;
    --transition-fast: all 0.2s ease;
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-success: linear-gradient(135deg, var(--success), var(--success-dark));
    --gradient-warning: linear-gradient(135deg, var(--warning), var(--warning-dark));
    --gradient-danger: linear-gradient(135deg, var(--danger), var(--danger-dark));
    --gradient-accent: linear-gradient(135deg, var(--accent), var(--primary));
}

/* ============================================================
   2. BASE / RESET STYLES
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

/* ============================================================
   3. ANIMATION KEYFRAMES
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatShape {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
    }
    50% {
        transform: translateY(-10px) rotate(-3deg);
    }
    75% {
        transform: translateY(-25px) rotate(3deg);
    }
}

/* ============================================================
   4. ANIMATION UTILITY CLASSES
   ============================================================ */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out both;
}

.animate-fade-up {
    animation: fadeInUp 0.6s ease-out both;
}

.animate-fade-down {
    animation: fadeInDown 0.6s ease-out both;
}

.animate-fade-left {
    animation: fadeInLeft 0.6s ease-out both;
}

.animate-fade-right {
    animation: fadeInRight 0.6s ease-out both;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out both;
}

.animate-delay-1 {
    animation-delay: 100ms;
}

.animate-delay-2 {
    animation-delay: 200ms;
}

.animate-delay-3 {
    animation-delay: 300ms;
}

.animate-delay-4 {
    animation-delay: 400ms;
}

.animate-delay-5 {
    animation-delay: 500ms;
}

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

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.hover-scale {
    transition: var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* ============================================================
   5. LOGIN PAGE STYLES
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #667eea, #764ba2, #4facfe, #667eea);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 480px;
    z-index: 10;
    animation: fadeInUp 0.8s ease-out;
}

.glass-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo img {
    max-height: 55px;
    animation: pulse 3s ease-in-out infinite;
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 12px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Role Tabs */
.role-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    padding: 4px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.role-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    position: relative;
    outline: none;
}

.role-tab:hover {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
}

.role-tab.active {
    color: #ffffff;
    background: var(--gradient-primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.role-tab i {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

/* Login Form */
.login-form {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition-base);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12);
}

.form-input::placeholder {
    color: #b0b0b0;
}

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: 46px;
}

.form-input-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #b0b0b0;
    font-size: 16px;
    transition: var(--transition-fast);
}

.form-input-icon:focus-within i {
    color: var(--primary);
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 13px;
}

.remember-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
}

.remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.remember-row a {
    color: var(--primary);
    font-weight: 500;
}

.remember-row a:hover {
    text-decoration: underline;
}

/* Login Button */
.btn-login {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.btn-login .btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .btn-spinner {
    display: block;
}

/* Floating Shapes */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.floating-shapes .shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: floatShape 20s ease-in-out infinite;
}

.floating-shapes .shape:nth-child(1) {
    width: 120px;
    height: 120px;
    background: #ffffff;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.floating-shapes .shape:nth-child(2) {
    width: 200px;
    height: 200px;
    background: #ffffff;
    top: 60%;
    right: 10%;
    animation-delay: -5s;
    animation-duration: 22s;
}

.floating-shapes .shape:nth-child(3) {
    width: 80px;
    height: 80px;
    background: #ffffff;
    bottom: 15%;
    left: 20%;
    animation-delay: -8s;
    animation-duration: 16s;
}

.floating-shapes .shape:nth-child(4) {
    width: 160px;
    height: 160px;
    background: #ffffff;
    top: 30%;
    right: 25%;
    animation-delay: -3s;
    animation-duration: 25s;
}

.floating-shapes .shape:nth-child(5) {
    width: 60px;
    height: 60px;
    background: #ffffff;
    top: 5%;
    right: 40%;
    animation-delay: -12s;
    animation-duration: 20s;
}

.floating-shapes .shape:nth-child(6) {
    width: 100px;
    height: 100px;
    background: #ffffff;
    bottom: 30%;
    right: 5%;
    animation-delay: -7s;
    animation-duration: 19s;
}

/* Shape variations: crosses */
.floating-shapes .shape.cross {
    border-radius: 0;
    width: 40px;
    height: 40px;
    background: none;
    opacity: 0.12;
}

.floating-shapes .shape.cross::before,
.floating-shapes .shape.cross::after {
    content: '';
    position: absolute;
    background: #ffffff;
    border-radius: 4px;
}

.floating-shapes .shape.cross::before {
    width: 100%;
    height: 8px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.floating-shapes .shape.cross::after {
    width: 8px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    position: relative;
}

.login-footer a {
    color: #ffffff;
    font-weight: 500;
}

/* ============================================================
   6. LAYOUT STYLES
   ============================================================ */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-primary);
    color: #ffffff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-footer .nav-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-link i,
.sidebar.collapsed .nav-link .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 10px;
}

.sidebar.collapsed .sidebar-logo {
    max-height: 30px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.sidebar-logo {
    max-height: 45px;
    transition: var(--transition-base);
}

.sidebar-nav {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition-base);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateX(5px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #ffffff;
    border-radius: 0 3px 3px 0;
}

.nav-link i,
.nav-icon {
    width: 20px;
    margin-right: 12px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
    transition: var(--transition-base);
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.sidebar-footer .nav-link {
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-footer .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0; /* allow flex item to shrink so wide content scrolls instead of stretching the layout */
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

/* Top Navbar */
.top-navbar {
    height: var(--navbar-height);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
    flex-shrink: 0;
}

.navbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--bg-light);
    color: var(--primary);
}

/* Page Content */
.page-content {
    padding: 24px;
    flex: 1;
    min-width: 0; /* contain wide children (e.g. multi-column tables) within the viewport */
    max-width: 100%;
}

/* ============================================================
   7. DASHBOARD STAT CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.primary::before {
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.stat-card.success::before {
    background: linear-gradient(to bottom, #00b894, #00cec9);
}

.stat-card.warning::before {
    background: linear-gradient(to bottom, #fdcb6e, #f39c12);
}

.stat-card.danger::before {
    background: linear-gradient(to bottom, #e17055, #d63031);
}

.stat-card.info::before {
    background: linear-gradient(to bottom, #4facfe, #667eea);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-icon.primary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.stat-icon.success {
    background: rgba(0, 184, 148, 0.1);
    color: #00b894;
}

.stat-icon.warning {
    background: rgba(253, 203, 110, 0.1);
    color: #f39c12;
}

.stat-icon.danger {
    background: rgba(225, 112, 85, 0.1);
    color: #e17055;
}

.stat-icon.info {
    background: rgba(79, 172, 254, 0.1);
    color: #4facfe;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
    animation: countUp 0.6s ease-out;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 20px;
}

.stat-change.up {
    color: var(--success);
    background: rgba(0, 184, 148, 0.08);
}

.stat-change.down {
    color: var(--danger);
    background: rgba(225, 112, 85, 0.08);
}

/* ============================================================
   8. CARD COMPONENT
   ============================================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: none;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.card-header h3,
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-header .card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: transparent;
}

/* ============================================================
   9. MODERN TABLES
   ============================================================ */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
    border-radius: var(--radius-lg);
    -webkit-overflow-scrolling: touch;
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Keep column cells from wrapping so wide pivot tables scroll horizontally instead of squishing */
.modern-table th,
.modern-table td {
    white-space: nowrap;
}

.modern-table thead th {
    background: var(--bg-light);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.modern-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.modern-table tbody tr {
    transition: background 0.2s ease;
}

.modern-table tbody tr:hover {
    background: #f8f9ff;
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

.modern-table tbody tr td:first-child {
    font-weight: 500;
}

/* Legacy table support */
.borderTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.borderTable th {
    background: var(--bg-light);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.borderTable td {
    padding: 12px 16px;
    font-size: 13px;
    color: #333;
    border-bottom: 1px solid var(--border-light);
    font-weight: 400;
    text-align: left;
}

.borderTable tr:hover {
    background: #f8f9ff;
}

/* ============================================================
   10. BUTTONS
   ============================================================ */
.btn-modern {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-modern:active {
    transform: translateY(0);
}

.btn-primary-gradient {
    background: var(--gradient-primary);
    color: #ffffff;
}

.btn-primary-gradient:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.btn-success-gradient {
    background: var(--gradient-success);
    color: #ffffff;
}

.btn-success-gradient:hover {
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.35);
}

.btn-warning-gradient {
    background: var(--gradient-warning);
    color: #ffffff;
}

.btn-warning-gradient:hover {
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.35);
}

.btn-danger-gradient {
    background: var(--gradient-danger);
    color: #ffffff;
}

.btn-danger-gradient:hover {
    box-shadow: 0 6px 20px rgba(225, 112, 85, 0.35);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-outline-success {
    background: transparent;
    border: 2px solid var(--success);
    color: var(--success);
}

.btn-outline-success:hover {
    background: var(--success);
    color: #ffffff;
}

.btn-outline-danger {
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-download {
    background: var(--gradient-success);
    color: #ffffff;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-base);
    font-family: 'Inter', sans-serif;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.35);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 14px;
}

.btn-icon:hover {
    transform: translateY(-2px);
}

.btn-icon.primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.btn-icon.primary:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-icon.success {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.btn-icon.success:hover {
    background: var(--success);
    color: #ffffff;
}

.btn-icon.danger {
    background: rgba(225, 112, 85, 0.1);
    color: var(--danger);
}

.btn-icon.danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ============================================================
   11. FORM CONTROLS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    display: block;
}

.form-control-modern {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition-base);
    outline: none;
}

.form-control-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-control-modern::placeholder {
    color: #b0b0b0;
}

.form-select-modern {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition-base);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.form-select-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.date-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition-base);
    outline: none;
}

.date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

textarea.form-control-modern {
    min-height: 100px;
    resize: vertical;
}

/* ============================================================
   12. FILTER / SEARCH BAR
   ============================================================ */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrapper input {
    padding-left: 40px;
}

/* ============================================================
   13. CHARTS
   ============================================================ */
.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chart-canvas {
    width: 100%;
    max-height: 400px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* ============================================================
   14. STATUS BADGES
   ============================================================ */
.badge-modern {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success {
    background: rgba(0, 184, 148, 0.1);
    color: #00b894;
}

.badge-warning {
    background: rgba(253, 203, 110, 0.15);
    color: #f39c12;
}

.badge-danger {
    background: rgba(225, 112, 85, 0.1);
    color: #e17055;
}

.badge-info {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.badge-secondary {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.badge-primary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot.success {
    background: var(--success);
}

.badge-dot.danger {
    background: var(--danger);
}

.badge-dot.warning {
    background: var(--warning-dark);
}

/* ============================================================
   15. PDF REPORT STYLES
   ============================================================ */
.report-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.report-header {
    border-bottom: 3px solid var(--primary);
    padding-bottom: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-logo {
    max-height: 60px;
}

.report-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.report-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.report-meta {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
}

.patient-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.info-item {
    padding: 6px 0;
}

.info-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.test-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.test-result-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition-fast);
}

.test-result-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.result-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.result-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.result-range {
    font-size: 12px;
    color: var(--text-secondary);
}

.result-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.result-status.normal {
    color: var(--success);
}

.result-status.abnormal {
    color: var(--danger);
}

.result-status.borderline {
    color: var(--warning-dark);
}

.report-footer {
    border-top: 2px solid var(--border-color);
    padding-top: 16px;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.report-section {
    margin-bottom: 24px;
}

.report-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

/* ============================================================
   16. LOADING STATES
   ============================================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-spinner.lg {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-xl);
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.loader-overlay .loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   17. TOAST / ALERT
   ============================================================ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeInRight 0.3s ease-out;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning-dark);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-message {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* ============================================================
   18. EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.empty-state-subtext {
    font-size: 13px;
    color: #bbb;
    margin-bottom: 20px;
}

/* ============================================================
   19. PAGINATION
   ============================================================ */
.pagination-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination-modern .page-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-modern .page-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.pagination-modern .page-btn.active {
    background: var(--gradient-primary);
    color: #ffffff;
}

.pagination-modern .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   20. MODAL OVERLAY
   ============================================================ */
.modal-modern-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease-out;
}

.modal-modern {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease-out;
}

.modal-modern-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-modern-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-modern-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}

.modal-modern-close:hover {
    color: var(--danger);
}

.modal-modern-body {
    padding: 24px;
}

.modal-modern-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   21. TABS
   ============================================================ */
.tabs-modern {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-modern {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.tab-modern:hover {
    color: var(--primary);
}

.tab-modern.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

/* ============================================================
   22. UTILITY CLASSES
   ============================================================ */
.d-flex {
    display: flex;
}

.d-grid {
    display: grid;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-inline-flex {
    display: inline-flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-end {
    justify-content: flex-end;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

.gap-24 {
    gap: 24px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning-dark) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.fw-400 {
    font-weight: 400;
}

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fs-12 {
    font-size: 12px;
}

.fs-13 {
    font-size: 13px;
}

.fs-14 {
    font-size: 14px;
}

.fs-16 {
    font-size: 16px;
}

.fs-18 {
    font-size: 18px;
}

.fs-20 {
    font-size: 20px;
}

.fs-24 {
    font-size: 24px;
}

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

.mb-8 {
    margin-bottom: 8px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-24 {
    margin-bottom: 24px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-24 {
    margin-top: 24px;
}

.p-0 {
    padding: 0;
}

.p-16 {
    padding: 16px;
}

.p-20 {
    padding: 20px;
}

.p-24 {
    padding: 24px;
}

.w-100 {
    width: 100%;
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.bg-light {
    background: var(--bg-light);
}

.bg-white {
    background: var(--card-bg);
}

.d-mobile {
    display: none;
}

/* ============================================================
   23. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* ============================================================
   24. PAGE TRANSITIONS
   ============================================================ */
.page-enter {
    animation: fadeInUp 0.4s ease-out;
}

.page-fade {
    animation: fadeIn 0.4s ease-out;
}

/* ============================================================
   25. GRID LAYOUTS
   ============================================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ============================================================
   26. PROGRESS BAR
   ============================================================ */
.progress-modern {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-modern {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.progress-bar-modern.primary {
    background: var(--gradient-primary);
}

.progress-bar-modern.success {
    background: var(--gradient-success);
}

.progress-bar-modern.danger {
    background: var(--gradient-danger);
}

.progress-bar-modern.warning {
    background: var(--gradient-warning);
}

/* ============================================================
   27. AVATAR GROUP
   ============================================================ */
.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* ============================================================
   28. TOOLTIP
   ============================================================ */
.tooltip-modern {
    position: relative;
}

.tooltip-modern::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--text-primary);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.tooltip-modern:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

/* ============================================================
   29. PRINT STYLES
   ============================================================ */
@media print {
    .sidebar,
    .top-navbar,
    .filter-bar,
    .btn-modern,
    .btn-download,
    .loader-overlay,
    .sidebar-toggle,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }

    .report-container {
        box-shadow: none;
        padding: 0;
    }

    body {
        background: #ffffff;
    }
}

/* ============================================================
   30. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .patient-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        transform: translateX(-100%);
    }

    .sidebar.show {
        width: var(--sidebar-width);
        transform: translateX(0);
        position: fixed;
        z-index: 10001;
    }

    .main-content {
        margin-left: 0;
    }

    .main-content.expanded {
        margin-left: 0;
    }

    .d-mobile {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .page-content {
        padding: 16px;
    }

    .top-navbar {
        padding: 0 12px;
        gap: 8px;
    }

    .navbar-title {
        font-size: 15px;
    }

    .navbar-user {
        gap: 8px;
    }

    .filter-actions {
        width: 100%;
    }

    .filter-actions .btn-modern {
        flex: 1;
        justify-content: center;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-value {
        font-size: 24px;
    }

    .report-container {
        padding: 20px;
    }

    .report-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .report-meta {
        text-align: center;
    }

    .test-results-grid {
        grid-template-columns: 1fr;
    }

    .role-tabs {
        overflow-x: auto;
    }

    .role-tab {
        min-width: 70px;
        font-size: 11px;
    }

    .login-container {
        max-width: 100%;
    }

    .glass-card {
        padding: 28px 20px;
    }

    .navbar-user .user-name {
        display: none;
    }

    .modal-modern {
        width: 95%;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .role-tab i {
        display: none;
    }

    .role-tab {
        padding: 8px 6px;
        font-size: 11px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 20px;
    }
}

/* Mobile sidebar overlay */
@media (max-width: 768px) {
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10000;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ============================================================
   31. SWEETALERT OVERRIDES (match modern theme)
   ============================================================ */
.swal2-popup {
    border-radius: var(--radius-xl) !important;
    font-family: 'Inter', sans-serif !important;
}

.swal2-confirm {
    background: var(--gradient-primary) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
    border: none !important;
}

.swal2-cancel {
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
}

/* ============================================================
   32. jQuery UI OVERRIDES
   ============================================================ */
.ui-datepicker {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    border: none !important;
    padding: 8px !important;
    font-family: 'Inter', sans-serif !important;
}

.ui-datepicker .ui-datepicker-header {
    background: var(--gradient-primary) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    color: #ffffff !important;
}

.ui-datepicker td .ui-state-active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    border: none !important;
}

.ui-datepicker td .ui-state-hover {
    background: rgba(102, 126, 234, 0.1) !important;
    color: var(--primary) !important;
    border-radius: 6px !important;
    border: none !important;
}

/* ============================================================
   END OF MODERN.CSS
   ============================================================ */
