/* Global Styles */
:root {
    --primary-color: #007BFF;
    --secondary-color: #E9ECEF;
    --accent-color: #5CADFF;
    --danger-color: #DC3545;
    --danger-color-rgb: 220, 53, 69;
    
    /* Light Mode Defaults */
    --text-color: #212529;
    --bg-color: #F8F9FA; /* This will be mostly covered by the bubble background */
    --card-bg: rgba(255, 255, 255, 0.65); 
    --sidebar-bg: rgba(255, 255, 255, 0.6); 
    --border-color: rgba(0, 0, 0, 0.1); 
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08); /* Keeping this as is for now */
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08); /* Standard shadow */
    --input-bg: rgba(255, 255, 255, 0.7); 
    --secondary-btn-bg: rgba(233, 236, 239, 0.7); 
    --secondary-btn-hover-bg: rgba(222, 226, 230, 0.85); 
    --nav-item-hover-bg: rgba(0, 123, 255, 0.08); 
    --nav-item-active-bg: rgba(0, 123, 255, 0.15); 
    --table-header-bg: rgba(255, 255, 255, 0.7); 
    --table-row-hover-bg: rgba(0, 123, 255, 0.05); /* Primary at 5% opacity */
    --chat-bubble-user-bg: rgba(0, 123, 255, 0.9); 
    --chat-bubble-user-text: #FFFFFF;
    --chat-bubble-bot-bg: rgba(233, 236, 239, 0.85); 
    --chat-bubble-bot-text: var(--text-color);
    --loading-spinner-border: rgba(0, 123, 255, 0.15); 
    --result-section-bg: rgba(255, 255, 255, 0.55); 
    --disclaimer-bg: rgba(220, 53, 69, 0.08); 
    --disclaimer-border: rgba(220, 53, 69, 0.2); 
    --disclaimer-text: var(--text-color);
    --disclaimer-icon: var(--danger-color);
    --disclaimer-close: #ADB5BD;
    --disclaimer-close-hover: var(--danger-color);
    --user-icon-color: #ADB5BD; 
    --glass-blur: 12px;

    /* Bubbles Animation CSS Variables START */
    --color-bg1: rgb(248, 249, 250);
    --color-bg2: rgb(233, 236, 239);
    --color1: 70, 130, 180; /* Steel Blue */
    --color2: 77, 175, 159; /* Soft Teal */
    --color3: 238, 150, 100; /* Desaturated Coral */
    --color4: 150, 120, 180; /* Muted Amethyst */
    --color5: 220, 180, 100; /* Soft Gold */
    --color-interactive: 70, 130, 180; /* Steel Blue */
    --circle-size: 80%;
    --blending: hard-light;
    /* Bubbles Animation CSS Variables END */
}

