:root {
    /* Light Theme */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-blue: #007bff;
    --accent-green: #28a745;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(220, 220, 220, 0.7);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

html.dark {
    /* Dark Theme */
    --bg-primary: #0F172A;
    --bg-secondary: #1A202C;
    --text-primary: #f8f9fa;
    --text-secondary: #a0aec0;
    --accent-blue: #667EEA;
    --accent-green: #38A169;
    --glass-bg: rgba(0, 0, 0, 0.4);
    --glass-border: rgba(60, 60, 60, 0.7);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
    background: var(--bg-primary);
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}

.font-poppins {
    font-family: 'Poppins', sans-serif;
}

.font-inter {
    font-family: 'Inter', sans-serif;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
}

/* Sidebar and Main Content Layout */
.container.mx-auto.mt-4.px-4 {
    margin-top: 1.5rem; /* Adjust top margin for spacing */
}

aside {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    padding: 1rem;
}

aside ul li a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

aside ul li a:hover {
    background-color: var(--bg-secondary);
    color: var(--accent-blue);
}

section.lg\:w-3\/4 {
    /* Ensure main content area has some padding if needed */
    padding: 1rem;
}

/* Redefine form styles from forms.py to avoid specificity issues */
.glass-card form .w-full.bg-gray-800 {
    background-color: var(--bg-secondary) !important;
    border-color: var(--glass-border) !important;
}

/* Intent Badge Styles */
.intent-badge {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 8px;
    display: inline-block;
}

.intent-neutral {
    background-color: var(--text-secondary); /* gray-400 equivalent */
}

.intent-safe {
    background-color: var(--accent-green); /* green-500 equivalent */
}

.intent-caution {
    background-color: #F59E0B; /* yellow-500, keeping for now */
}

.intent-warning {
    background-color: #EF4444; /* red-500, keeping for now */
}

/* Image Generator Styles */
.btn-primary {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.form-control {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
}

/* AI Chat Styles */
.chat-container {
    max-width: 800px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    border-radius: 1rem;
    overflow: hidden;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    background-color: var(--bg-secondary);
}

.chat-box {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
}

.message-content p {
    margin: 0;
}

/* User Message */
.user-message {
    align-self: flex-end;
    align-items: flex-end;
}

.user-message .message-content {
    background-color: var(--accent-blue);
    color: var(--text-primary);
    border-bottom-right-radius: 0;
}

/* AI Message */
.ai-message {
    align-self: flex-start;
    align-items: flex-start;
}

.ai-message .message-content {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-bottom-left-radius: 0;
}

.ai-message.error-message .message-content {
    background-color: #721c24; /* Keeping static for error visibility */
    color: #f8d7da; /* Keeping static for error visibility */
}

/* Typing Indicator */
.typing-indicator {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 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 bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Chat Input */
.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    background-color: var(--bg-secondary);
}

.chat-input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    flex-grow: 1;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    border-color: var(--accent-blue);
}

.send-button {
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.send-button:hover {
    background: var(--text-secondary);
}

/* Code Block Styles */
.code-block-wrapper {
    margin-top: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
}
.code-block-header {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}
.copy-code-btn {
    background: var(--accent-blue);
    color: var(--text-primary);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
}
.copy-code-btn:hover {
    background: var(--text-secondary);
}
pre {
    margin: 0;
    padding: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    overflow-x: auto;
}
code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.875rem;
}