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

:root {
    /* Colors - Light Mode (Default) */
    --bg-body: #f1f5f9;
    --bg-white: #ffffff;
    --card-bg: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --primary-blue: #3b82f6;
    --primary-indigo: #4f46e5;
    --success-green: #10b981;
    --danger-red: #ef4444;
    --warning-orange: #f59e0b;
    --dark-btn: #111827;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;

    /* Sizing */
    --sidebar-width: 280px;
    --card-radius: 12px;
    --btn-radius: 99px;

    /* Shadows */
    --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

body.dark-mode {
    --bg-body: #020617;
    --bg-white: #0f172a;
    --card-bg: #111827;
    --sidebar-bg: #000000;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --border-color: #1e293b;
    --input-bg: #1e293b;
    --input-border: #334155;

    --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 50;
    font-weight: 500;
}

/* Collapsed Sidebar State - Fully Hidden */
.sidebar.collapsed {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    /* Keep width but move it */
}

/* Ensure text is visible when NOT collapsed */
.user-profile,
.nav-title,
.nav-item-left,
.badge,
.brand-logo,
.sidebar-header>div:last-child {
    opacity: 1;
    transition: opacity 0.2s;
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 2.5rem;
    justify-content: space-between;
    flex-direction: column;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-shape {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Creating the blue diamond-ish logo shape */
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 8px 0 8px 0;
}

.logo-shape i {
    color: white;
    font-size: 1.2rem;
}

.notification-bell {
    position: relative;
    color: #94a3b8;
    cursor: pointer;
}

.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--success-green);
    border-radius: 50%;
    border: 2px solid #0f172a;
}

.user-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #374151;
    margin-bottom: 1rem;
    object-fit: cover;
}

.user-name {
    color: var(--sidebar-active-text);
    font-weight: 600;
    font-size: 1rem;
}

.user-email {
    font-size: 0.875rem;
    color: var(--sidebar-text);
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-title {
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    /* Darker grey for labels */
    margin-bottom: 1rem;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    font-size: 0.925rem;
}

.nav-item-left {
    display: flex;
    align-items: center;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: #e2e8f0;
}

.nav-item.active {
    background-color: #1e293b;
    /* Slightly lighter than sidebar bg */
    color: #e2e8f0;
    /* White text */
}

.dropdown-chevron {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.nav-item.open .dropdown-chevron {
    transform: rotate(90deg);
}

.nav-sub-items {
    padding-left: 2rem;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    max-height: 500px;
    /* Large enough for content */
    opacity: 1;
}

.nav-sub-items.collapsed {
    max-height: 0;
    opacity: 0;
}

.nav-icon {
    margin-right: 14px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
    color: var(--primary-blue);
    /* Only icon is blue in active state in some designs, or user text too. Let's make icon blue. */
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success-green);
    /* Or blue */
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* When expanded (sidebar is visible), margin is correct. 
   When sidebar is collapsed (hidden), margin should be 0. 
   Wait, script toggles .collapsed on sidebar. 
   If sidebar is collapsed, it translates -100%. Main content should fill space. */
.sidebar.collapsed+.main-content {
    /* Use adjacent sibling if possible, but DOM structure might be nested differently. JS toggles .expanded on main-content too */
    margin-left: 0 !important;
    width: 100% !important;
}

/* Helper class toggled by JS on main-content */
.main-content.expanded {
    margin-left: 0;
    width: 100%;
}

/* Container for both to potentially share bg if needed, but we will style children */
.header-wrapper {
    background-color: var(--bg-white);
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    padding: 1.5rem 2.5rem;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* Header (Top Navbar) */
header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Settings Toggles */
.settings-toggles {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: 1.25rem;
    border-right: 1px solid var(--border-color);
    margin-right: 0.5rem;
}

.toggle-btn {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.875rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.toggle-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background-color: rgba(59, 130, 246, 0.04);
}

.toggle-btn i {
    font-size: 1rem;
    opacity: 0.8;
}

/* Theme toggle icon switching */
#theme-toggle .fa-sun {
    display: none;
}

.dark-mode #theme-toggle .fa-moon {
    display: none;
}

.dark-mode #theme-toggle .fa-sun {
    display: inline-block;
    color: #fbbf24;
}