/* Dark Mode Variables */
body.dark-mode {
    --primary-color: #6495ED;
    --secondary-color: #718096;
    --accent-color: #5385D1;
    --danger-color: #EF5350;
    --danger-color-rgb: 239, 83, 80;

    --text-color: rgba(255, 255, 255, 0.87);
    --bg-color: #121212; /* This will be mostly covered by the bubble background */
    --card-bg: rgba(30, 30, 30, 0.75); /* #1E1E1E at 75% opacity */
    --sidebar-bg: rgba(30, 30, 30, 0.75); /* #1E1E1E at 75% opacity */
    --border-color: rgba(255, 255, 255, 0.12); /* Standard border for dark themes */
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.25); /* Checked: OK, generic shadow */
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); /* Checked: OK, generic shadow */
    --input-bg: rgba(30, 30, 30, 0.8); /* #1E1E1E at 80% opacity */
    --secondary-btn-bg: rgba(30, 30, 30, 0.7); /* #1E1E1E at 70% opacity */
    --secondary-btn-hover-bg: rgba(45, 45, 45, 0.8); /* A slightly lighter gray for hover, e.g. #2D2D2D at 80% */
    --nav-item-hover-bg: rgba(100, 149, 237, 0.08); 
    --nav-item-active-bg: rgba(100, 149, 237, 0.15); 
    --table-header-bg: rgba(30, 30, 30, 0.7);
    --table-row-hover-bg: rgba(45, 45, 45, 0.7); /* Lighter gray for hover */
    --chat-bubble-user-bg: rgba(100, 149, 237, 0.9); 
    --chat-bubble-user-text: #121212; /* New main dark bg for contrast */
    --chat-bubble-bot-bg: rgba(30, 30, 30, 0.9); /* New Card bg color at 90% opacity */
    --chat-bubble-bot-text: rgba(255, 255, 255, 0.87); /* Ensure bot text uses the main text color */
    --loading-spinner-border: rgba(100, 149, 237, 0.15); 
    --result-section-bg: rgba(30, 30, 30, 0.6); /* New Card bg color at 60% opacity */
    --disclaimer-bg: rgba(239, 83, 80, 0.08); /* New Danger color at 8% opacity */
    --disclaimer-border: rgba(239, 83, 80, 0.2); /* New Danger color at 20% opacity */
    --disclaimer-text: rgba(255, 255, 255, 0.60); /* Medium emphasis text */
    --disclaimer-icon: var(--danger-color);
    --disclaimer-close: rgba(255, 255, 255, 0.60); /* Medium emphasis text */
    --disclaimer-close-hover: var(--danger-color);
    --user-icon-color: rgba(255, 255, 255, 0.60); /* Medium emphasis text */

    /* Bubbles Animation Dark Mode CSS Variables (if any specific changes needed, none provided so defaults apply) */
    --color-bg1: rgb(20, 25, 35);
    --color-bg2: rgb(10, 15, 25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Styles from Bubbles Animation START */
html, body {
    /* font-family: 'Dongle', sans-serif; -- Removed, MediSense uses Segoe UI */
    margin: 0; /* Kept */
    padding: 0; /* Kept */
    overflow: auto; /* Kept - To prevent scrollbars from the moving interactive element */
}

/* .text-container rule removed as the element is removed */

@keyframes moveInCircle {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes moveVertical {
    0% {
        transform: translateY(-50%);
    }
    50% {
        transform: translateY(50%);
    }
    100% {
        transform: translateY(-50%);
    }
}

@keyframes moveHorizontal {
    0% {
        transform: translateX(-50%) translateY(-10%);
    }
    50% {
        transform: translateX(50%) translateY(10%);
    }
    100% {
        transform: translateX(-50%) translateY(-10%);
    }
}

.gradient-bg {
    width: 100vw;
    height: 100vh;
    position: fixed; /* Changed from relative for background behavior */
    z-index: -1; /* To ensure it's behind other content */
    overflow: hidden;
    background: linear-gradient(40deg, var(--color-bg1), var(--color-bg2));
    top: 0;
    left: 0;
}

.gradient-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(45deg, rgba(0,0,0,0.015) 25%, transparent 25%),
                      linear-gradient(-45deg, rgba(0,0,0,0.015) 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.015) 75%),
                      linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.015) 75%);
    background-size: 2px 2px; /* Small pixel pattern for grain */
    pointer-events: none; /* Ensure it doesn't interfere with interactions */
    z-index: 0; /* Position it above the gradient background but below other content */
    opacity: 0.3; /* Adjust for subtlety - this can be fine-tuned */
}

.gradient-bg svg { /* SVG for the goo filter, hidden */
    position: fixed; /* Changed from absolute to fixed to align with .gradient-bg */
    top: 0;
    left: 0;
    width: 0;
    height: 0;
}

.gradient-bg .gradients-container {
    filter: url(#goo) blur(40px);
    width: 100%;
    height: 100%;
}

.gradient-bg .g1 {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color1), 0.8) 0, rgba(var(--color1), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    transform-origin: center center;
    animation: moveVertical 30s ease infinite;
    opacity: 1;
}

