:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-light: #64748b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.nav-item:hover, .nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.footer-info {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
}

/* Main Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.chat-header {
    background: var(--white);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--success);
    font-weight: 500;
    background: var(--success-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

.disclaimer {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    font-style: italic;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0; /* Important for flex scrolling */
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 800px;
    animation: fadeIn 0.3s ease;
}

.message.wide-message {
    max-width: 95%;
}

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

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-message {
    align-self: flex-start;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-message .avatar {
    background: var(--secondary);
    color: var(--white);
}

.message-content {
    background: var(--white);
    padding: 1rem;
    border-radius: 1rem;
    border-top-left-radius: 0.25rem;
    box-shadow: var(--shadow-sm);
    line-height: 1.5;
    font-size: 0.95rem;
}

.user-message .message-content {
    background: var(--primary);
    color: var(--white);
    border-top-left-radius: 1rem;
    border-top-right-radius: 0.25rem;
}

/* Input Area */
.input-area {
    background: var(--white);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="text"] {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 99px;
    outline: none;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--bg);
    box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
}

input[type="text"]:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px var(--primary-light);
}

button {
    background: var(--primary);
    color: var(--white);
    border: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

button:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

button:active {
    transform: translateY(0);
}

/* Medicine Card Styles */
.med-card {
    min-width: 400px;
}

.med-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.med-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.med-generic {
    font-size: 0.875rem;
    color: var(--text-light);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-box {
    background: var(--bg);
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}

.info-value {
    font-weight: 600;
    color: var(--text-main);
}

.section-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-list {
    list-style: none;
    padding: 0;
}

.custom-list li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.custom-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.warning-box {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 1rem;
}

/* Typing Indicator */
.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--secondary);
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    background: var(--white);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.med-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.med-table th {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.med-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.med-table tr:hover {
    background: var(--primary-light);
    transition: background 0.1s ease;
}

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