.header-left {
    display: flex;
    align-items: center;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Dropdown Menu Styles */
.dropdown-menu {
    background-color: #ffffff !important;
    /* Force white background */
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    /* Stronger shadow */
    padding: 0.5rem;
    min-width: 160px;
    z-index: 9999;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.2s ease;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.welcome-section {
    padding: 2rem 2.5rem 0rem 2.5rem;
    /* Added padding here instead of header-wrapper */
    background: var(--bg-white);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0;
    /* No margin bottom, attached to top */
    padding-bottom: 2rem;
    /* Give some space */
}

.welcome-text h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.welcome-text p {
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--btn-radius);
    border: none;
    font-weight: 600;
    font-size: 0.925rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: transform 0.1s;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

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

.btn-primary {
    background-color: var(--sidebar-bg);
    color: white;
}

.btn-secondary {
    background-color: var(--primary-indigo);
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Shared Card Styles */
.stat-card {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    background: var(--bg-white);
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* Border Glow Layer */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    /* Border thickness */
    background: radial-gradient(400px circle at var(--mouse-x) var(--mouse-y),
            rgba(37, 99, 235, 0.3),
            transparent 40%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 1;
}

/* Surface Spotlight Layer */
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y),
            rgba(37, 99, 235, 0.04),
            transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 0;
}

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

.stat-card,
.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.stat-card:hover,
.card:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-align: center;
}

.stat-label {
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.stat-footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Specific Colors for Stats */
.text-blue {
    color: var(--primary-blue);
}

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

.text-orange {
    color: var(--warning-orange);
}

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

/* Main Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    /* 60/40 rough split */
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-section,
.schedule-section {
    background: var(--bg-white);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    min-height: 300px;
    box-shadow: var(--shadow-sm);
}

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

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0 1rem 0;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pill-switch {
    /* background: var(--input-bg); */
    padding: 3px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    z-index: 0;
}

.pill-opt {
    padding: 0.5rem 1.125rem;
    border-radius: 99px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
    background: transparent;
}

.pill-opt:hover {
    color: var(--text-primary);
}

.pill-opt.active {
    color: var(--text-primary);
}

.switch-glider {
    position: absolute;
    top: 3px;
    left: 3px;
    height: calc(100% - 6px);
    background: var(--card-bg);
    border-radius: 99px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
}

.pill-opt.active {
    background: transparent;
    /* Remove static bg */
    box-shadow: none;
    /* Remove static shadow */
    color: var(--text-primary);
    font-weight: 600;
}

/* Task Distribution Placeholder */
.distribution-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
}

/* Schedule List */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.schedule-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.schedule-item:last-child {
    border-bottom: none;
}

.sched-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sched-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.sched-meta i {
    width: 16px;
}

/* Bottom Stats */
.bottom-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    /* Connected in design */
    background: var(--bg-white);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.bottom-stat-card {
    padding: 2rem;
    text-align: center;
    border-right: 1px solid var(--border-color);
}

.bottom-stat-card:last-child {
    border-right: none;
}

.bg-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.bg-label {
    color: var(--text-secondary);
}

.schedule-item:hover {
    background-color: #f8fafc;
    padding-left: 0.5rem;
    /* Subtle shift */
    border-radius: 8px;
}

/* Chart Animation */
.distribution-placeholder>div {
    animation: growBar 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform-origin: bottom;
}

@keyframes growBar {
    from {
        transform: scaleY(0);
        opacity: 0;
    }

    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .bottom-stat-card:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

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

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .header-wrapper {
        padding: 1rem;
    }

    header {
        padding: 0 1rem;
    }

    .welcome-section {
        padding: 1.5rem 1rem 1rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .content-wrapper {
        padding: 1rem;
    }

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

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

    .sidebar {
        /* On mobile, maybe we want it hidden by default? 
           The current simple logic is desktop-first. 
           Let's leave logic as is for now, but ensure it overlays content if opened on mobile. */
        width: 280px;
        /* Fixed width */
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }
}

/* Patients Table Styles */
.table-card {
    border-radius: 16px !important;
    margin-top: 1.5rem;
    padding: 0;
    overflow: hidden;
}

.table-card-header {
    padding: 1rem 1.5rem 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.patients-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}

.patients-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.patients-table td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.925rem;
    color: var(--text-primary);
}

.patients-table tr:hover td {
    background-color: rgba(0, 0, 0, 0.02);
}

.dark-mode .patients-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

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

.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: #dcfce7;
    color: #11b981;
}