.gradient-bg .g2 {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color2), 0.8) 0, rgba(var(--color2), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    transform-origin: calc(50% - 400px);
    animation: moveInCircle 20s reverse infinite;
    opacity: 1;
}

.gradient-bg .g3 {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color3), 0.8) 0, rgba(var(--color3), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2 + 200px);
    left: calc(50% - var(--circle-size) / 2 - 500px);
    transform-origin: calc(50% + 400px);
    animation: moveInCircle 40s linear infinite;
    opacity: 1;
}

.gradient-bg .g4 {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color4), 0.8) 0, rgba(var(--color4), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    transform-origin: calc(50% - 200px);
    animation: moveHorizontal 40s ease infinite;
    opacity: 0.7;
}

.gradient-bg .g5 {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color5), 0.8) 0, rgba(var(--color5), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: calc(var(--circle-size) * 2);
    height: calc(var(--circle-size) * 2);
    top: calc(50% - var(--circle-size));
    left: calc(50% - var(--circle-size));
    transform-origin: calc(50% - 800px) calc(50% + 200px);
    animation: moveInCircle 20s ease infinite;
    opacity: 1;
}

.gradient-bg .interactive {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color-interactive), 0.8) 0, rgba(var(--color-interactive), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: 100%; /* This will be a large circle following the mouse */
    height: 100%;
    top: -50%; /* Centering the large circle, transform will move it */
    left: -50%;
    opacity: 0.7;
    /* transform is set by JavaScript */
}
/* Styles from Bubbles Animation END */

body {
    color: var(--text-color);
    line-height: 1.6;
    transition: color 0.3s;
    background-color: var(--bg-color); /* Fallback, mostly covered by .gradient-bg */
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    transition: color 0.3s;
}

.logo-container h1 {
    /* margin-top: 12px; Default from h1,h2,h3 rule is 1rem bottom, and this is often enough */
    margin-bottom: 0.5rem; /* Retained from previous inline style logic */
}

/* Specific adjustment for logo H1 in auth cards and sidebar if needed */
.auth-card .logo-container h1,
.sidebar .logo-container h1 {
    margin-top: 12px; /* Explicitly adding back the 12px top margin for these specific contexts */
}


/* Button Styles */
button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--chat-bubble-user-text); /* Changed from white to use variable */
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.1);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    filter: brightness(90%);
    box-shadow: 0 4px 12px rgba(31, 38, 135, 0.15);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-btn-bg);
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.05);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--secondary-btn-hover-bg);
    box-shadow: 0 4px 12px rgba(31, 38, 135, 0.1);
    transform: translateY(-2px);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, textarea, select.symptom-dropdown /* Added select here */ {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.05);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

input:focus, textarea:focus, select.symptom-dropdown:focus /* Added select here */ {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.password-container {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #9aa0a6; 
}

body.dark-mode .toggle-password {
    color: #9aa0a6; 
}

.error-message {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Authentication Styles */
#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative; /* Ensures it's in the normal flow above z-index -1 background */
    z-index: 1; /* Explicitly set above background */
}

.auth-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.18);
}

#signup-card {
    display: none;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-right: 10px;
    transition: color 0.3s;
}

.form-switch {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.form-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.form-switch a:hover {
    text-decoration: underline;
}

/* App Layout Styles */
.hidden {
    display: none !important;
}

#app-container {
    display: flex;
    min-height: 100vh;
    position: relative; /* Ensures it's in the normal flow above z-index -1 background */
    z-index: 1; /* Explicitly set above background */
}

.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: all 0.3s ease;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    z-index: 10; /* Higher than app-container's base z-index */
}

.sidebar .logo-container {
    margin-bottom: 2rem;
}

.nav-links {
    list-style: none;
    margin-bottom: 2rem;
    flex-grow: 1;
}



