:root {
    /* ── Neon-Clinical White Theme ────────────────────────── */
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-card-solid: #FFFFFF;
    --text-main: #0F172A;
    --text-slate: #475569;
    --text-muted: #94A3B8;
    --neon-blue: #00D4FF;
    --neon-green: #39FF14;
    --primary-blue: #0A66C2;
    --safe-green: #10B981;
    --warn-amber: #F59E0B;
    --risk-red: #EF4444;
    --border-color: #E2E8F0;
    --border-hover: #00D4FF;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-elevated: 0 12px 25px -5px rgba(0, 212, 255, 0.25);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-inter: 'Inter', -apple-system, sans-serif;
}

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

/* Core Body - Clean Clinical Vibe */
body {
    background: radial-gradient(circle at top left, #ffffff, #f1f5f9);
    color: #0f172a;
    font-family: 'Inter', system-ui, sans-serif;
    perspective: 1200px; /* Crucial for 3D effects */
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 3D Medical Card Container */
.medical-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 6px solid #00d4ff; /* Neon Blue Base */
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    
    /* 3D Transition Settings */
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

/* The Magic 3D Hover Effect */
.medical-card:hover {
    /* Lifts up, tilts in 3D space, and scales slightly */
    transform: translateY(-12px) rotateX(4deg) rotateY(-2deg) scale(1.02);
    border-left: 6px solid #39ff14; /* Shifts to Neon Green */
    
    /* Dual Neon Shadow (Blue + Green) */
    box-shadow: 
        -15px 20px 35px rgba(0, 212, 255, 0.15), 
        15px 20px 35px rgba(57, 255, 20, 0.1);
}

/* Typography & Neon Accents */
h1, h2, h3 {
    color: #1e293b;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Critical Risk Blinking Effect */
.risk-high {
    color: #ff0055;
    font-weight: 800;
    border: 1px solid rgba(255, 0, 85, 0.3);
    background: rgba(255, 0, 85, 0.05);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    animation: neon-pulse 1.5s infinite alternate; /* Alert Animation */
}

/* Smooth Entrance Animation for Output */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

/* Keyframes for Animations */
@keyframes neon-pulse {
    0% { text-shadow: 0 0 5px rgba(255, 0, 85, 0.2); box-shadow: 0 0 5px rgba(255, 0, 85, 0.1); }
    100% { text-shadow: 0 0 15px rgba(255, 0, 85, 0.8); box-shadow: 0 0 15px rgba(255, 0, 85, 0.3); }
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.4);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.6);
}

/* Ambient Background */
.ambient-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.04), transparent 45%),
                radial-gradient(circle at 80% 90%, rgba(57, 255, 20, 0.03), transparent 45%);
}

/* Header */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--neon-blue), #6366f1);
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.logo-container h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.logo-container h1 span {
    font-weight: 400;
    color: var(--text-slate);
}

nav a {
    text-decoration: none;
    color: var(--text-slate);
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0 1rem;
    transition: color 0.2s ease;
}

nav a:hover, nav a.active {
    color: var(--neon-blue);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.user-profile { display: flex; align-items: center; }

.avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--neon-blue), #6366f1);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.hidden {
    display: none !important;
}

/* Upload Section */
.upload-dashboard {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.header-text h2 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.header-text p {
    color: var(--text-slate);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

/* Neon-Clinical Drop Zone */
.drop-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-left: 4px solid var(--neon-blue);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--neon-blue);
    border-left-color: var(--neon-green);
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
}

.drop-icon svg {
    width: 48px;
    height: 48px;
    color: var(--neon-blue);
    margin-bottom: 1rem;
}

.drop-zone h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.drop-zone p {
    color: var(--text-slate);
    font-size: 0.95rem;
}

/* Bright & Clean Medical Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--neon-blue);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Neon Glow Hover Effect */
.card:hover {
    transform: translateY(-4px);
    border-left-color: var(--neon-green);
    box-shadow: var(--shadow-elevated);
}

.premium-card {
    background: var(--bg-card);
    border-top: 3px solid var(--neon-blue);
    border-left: none;
}

.premium-card:hover {
    border-top-color: var(--neon-green);
    border-left: none;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.card-header svg {
    width: 20px;
    height: 20px;
    color: var(--neon-blue);
}

.card-header h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
}

.card h4 {
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.text-slate {
    color: var(--text-slate);
}

.entity-list {
    list-style: none;
}

.entity-list li {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-slate);
    border-left: 3px solid var(--border-color);
    transition: all 0.2s ease;
}

.entity-list li:hover {
    border-left-color: var(--neon-blue);
    color: var(--text-main);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.1);
}

.risk-list li {
    border-left-color: var(--risk-red);
    background: rgba(239, 68, 68, 0.05);
    color: #991B1B;
}

.risk-list li:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dashboard-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}
.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

.entities-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Observability */
.observability-card {
    position: sticky;
    top: 6rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.chart-container {
    position: relative;
    height: 200px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.metric-box {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.metric-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--neon-blue);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.2);
}

/* Neon Text Accents */
.highlight-text {
    color: var(--neon-blue);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
    font-weight: 600;
}

.status-safe {
    color: var(--neon-green);
    background: rgba(57, 255, 20, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(57, 255, 20, 0.3);
}

/* Badges */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.results-header h2 {
    color: var(--text-main);
}

.badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-primary {
    background: rgba(0, 212, 255, 0.1);
    color: #0891B2;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warn-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 380px;
    height: 500px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 212, 255, 0.08);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom right;
}

.chat-header {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-green);
    box-shadow: 0 0 6px rgba(57, 255, 20, 0.5);
}

.status-indicator.online {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(57, 255, 20, 0.4); }
    50% { box-shadow: 0 0 12px rgba(57, 255, 20, 0.8); }
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    width: 24px;
    height: 24px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.icon-btn:hover { opacity: 1; }

.chat-body {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--neon-blue), #0284C7);
    color: white;
    border-bottom-right-radius: 2px;
}

.msg-ai {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
    box-shadow: var(--shadow-soft);
}

.chat-input-area {
    padding: 1rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.chat-input-area input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    outline: none;
    font-family: var(--font-inter);
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-area input::placeholder {
    color: var(--text-muted);
}

.chat-input-area input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

#chat-send-btn {
    background: linear-gradient(135deg, var(--neon-blue), #0284C7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

#chat-send-btn svg { width: 18px; height: 18px; }

/* Responsive */
@media (max-width: 900px) {
    .grid-layout, .summary-cards { grid-template-columns: 1fr; }
    .chat-widget { width: 100%; height: 100%; bottom: 0; right: 0; border-radius: 0; }
    .header-text h2 { font-size: 1.8rem; }
}

/* Switch Toggle Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 24px;
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider-switch {
  background-color: #00D4FF;
}

input:checked + .slider-switch:before {
  transform: translateX(20px);
}