.status-pending {
    background: #fff7ed;
    color: #f59e0b;
}

.status-critical {
    background: #fee2e2;
    color: #ef4444;
}

/* Dark mode badge adjustments */
.dark-mode .status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.dark-mode .status-pending {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

.dark-mode .status-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.icon-btn-sm {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

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

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

/* Refactored Inline Styles */

/* Sidebar */
.sidebar-logo-img {
    width: 200px;
    height: 54px;
}

.nav-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Header */
.header-toggle-btn {
    margin-right: 1rem;
}

.header-right-flex {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-search-wrapper {
    position: relative;
}

.header-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
}

.header-search-input {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    font-size: 0.9rem;
    background: #f8fafc;
    color: var(--text-primary);
    width: 240px;
    outline: none;
    transition: all 0.2s;
}

.dark-mode .header-search-input {
    background: var(--input-bg);
}

.date-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.dark-mode .date-widget {
    background: var(--input-bg);
}

/* Welcome Section */
.welcome-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.welcome-avatar {
    width: 56px;
    height: 56px;
    margin: 0;
}

.welcome-icon {
    margin-right: 0.5rem;
}

/* Table Section */
.table-card-header {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.table-search-wrapper {
    position: relative;
}

.table-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
}

.table-search-input {
    padding: 0.5rem 0.5rem 0.5rem 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    background: #f8fafc;
    color: var(--text-primary);
}

.dark-mode .table-search-input {
    background: var(--input-bg);
}

.btn-add-patient {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Table Content */
.patient-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.patient-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.patient-name {
    font-weight: 500;
}

.badge-stage-blue {
    background: #eff6ff;
    color: #1e40af;
    border-radius: 6px;
    padding: 4px 8px;
}

.badge-stage-red {
    background: #fef2f2;
    color: #991b1b;
    border-radius: 6px;
    padding: 4px 8px;
}

.badge-stage-green {
    background: #f0fdf4;
    color: #166534;
    border-radius: 6px;
    padding: 4px 8px;
}

.badge-stage-orange {
    background: #fff7ed;
    color: #9a3412;
    border-radius: 6px;
    padding: 4px 8px;
}

/* Form Styles */
.form-compact-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem 1rem;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-4 {
    grid-column: span 4;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-label.required::before {
    content: "* ";
    color: var(--danger-red);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: all 0.2s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    /* Darker border */
    border-radius: 8px;
    overflow: hidden;
}

.input-group .input-prefix {
    background: #f8fafc;
    padding: 0.6rem 0.85rem;
    border-right: 1px solid #cbd5e1;
    /* Match border */
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-group .form-input {
    border: none;
    border-radius: 0;
}

.input-group:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Mobile Responsive Form */
@media (max-width: 768px) {
    .form-compact-grid {
        grid-template-columns: 1fr;
    }

    .col-span-2,
    .col-span-4 {
        grid-column: span 1;
    }
}

/* Colposcopy Page Styles - Compact & Premium */
.colposcopy-layout {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 1.5rem;
    height: calc(100vh - 120px);
}

/* Camera Section - Modern & Deep */
.camera-section {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: #0f172a;
    border-radius: 8px;
    /* Sharper corners */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.camera-container {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    /* Depth */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    /* Slight fade for cinematic look */
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #475569;
    gap: 0.5rem;
}

.camera-placeholder i {
    font-size: 2.5rem;
    opacity: 0.5;
}

.ai-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Corner brackets for tech feel */
.ai-overlay::before,
.ai-overlay::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: rgba(16, 185, 129, 0.5);
    border-style: solid;
    transition: all 0.3s;
}

.ai-overlay::before {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
    border-radius: 4px 0 0 0;
}

.ai-overlay::after {
    bottom: 0;
    right: 0;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 4px 0;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
    animation: scan 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scan {
    0% {
        top: 0%;
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    95% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.live-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 8px #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }

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

.ai-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.ai-badge.high-risk {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(239, 68, 68, 0.5);
}

.ai-badge.chronic {
    background: rgba(234, 88, 12, 0.85);
    border-color: rgba(251, 146, 60, 0.5);
}

.ai-badge.healthy {
    background: rgba(22, 163, 74, 0.85);
    border-color: rgba(74, 222, 128, 0.5);
}

/* Camera Controls Overlay */
.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: auto;
}

/* Capture Button - Glowing Pulse */
.btn-capture {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

/* Inner circle */
.btn-capture::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: white;
    z-index: -1;
    transition: inherit;
}

.btn-capture i {
    color: #0f172a;
    z-index: 2;
}

.btn-capture:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.btn-capture:active {
    transform: scale(0.95);
}

/* Right Panel Styles */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.results-section .card {
    border: 1px solid var(--border-color);
    box-shadow: none;
    margin: 0;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 columns for larger images */
    gap: 12px;
    padding: 0.5rem 0;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Camera Selector */
.camera-selector-wrapper {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.85rem;
}

.camera-select {
    background: transparent;
    border: none;
    color: white;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    cursor: pointer;
    max-width: 200px;
}

.camera-select option {
    background: #0f172a;
    color: white;
}

/* Filter Controls */
.filter-controls {
    position: absolute;
    left: 20px;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px;
    border-radius: 99px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-filter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-filter:hover {
    transform: scale(1.1);
}

.btn-filter.active {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.btn-filter[data-filter="default"] {
    background: #64748b;
}

.btn-filter[data-filter="green"] {
    background: #22c55e;
}

.btn-filter[data-filter="blue"] {
    background: #3b82f6;
}

/* Video Filters */
.video-filter-green {
    filter: contrast(1.2) brightness(1.1) saturate(0) sepia(1) hue-rotate(90deg) !important;
}

.video-filter-blue {
    filter: contrast(1.2) brightness(1.1) saturate(0) sepia(1) hue-rotate(190deg) !important;
}

.video-filter-default {
    filter: none !important;
}

/* Gallery - Hover Effects */
.gallery-item {
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Compact Diagnosis */
.diagnosis-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.diagnosis-option input {
    display: none;
    /* Ensure radio buttons are hidden */
}

/* Diagnosis Cards - Compact */
.d-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0.5rem 0.25rem;
    border: 1px solid transparent;
    /* Cleaner border */
    border-radius: 6px;
    /* Reduced from 12px */
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
    position: relative;
    overflow: hidden;
}

.d-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.d-card i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.diagnosis-option input:checked+.d-card.healthy {
    background: #f0fdf4;
    border-color: #166534;
    color: #166534;
}

.diagnosis-option input:checked+.d-card.chronic {
    background: #fff7ed;
    border-color: #9a3412;
    color: #9a3412;
}

.diagnosis-option input:checked+.d-card.suspicious {
    background: #fef2f2;
    border-color: #991b1b;
    color: #991b1b;
}

/* AI Result Compact */
.ai-result-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.ai-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.confidence-bar-compact {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
}