.emergency-card {
    margin-bottom: 1.5rem;
    background-color: rgba(var(--danger-color-rgb), 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(var(--danger-color-rgb), 0.1);
    box-shadow: 0 2px 8px rgba(var(--danger-color-rgb), 0.05);
    max-width: 100%;
}

.emergency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emergency-header:hover {
    background-color: rgba(var(--danger-color-rgb), 0.08);
}

.emergency-card h3 {
    color: var(--danger-color);
    font-size: 1rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.emergency-toggle-icon {
    color: var(--danger-color);
    transition: transform 0.3s ease;
}

.emergency-toggle-icon.active {
    transform: rotate(180deg);
}

.emergency-card .emergency-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    opacity: 0;
}

.emergency-card .emergency-list.active {
    max-height: 300px;
    padding: 0.5rem 1rem 1rem;
    opacity: 1;
}

.emergency-card .emergency-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.emergency-card .emergency-item:hover {
    background-color: rgba(var(--danger-color-rgb), 0.08);
}

.emergency-card .emergency-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.emergency-card .emergency-label {
    color: var(--text-color);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emergency-card .emergency-number {
    color: var(--danger-color);
    text-decoration: none;
    margin-left: auto;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.emergency-card .emergency-number:hover {
    background-color: rgba(var(--danger-color-rgb), 0.15);
}


.nav-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-out;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.nav-item i {
    margin-right: 10px;
    font-size: 1.2rem;
    transition: transform 0.2s ease-out;
}

.nav-item:hover {
    background-color: var(--nav-item-hover-bg);
    transform: translateX(4px);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background-color: var(--nav-item-active-bg);
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-item.active i {
    transform: scale(1.1);
}
    


.nav-item i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.nav-item:hover {
    background-color: var(--nav-item-hover-bg);
    transform: translateX(4px);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background-color: var(--nav-item-active-bg);
    color: var(--primary-color);
    font-weight: 500;
}

.user-section {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    transition: border-color 0.3s;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.user-info i {
    font-size: 1.5rem;
    margin-right: 10px;
    color: var(--user-icon-color); 
    transition: color 0.3s;
}

#logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem; 
}

#logout-btn i {
    margin-right: 8px;
}

#dark-mode-toggle { 
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    margin-bottom: 0.5rem; 
}

#dark-mode-toggle i {
    margin-right: 8px;
}

.main-content {
    flex-grow: 1;
    margin-left: 250px;
    padding: 2rem;
    padding-bottom: 80px; /* Ensure space for disclaimer if it's at bottom of main-content */
    position: relative; /* Added for stacking context if needed */
    z-index: 5; /* Above app-container's base but below sidebar/modals */
}

/* Page Styles */
.page {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Prediction Page Styles */
.input-container {
    margin-bottom: 2rem;
}

.results-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.results-row > .result-section {
    flex: 1;
    margin-bottom: 0;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.result-section {
    background-color: var(--result-section-bg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.7));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.7));
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.1);
}

.result-section h3 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

/* Chatbot Page Styles */
.chat-container {
    background-color: var(--result-section-bg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.7));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.7));
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.1);
    display: flex;
    flex-direction: column; 
}

.chat-messages {
    overflow-y: auto;
    padding: 1.5rem;
    flex-grow: 1;
    /* max-height: 500px; -- Using fixed height on .chat-container instead */
}

.message {
    display: flex;
    margin-bottom: 1.5rem;
}

/* Message Bubbles */
.message-content {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.6;
}

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

.user-message .message-content {
    background-color: var(--chat-bubble-user-bg);
    color: var(--chat-bubble-user-text);
    border-bottom-right-radius: 5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.05);
}

.bot-message .message-content {
    background-color: var(--chat-bubble-bot-bg);
    color: var(--chat-bubble-bot-text);
    border-bottom-left-radius: 5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.05);
}

/* Chat Input Container */
.chat-input-container {
    position: fixed;
    left: 250px;
    bottom: 0;
    width: calc(100% - 250px);
    z-index: 100;
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    background-color: var(--card-bg);
    box-shadow: 0 -4px 16px rgba(31, 38, 135, 0.1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

@media (max-width: 768px) {
    .chat-input-container {
        left: 0;
        width: 100%;
    }
}

#chat-input {
    flex-grow: 1;
    margin-right: 10px;
}

#send-message-btn {
    padding: 10px 15px;
    margin-right: 10px;
}

#clear-chat-btn {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#clear-chat-btn i {
    font-size: 1rem;
}

/* History Page Styles */
.history-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s;
}

th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    transition: background-color 0.3s;
}

tr:hover {
    background-color: var(--table-row-hover-bg);
    transition: background-color 0.2s;
}

#no-history-message {
    padding: 2rem;
    text-align: center;
    color: #777; /* Consider var(--text-color) with opacity */
}

/* Loading Styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-container video {
    display: block;
    width: 300px;
    height: 300px;
    margin: 0 auto 1rem auto;
    object-fit: cover; /* Ensures video covers the dimensions */
}

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

/* Disclaimer Banner */
.disclaimer-banner {
    position: fixed;
    bottom: 0;
    left: 250px; /* Aligns with main content area */
    width: calc(100% - 250px); /* Aligns with main content area */
    background-color: var(--disclaimer-bg);
    border-top: 1px solid var(--disclaimer-border);
    padding: 0.8rem 2rem;
    display: none;  /* Hide by default, JS will show it */
    align-items: center;
    z-index: 99; /* Below chat input, above most content */
    box-sizing: border-box; 
    transition: all 0.3s ease;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}   

/* Show disclaimer only when app container is visible */
#app-container:not(.hidden) ~ .disclaimer-banner {
    display: flex;
}

.disclaimer-banner i {
    color: var(--disclaimer-icon); 
    font-size: 1.2rem;
    margin-right: 1rem;
    transition: color 0.3s;
}

.disclaimer-banner p {
    font-size: 0.9rem;
    color: var(--disclaimer-text); 
    flex-grow: 1;
    transition: color 0.3s;
}

.disclaimer-banner .close-btn {
    background: none;
    border: none;
    color: var(--disclaimer-close); 
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 1rem;
    transition: color 0.3s;
}

.disclaimer-banner .close-btn:hover {
    color: var(--disclaimer-close-hover); 
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: all 0.3s ease;
        z-index: 1000;
        width: 280px;
        box-shadow: none;
        background-color: var(--card-bg);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--glass-shadow);
    }
    
    .prediction-item {
        display: flex;
        align-items: center;
    }

    .prediction-item strong {
        margin-right: 10px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding-bottom: 120px; /* Increased to accommodate chat input and disclaimer */
    }
    
    .menu-toggle {
        display: flex;
        position: fixed;
        top: 1rem;
        right: 1rem; /* Changed from left to right */
        z-index: 1001;
        background: var(--card-bg);
        color: var(--text-color);
        border-radius: 8px;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border-color);
        backdrop-filter: blur(var(--glass-blur));
        -webkit-backdrop-filter: blur(var(--glass-blur));
        box-shadow: var(--glass-shadow);
        transition: all 0.3s ease;
    }

    .menu-toggle:hover {
        background: var(--secondary-btn-hover-bg);
        transform: translateY(-2px);
    }

    .menu-toggle i {
        font-size: 1.2rem;
        transition: transform 0.3s ease;
    }

    .sidebar.active + .menu-toggle i {
        transform: rotate(90deg);
    }
    
    .results-row {
        flex-direction: column;
    }

    .results-row > .result-section {
        margin-bottom: 1.5rem;
    }
    
    .page {
        padding: 1.5rem;
    }
    
    .result-section {
        padding: 1rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    #app-container:not(.hidden) ~ .disclaimer-banner,
    .disclaimer-banner { /* Ensure disclaimer is full width on mobile */
        left: 0;
        width: 100%;
        padding: 0.8rem 1rem;
    }
    
    .disclaimer-banner p {
        font-size: 0.8rem;
    }
}

.prediction-item {
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background-color: var(--result-section-bg); 
    border-radius: 4px;
    transition: background-color 0.3s;
}

.prediction-item strong {
    color: var(--primary-color);
    transition: color 0.3s;
}

.drug-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--result-section-bg); 
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
    transition: background-color 0.3s, border-left-color 0.3s;
}

.drug-item strong {
    color: var(--primary-color);
    font-size: 1.1em;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

.drug-item br {
    content: "";
    display: block;
    margin: 0.3rem 0;
}

.info-box {
    background-color: var(--result-section-bg);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 12px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5));
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.symptom-attributes {
    display: flex;
    gap: 20px;
    margin: 15px 0;
}

.attribute-group {
    flex: 1;
}

.emergency-contacts {
    border-left: 4px solid var(--danger-color);
    background-color: var(--result-section-bg);
}

.emergency-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0px 0;
}

.emergency-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.emergency-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.emergency-icon {
    font-size: 1.2em;
    width: 24px;
    text-align: center;
}

.emergency-label {
    flex: 1;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9em;
}

.emergency-number {
    font-weight: 600;
    color: var(--danger-color);
    text-decoration: none;
    font-size: 1em;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(220, 53, 69, 0.1);
    transition: all 0.2s ease;
}

.emergency-number:hover {
    background-color: rgba(220, 53, 69, 0.2);
    transform: scale(1.05);
}

.emergency-note {
    font-size: 0.85em;
    color: var(--text-color);
    opacity: 0.8;
    margin-top: 12px;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
}

/* Dark mode adjustments for emergency contacts */
body.dark-mode .emergency-item {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .emergency-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .emergency-number {
    background-color: rgba(239, 83, 80, 0.15);
}

body.dark-mode .emergency-number:hover {
    background-color: rgba(239, 83, 80, 0.25);
}

body.dark-mode .emergency-note {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .symptom-attributes {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Make symptom descriptions show ellipsis in mobile view */
    .condition-tag {
        max-width: 80px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* History table symptom descriptions */
    #history-table td:nth-child(2) {
        max-width: 100px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Prediction results symptom descriptions */
    .prediction-item {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Show only condition name and truncate the rest */
    .prediction-item strong {
        display: inline-block;
        max-width: 70%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.condition-tag {
    display: inline-block;
    background-color: var(--secondary-btn-bg);
    color: var(--text-color);
    padding: 3px 8px;
    margin: 2px;
    border-radius: 12px;
    font-size: 0.85em;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.3));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.3));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.05);
}

.small-note {
    font-size: 0.85em;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 8px;
    font-style: italic;
    transition: color 0.3s;
}

.drugs-com-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 8px;
    background-color: color-mix(in srgb, var(--accent-color) 10%, transparent);
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.3));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.3));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.drugs-com-link:hover {
    background-color: color-mix(in srgb, var(--accent-color) 20%, transparent);
    color: color-mix(in srgb, var(--accent-color) 80%, var(--text-color)); 
}

.drugs-com-link i {
    font-size: 14px;
}

#history-table td {
    padding: 12px 15px;
    vertical-align: middle;
}

#drugs-com-link {
    margin-top: 10px;
}

.history-condition-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.history-condition-link:hover {
    text-decoration: underline;
}

/* Extracted text preview in chat */
.extracted-text {
    background-color: var(--result-section-bg);
    border-left: 3px solid var(--primary-color);
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
}

.extracted-text::before {
    content: 'Extracted Text';
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* File info header in chat */
.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #212529;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.file-info i {
    font-size: 1.1em;
}

/* Message separator */
.message-separator {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* JSON Formatted Content */
.json-formatted-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bot-message-section {
    background-color: #E9ECEF;
    border: 1px solid rgba(206, 212, 218, 0.7);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Conditions Styling */
.conditions-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.condition-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.condition-name-title {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Light mode specific styling for .condition-item within .bot-message-section */
body:not(.dark-mode) .bot-message-section .condition-item {
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0,0,0,0.05);
    /* Padding and border-radius are inherited from the general .condition-item rule, so no need to re-declare unless they needed to be different */
}

/* List Styling */
.bot-message-section ul,
.bot-message-section ol,
.bot-message-list,
.bot-message-sublist {
    padding-left: 1rem;
}
.bot-message-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.bot-message-list-item {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.bot-message-list-item:last-child {
    margin-bottom: 0;
}

.bot-message-sublist {
    list-style-type: circle;
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.bot-message-sublist-item {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    opacity: 0.9;
}

/* Paragraph Styling */
.formatted-paragraph {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.formatted-paragraph:last-child {
    margin-bottom: 0;
}

/* Nested Object Styling */
.nested-object {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 1rem;
}

.labeled-content {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.labeled-content:last-child {
    margin-bottom: 0;
}

.labeled-content strong {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Markdown Content Styling */
.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
    font-weight: 600;
}

.markdown-content h1 { font-size: 1.8rem; }
.markdown-content h2 { font-size: 1.5rem; }
.markdown-content h3 { font-size: 1.3rem; }
.markdown-content h4 { font-size: 1.2rem; }
.markdown-content h5 { font-size: 1.1rem; }
.markdown-content h6 { font-size: 1rem; }

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
    
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.9rem;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-color);
    opacity: 0.9;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.markdown-content th,
.markdown-content td {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

/* Dark Mode Adjustments */
body.dark-mode .bot-message-section,
body.dark-mode .condition-item,
body.dark-mode .nested-object {
    background: rgba(0, 0, 0, 0.2);
}

body.dark-mode .markdown-content code {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-mode .markdown-content pre {
    background: rgba(0, 0, 0, 0.2);
}

.api-error-banner-styling {
    background-color: var(--danger-color);
    color: white; /* Or a suitable contrast color from variables */
    padding: 1rem;
    text-align: center;
    position: fixed; /* Or 'sticky' if preferred */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000; /* Ensure it's on top of other elements */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.api-error-banner-styling p {
    margin: 0 0 0.5rem 0;
}
.api-error-banner-styling button {
    background-color: rgba(255,255,255,0.8);
    color: var(--text-color); /* Or a dark color */
    border: 1px solid rgba(0,0,0,0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}
.api-error-banner-styling button:hover {
    background-color: white;
}
.api-error-banner-styling {
    background-color: var(--danger-color);
    color: white; /* Or a suitable contrast color from variables */
    padding: 1rem;
    text-align: center;
    position: fixed; /* Or 'sticky' if preferred */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000; /* Ensure it's on top of other elements */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.api-error-banner-styling p {
    margin: 0 0 0.5rem 0;
}
.api-error-banner-styling button {
    background-color: rgba(255,255,255,0.8);
    color: var(--text-color); /* Or a dark color */
    border: 1px solid rgba(0,0,0,0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}
.api-error-banner-styling button:hover {
    background-color: white;
}

/* File Upload Styling */
.file-upload-container {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

/* File info in chat message */
.message .file-info {
    display: flex;
    align-items: center;

    background-color: rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.message .file-info i {
    margin-right: 8px;
    color: #212529;
}

.message .message-separator {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

body.dark-mode .message .file-info {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .message .message-separator {
    background-color: rgba(255, 255, 255, 0.1);
}

.file-attachment-container {
    display: flex;
    align-items: center;
    background-color: color-mix(in srgb, var(--card-bg) 80%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--glass-blur) * 0.7));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.7));
}

.file-attachment-container.hidden {
    display: none;
}

.file-attachment {
    display: flex;
    align-items: center;
    width: 100%;
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background-color: var(--primary-color);
    border-radius: 10px;
    margin-right: 12px;
    color: var(--chat-bubble-user-text);
    flex-shrink: 0;
}

.file-info {
    flex-grow: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.file-size {
    font-size: 0.8em;
    color: color-mix(in srgb, var(--text-color) 70%, transparent);
}

.remove-file-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn i {
    font-size: 1em;
}

.remove-file-btn:hover {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
}