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

/* Smooth transitions for all interactive elements */
button, a, input, textarea, select, .session-item, .event, .message-bubble {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading {
    background: linear-gradient(
        90deg,
        var(--gray-100) 25%,
        var(--gray-200) 50%,
        var(--gray-100) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--radius-md);
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Lazy Loading Images */
img[data-src], img[data-srcset] {
    background: var(--gray-100);
    min-height: 100px;
}

img.lazy-loading {
    opacity: 0.5;
    filter: blur(5px);
}

img.lazy-loaded {
    opacity: 1;
    filter: blur(0);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

img.lazy-error {
    opacity: 0.3;
    background: var(--gray-200);
}

/* Examples Modal - Optimized for Performance */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: rgba(20, 20, 30, 0.95);
    margin: 4% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    animation: modalSlide 0.2s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 100%);
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.01em;
}

.modal-header h2 .category-name {
    font-weight: 600;
    opacity: 0.8;
}

.close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.05);
}

.modal-body {
    padding: 1.5rem 2rem 2rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* Important for flex scrolling */
}

.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin: 10px 0;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #60a5fa;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

/* Tab Switcher */
.examples-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

/* Examples Modal - Sidebar Layout */
.examples-layout {
    display: flex;
    gap: 0;
    height: calc(80vh - 150px);
    min-height: 0;
}

.examples-sidebar {
    width: 200px;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-group {
    display: flex;
    flex-direction: column;
}

.examples-main {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 1rem;
}

.examples-categories {
    display: none; /* Hidden - using sidebar now */
}

.category-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.category-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}
    box-shadow:
        0 8px 24px rgba(96, 165, 250, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.examples-content {
    min-height: 300px;
}

.category-header {
    display: none;
}

.examples-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 0.375rem;
}

@media (max-width: 1100px) {
    .examples-list {
        grid-template-columns: 1fr;
    }
}

.example-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    position: relative;
}

.example-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #60a5fa 0%, #a78bfa 100%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.example-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(96, 165, 250, 0.4);
}

.example-item:hover::before {
    opacity: 1;
}

.example-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    color: white;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.example-text {
    flex: 1;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    line-height: 1.5;
}

.example-use-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.example-item:hover .example-use-btn {
    opacity: 1;
}

@media (max-width: 768px) {
    .modal-content {
        width: 96%;
        margin: 5% auto;
        border-radius: 20px;
    }

    .modal-header,
    .modal-body {
        padding: 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .examples-categories {
        gap: 0.5rem;
    }

    .category-btn {
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
    }
}

/* Pulse animation for active states */
@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }
    100% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

/* Bounce animation for notifications */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Spinner animation for loading */
.spinner {
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 8px auto;
}

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

/* Feedback buttons */
.feedback-buttons {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.feedback-buttons:hover {
    opacity: 1;
}

.feedback-btn {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.feedback-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.feedback-btn.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

.feedback-btn.positive.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.feedback-btn.negative.active {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.retry-btn {
    margin-left: 0.5rem;
    padding: 4px 10px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.retry-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

/* Response Grade Display */
.response-grade {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.05);
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    font-size: 0.9rem;
}

.grade-summary {
    font-weight: 600;
    color: #1e40af;
    user-select: none;
}

.grade-summary:hover {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
}

.grade-details {
    animation: fadeIn 0.2s ease;
}

.grade-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1e40af;
}

.grade-strengths {
    color: #059669;
    margin: 0.25rem 0;
}

.grade-improvements {
    color: #d97706;
    margin: 0.25rem 0;
}

.grade-feedback {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

:root {
    /* Primary - Modern Blue */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;

    /* Success - Green */
    --success-500: #10b981;
    --success-600: #059669;

    /* Danger - Red */
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    /* Neutral - Modern Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border-color: #334155;
    }

    body {
        background: var(--bg-primary);
        color: var(--text-primary);
    }

    .header {
        background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
    }

    .messages-pane,
    .events-pane,
    .tools-pane {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }

    .messages-content {
        background: linear-gradient(to bottom, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    }

    .message.user::after,
    .message.assistant::before {
        opacity: 0.5;
    }

    .messages-header,
    .events-header,
    .tools-header {
        background: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .message.assistant .message-bubble {
        background: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .markdown-content code {
        background: var(--bg-secondary);
        color: #f472b6;
        border-color: var(--border-color);
    }

    .markdown-content pre {
        background: #0f172a;
        border-color: #1e293b;
    }

    .markdown-content blockquote {
        background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
        color: var(--text-secondary);
    }

    .sidebar {
        background: white;
        border-color: #e5e7eb;
    }

    .sidebar-header {
        background: #f9fafb;
        border-color: #e5e7eb;
        color: #000;
    }

    .session-item {
        border-color: var(--border-color);
        color: var(--text-secondary);
    }

    .session-item:hover {
        background: var(--bg-tertiary);
    }

    .session-item.active {
        background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
        color: var(--text-primary);
    }

    .event {
        background: var(--bg-tertiary);
        border-color: var(--border-color);
    }

    .event-header {
        background: var(--bg-secondary);
        color: var(--text-secondary);
    }

    .event-content {
        background: var(--bg-primary);
        border-color: var(--border-color);
        color: var(--text-secondary);
    }

    .text-input {
        background: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .text-input:focus {
        background: var(--bg-secondary);
    }

    .controls {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }

    .control-btn-small,
    .checkbox-label-small {
        background: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .control-btn-small:hover,
    .checkbox-label-small:hover {
        background: var(--bg-secondary);
    }

    .checkbox-label {
        background: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .checkbox-label:hover {
        background: var(--bg-secondary);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
    background: var(--gray-50);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

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

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.header {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    padding: 0.75rem 1.5rem;
    border-bottom: none;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header h1 {
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    margin: 0;
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    color: white;
    font-size: 0.9rem;
    opacity: 0.9;
}

.logout-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.mode-selector {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.25rem;
    border-radius: var(--radius-lg);
}

.mode-label {
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-label input[type="radio"] {
    display: none;
}

.mode-label input[type="radio"]:checked + * {
    background: white;
    color: #667eea;
}

.mode-label:has(input[type="radio"]:checked) {
    background: white;
    color: #667eea;
}

.connect-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.connect-btn.disconnected {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.connect-btn.disconnected:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.connect-btn.connected {
    background: linear-gradient(135deg, var(--danger-600), var(--danger-500));
    color: white;
}

.connect-btn.connected:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.main {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 140px);
}

.messages-pane {
    flex: 6;
    background: white;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

/* Chat Tabs - Disabled for now */
.chat-tabs-container {
    display: none;
    align-items: center;
    background: #f3f4f6;
    border-bottom: 2px solid #e5e7eb;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    min-height: 50px;
}

.chat-tabs {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.chat-tabs::-webkit-scrollbar {
    height: 4px;
}

.chat-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
    max-width: 200px;
    flex-shrink: 0;
}

.chat-tab:hover {
    background: #f9fafb;
}

.chat-tab.active {
    background: white;
    border-bottom: 2px solid #3b82f6;
    font-weight: 600;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
}

.tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.tab-close {
    padding: 0.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
    color: #6b7280;
}

.tab-close:hover {
    opacity: 1;
    color: #ef4444;
}

.new-tab-btn {
    padding: 0.5rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.new-tab-btn:hover {
    background: #2563eb;
}

.new-tab-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Tab Contents */
.tab-contents {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.tab-content.active {
    display: flex;
}

.messages-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    background: linear-gradient(135deg, var(--gray-50), white);
}

.messages-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 1rem;
    display: flex;
    animation: slideIn 0.3s ease;
    gap: 0.75rem;
    align-items: flex-end;
}

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

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

.message.assistant {
    justify-content: flex-start;
}

/* Avatar indicators */
.message.user::after {
    content: "👤";
    font-size: 1.5rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.message.assistant::before {
    content: "🤖";
    font-size: 1.5rem;
    opacity: 0.7;
    flex-shrink: 0;
}


.markdown-content li {
    margin-bottom: 0.25em;
}

.markdown-content pre {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    margin: 1em 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.markdown-content code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    border: 1px solid #e2e8f0;
    font-weight: 500;
}

.markdown-content pre code {
    background: transparent;
    color: #e2e8f0;
    padding: 0;
    border: none;
    font-weight: normal;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary-500);
    padding-left: 1rem;
    margin: 1em 0;
    color: var(--gray-700);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-style: italic;
}

.message-bubble {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 1.25rem;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    line-height: 1.6;
    position: relative;
}

.message-bubble:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* Message Actions */
.message-actions {
    display: none;
    gap: 0.25rem;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .message-actions {
    display: flex;
    opacity: 1;
}

.message-action-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-action-btn:hover {
    background: white;
    border-color: var(--blue-500);
    transform: scale(1.05);
}

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

/* Copy Toast */
.copy-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--green-600);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideInUp 0.3s ease, fadeOut 0.3s ease 1.7s;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* Message Edit */
.message-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 2px solid var(--blue-500);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    resize: vertical;
    outline: none;
}

.message-edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.message-edit-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-edit-btn.save {
    background: var(--blue-600);
    color: white;
}

.message-edit-btn.save:hover {
    background: var(--blue-700);
}

.message-edit-btn.cancel {
    background: var(--gray-200);
    color: var(--gray-700);
}

.message-edit-btn.cancel:hover {
    background: var(--gray-300);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message.assistant .message-bubble {
    background: white;
    color: var(--gray-900);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 0.25rem;
}

/* Typing indicator for assistant messages */
.message.assistant .message-bubble.typing {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Markdown content improvements */
.markdown-content {
    font-size: 0.9375rem;
}

.markdown-content p {
    margin: 0.75em 0;
}

.markdown-content p:first-child {
    margin-top: 0;
}

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

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

.markdown-content li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.markdown-content strong {
    font-weight: 600;
    color: var(--gray-900);
}

.markdown-content em {
    font-style: italic;
    color: var(--gray-700);
}

.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.25em; }
.markdown-content h3 { font-size: 1.1em; }

.right-column {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
}

.events-pane {
    flex: 1;
    background: white;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 30%;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.tools-pane {
    flex: 3;
    background: white;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 70%;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.events-header,
.tools-header {
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-700);
    background: linear-gradient(135deg, var(--gray-50), white);
}

.events-content,
.tools-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.event {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: all 0.2s ease;
    background: white;
}

.event:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-300);
}

.event-header {
    padding: 0.875rem 1rem;
    background: var(--gray-50);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    font-size: 0.8125rem;
    transition: all 0.2s ease;
}

.event-header:hover {
    background: var(--gray-100);
}

.tools-content .event-header {
    cursor: default;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
    font-weight: 500;
}

.tools-content .event-header.handoff {
    background: linear-gradient(135deg, #f3e8ff, #faf5ff);
    border-left: 4px solid #8b5cf6;
    color: #6b21a8;
}

.tools-content .event-header.tool {
    background: linear-gradient(135deg, #fef3e2, #fffbeb);
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.tools-content .event.tool-end-event {
    cursor: pointer;
}

.tools-content .event.tool-end-event:hover {
    box-shadow: 0 0 0 2px #f59e0b;
}

.event-content {
    padding: 0.875rem 1rem;
    background: white;
    border-top: 1px solid var(--gray-200);
    font-family: monospace;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.event-content.collapsed {
    display: none;
}

/* Controls container - v2 vertical layout */
.controls {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: white;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* Bottom controls container - holds secondary and primary controls */
.bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
    margin-top: 0.5rem;
}

/* Secondary controls (Upload, Examples, Audio, Mic) - left side */
.secondary-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
}

.control-btn-small {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn-small:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--text-primary);
}

.file-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.8125rem;
    font-weight: 500;
}

.file-indicator::before {
    content: '📎';
}

.checkbox-label-small {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-label-small:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--text-primary);
}

.checkbox-label-small input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Primary controls (Send) - prominent */
.primary-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Mic button in secondary controls - small size */
.secondary-controls #muteBtn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    box-shadow: none;
}

.secondary-controls #muteBtn.unmuted {
    background: var(--success-500);
    color: white;
    border-color: var(--success-600);
}

.secondary-controls #muteBtn.muted {
    background: var(--danger-500);
    color: white;
    border-color: var(--danger-600);
}

.secondary-controls #muteBtn:hover {
    transform: scale(1.02);
}

.secondary-controls #muteBtn:disabled {
    background: var(--gray-200);
    color: var(--gray-400);
    border-color: var(--gray-300);
    cursor: not-allowed;
    opacity: 0.6;
}

.mute-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.mute-btn.unmuted {
    background: linear-gradient(135deg, var(--success-600), var(--success-500));
    color: white;
}

.mute-btn.muted {
    background: linear-gradient(135deg, var(--danger-600), var(--danger-500));
    color: white;
}

.mute-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.mute-btn.active {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        opacity: 0.9;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

.voice-label {
    margin-right: 0.5rem;
    font-size: 0.875rem;
    color: white;
    font-weight: 500;
    display: inline-block;
    align-self: center;
}

.voice-select {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-right: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    min-width: 120px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.voice-select:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.voice-select:focus {
    outline: none;
    background: white;
    color: var(--gray-900);
    border-color: white;
}

.status {
    font-size: 0.875rem;
    margin-right: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.status.connected {
    background: rgba(16, 185, 129, 0.2);
    color: #d1fae5;
}

.status.disconnected {
    background: transparent;
    color: #9ca3af;
}

.status.warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fef3c7;
    animation: pulse 1s infinite;
}

.text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.file-input {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.5rem;
}

.sidebar {
    width: 220px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.sidebar-header h3 {
    font-size: 14px;
    margin: 0;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
}

.new-session-btn {
    background: #666;
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.new-session-btn:hover {
    background: #555;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.session-item {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    background: white;
}

.session-item:hover {
    background: #f5f5f5;
    transform: translateX(2px);
}

.session-item.active {
    background: #f5f5f5;
    border-left: 3px solid #666;
    font-weight: 600;
}

.session-title {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    color: #000;
}

.session-item.active .session-title {
    color: #000;
}

.session-actions {
    display: flex;
    gap: 4px;
}

.session-action-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.session-action-btn:hover {
    background: #e5e7eb;
    color: #333;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0; /* Remove gap since we're adding sidebar */
    padding: 0;
    height: calc(100vh - 80px); /* Adjust for header */
}

.tab-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

.tab-pane {
    display: none;
    flex: 1;
    width: 100%;
    overflow: auto;
}

/* Tabs that need flex layout (multi-column) */
#marketTab.active,
#assistantTab.active,
#researchTab.active,
#planningTab.active,
#watchlistTab.active,
#tasksTab.active,
#profileTab.active {
    display: flex;
    flex-direction: column;
}

/* Tabs that need block layout (iframe or complex content) */
#learningTab.active,
#portfolioTab.active,
#backtestTab.active {
    display: block;
    overflow-y: auto;
}

/* Reduce left padding for portfolio tab */
#portfolioTab.active {
    padding-left: 2px;
}

.messages-pane {
    flex: 3; /* Reduced width of message panel */
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-header {
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#currentSessionTitle {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.right-column {
    width: 500px; /* Updated width for right column */
}

/* Styles for tool call results */
.tool-image-container {
    position: relative;
    margin: 10px 0;
}

.tool-image-result {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
}

.loading {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.tool-image-description {
    margin-top: 8px;
    font-size: 0.85em;
    color: #555;
}

/* Responsive image handling */
@media (max-width: 600px) {
    .tool-image-result {
        max-height: 250px;
    }
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: fixed;
    right: 500px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: rgba(0, 102, 204, 0.1);
    border: 1px solid #e1e5e9;
    border-right: none;
    border-radius: 6px 0 0 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    color: #0066cc;
    font-size: 14px;
}

.sidebar-toggle:hover {
    background: rgba(0, 102, 204, 0.2);
    width: 28px;
}

.sidebar-toggle .toggle-icon {
    transition: transform 0.3s ease;
}

/* Collapsed state */
.right-column.collapsed {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle.collapsed {
    right: 0;
}

.sidebar-toggle.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* Messages pane expansion */
.messages-pane.expanded {
    flex: 5;
}

/* Smooth transitions */
.right-column {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.messages-pane {
    transition: flex 0.3s ease;
}

/* Responsive: Auto-collapse on smaller screens */
@media (max-width: 1200px) {
    .right-column {
        transform: translateX(100%);
        opacity: 0;
        pointer-events: none;
    }

    .sidebar-toggle {
        right: 0;
    }

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

    .messages-pane {
        flex: 5;
    }
}

/* Left sidebar toggle button */
.left-sidebar-toggle {
    position: fixed;
    left: 200px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: rgba(0, 102, 204, 0.1);
    border: 1px solid #e1e5e9;
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    color: #0066cc;
    font-size: 14px;
}

.left-sidebar-toggle:hover {
    background: rgba(0, 102, 204, 0.2);
    width: 28px;
}

.left-sidebar-toggle .toggle-icon {
    transition: transform 0.3s ease;
}

/* Left sidebar collapsed state */
.sidebar.collapsed {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.left-sidebar-toggle.collapsed {
    left: 0;
}

.left-sidebar-toggle.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* Sidebar transitions */
.sidebar {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Chart images in messages - Thumbnail view */
.markdown-content img,
.message-content img {
    max-width: 600px !important;      /* Limit thumbnail width */
    max-height: 400px !important;     /* Limit thumbnail height */
    width: auto !important;
    height: auto !important;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    cursor: zoom-in;       /* Indicate clickable */
}

.markdown-content img:hover,
.message-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Lightbox overlay */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 9999;
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.lightbox.active {
    display: flex;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border-radius: 8px;
    cursor: default;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s ease;
}

.lightbox.active img {
    opacity: 1;
    transform: scale(1);
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 36px;
    color: white;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Right sidebar states */
.right-column {
    flex: 2;
    transition: all 0.3s ease;
}

/* Hidden state - messages pane expands to full width */
.right-column.collapsed {
    flex: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    opacity: 0;
}

.messages-pane.expanded {
    flex: 1 !important;  /* Takes all available space */
}

/* Overlay state - floats over messages pane */
.right-column.overlay {
    position: fixed !important;
    right: 0;
    top: 60px;
    height: calc(100vh - 60px);
    width: 350px;
    flex: none !important;
    z-index: 1000;
    box-shadow: -4px 0 16px rgba(0,0,0,0.2);
    background: white;
    transform: translateX(0);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}


/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid #007bff;
}

.toast-info {
    border-left-color: #007bff;
}

.toast-success {
    border-left-color: #28a745;
}

.toast-alert {
    border-left-color: #ffc107;
    background: #fff9e6;
}

.toast-error {
    border-left-color: #dc3545;
}

.toast-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.toast-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    color: #000;
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.toast-fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}


/* Watchlist & Alerts UI */
.watchlist-section {
    margin-bottom: 24px;
}

/* Trade Planning UI (reuse watchlist styles) */
.planning-section {
    margin-bottom: 24px;
}

.trade-plans-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.plans-response {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    line-height: 1.6;
}

.plans-response strong {
    color: var(--text-primary);
    font-weight: 600;
}

.plans-response ul {
    margin: 8px 0;
    padding-left: 20px;
}

.plans-response li {
    margin: 4px 0;
}

.error-message {
    background: var(--error-bg);
    color: var(--error-color);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

/* Portfolio Management UI */
.portfolio-layout {
    display: flex;
    gap: 0px !important;
    width: 100%;
}

.portfolio-sidebar {
    width: 160px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 200px);
}
    overflow-y: auto;
}

.new-portfolio-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-color), #0066cc);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.new-portfolio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.portfolios-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.portfolio-item {
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.portfolio-item.active {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #000000;
    border-color: #0066cc;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.portfolio-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.portfolio-item.active .portfolio-item-name {
    color: #000000;
}

.portfolio-item.active .portfolio-item-count {
    color: rgba(0, 0, 0, 0.7);
}

.portfolio-item-count {
    font-size: 11px;
    opacity: 0.7;
}

.portfolio-main {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    padding: 0;
}

.portfolio-main .tools-container {
    padding: 0;
    margin: 0;
}

.portfolio-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.portfolio-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

@media (max-width: 1200px) {
    .portfolio-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .portfolio-summary-grid {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    min-width: 0;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.summary-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-icon {
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
}

.summary-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.summary-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-badge, .risk-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-excellent {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.score-good {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.score-poor {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.risk-low {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.risk-medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.risk-high {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.portfolio-section {
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    padding-left: 0px;
    padding-right: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-icon {
    font-size: 20px;
}

/* Section Actions */
.section-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-icon {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.btn-primary {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.holdings-table th {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 6px 8px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.holdings-table td {
    padding: 6px 8px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
}

.holdings-table tbody tr {
    transition: all 0.2s;
}

.holdings-table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

/* Market Scanner Table - Match Portfolio Holdings */
.scanner-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.scanner-table th {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 6px 8px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scanner-table td {
    padding: 6px 8px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
}

.scanner-table tbody tr {
    transition: all 0.2s;
}

.scanner-table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    opacity: 0.6;
    transition: all 0.2s;
    border-radius: 4px;
}

.btn-icon:hover {
    opacity: 1;
    background: var(--bg-hover);
    transform: scale(1.2);
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-item {
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.recommendation-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-left-width: 6px;
}

.recommendation-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.agent-response {
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    line-height: 1.6;
}

.recommendations-section {
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.recommendations-section h4 {
    margin: 0 0 12px 0;
    color: #2196F3;
    font-size: 16px;
    font-weight: 600;
}

.rule-based-recommendations,
.ai-recommendations {
    line-height: 1.6;
    color: #333;
}

.agent-response-text {
    color: #333;
}

.agent-response-text p,
.rule-based-recommendations p,
.ai-recommendations p {
    margin: 0 0 12px 0;
}

.agent-response-text strong,
.rule-based-recommendations strong,
.ai-recommendations strong {
    color: #2196F3;
    font-weight: 600;
}

.rule-based-recommendations ul,
.ai-recommendations ul {
    margin: 8px 0;
    padding-left: 24px;
}

.rule-based-recommendations li,
.ai-recommendations li {
    margin: 4px 0;
}

.recommendation-text {
    flex: 1;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-primary);
}

.allocation-chart {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    min-height: 200px;
}

.pie-chart-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pie-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.pie-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.pie-legend-label {
    font-weight: 600;
    color: #333;
    min-width: 60px;
}

.pie-legend-value {
    color: #666;
    margin-left: auto;
}

.chart-placeholder,
.recommendation-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-icon {
    font-size: 48px;
    opacity: 0.5;
    animation: pulse 2s ease-in-out infinite;
}

.placeholder-text {
    font-size: 14px;
    font-style: italic;
    max-width: 400px;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Responsive Design for Portfolio */
@media (max-width: 1024px) {
    .portfolio-layout {
        flex-direction: column;
    }

    .portfolio-sidebar {
        position: relative;
        width: 100%;
        max-height: none;
        top: 0;
    }

    .portfolio-main {
        width: 100%;
    }
}

/* Improve section spacing */
.portfolio-section:last-child {
    margin-bottom: 0;
}

/* Better header styling */
.tools-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    padding-bottom: 2px;
    border-bottom: 2px solid var(--border-color);
}

.tools-header-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.portfolio-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}


.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 14px;
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.btn-secondary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.tools-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color), #0066cc);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.tools-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.tools-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-icon {
    font-size: 32px;
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.score-badge, .risk-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
}

.score-excellent {
    background: #10b981;
    color: white;
}

.score-good {
    background: #f59e0b;
    color: white;
}

.score-poor {
    background: #ef4444;
    color: white;
}

.risk-low {
    background: #10b981;
    color: white;
}

.risk-medium {
    background: #f59e0b;
    color: white;
}

.risk-high {
    background: #ef4444;
    color: white;
}

.portfolio-section {
    margin-bottom: 24px;
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.holdings-table th {
    background: var(--bg-tertiary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

.holdings-table td {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.holdings-table tr:hover {
    background: var(--bg-hover);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

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

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.recommendation-icon {
    font-size: 20px;
}

.recommendation-text {
    flex: 1;
    line-height: 1.5;
}

.allocation-chart {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}


.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 20px;
}

.section-count {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.alerts-list,
.watchlist-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Loading Spinner */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    /* Ensure only this element rotates */
    transform-origin: center;
}

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

.loading-text {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
    /* Explicitly prevent rotation */
    transform: none !important;
    animation: none !important;
}

/* Alert/Watchlist Cards */
.alert-card,
.watchlist-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.alert-card:hover,
.watchlist-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.alert-card {
    border-left: 4px solid #ffc107;
}

.watchlist-card {
    border-left: 4px solid #28a745;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.card-symbol {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.card-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-above {
    background: #d4edda;
    color: #155724;
}

.badge-below {
    background: #f8d7da;
    color: #721c24;
}

.badge-active {
    background: #d1ecf1;
    color: #0c5460;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.card-label {
    color: #6c757d;
    font-weight: 500;
}

.card-value {
    color: #2c3e50;
    font-weight: 600;
}

.price-positive {
    color: #28a745;
}

.price-negative {
    color: #dc3545;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.card-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.card-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.card-btn-delete {
    color: #dc3545;
}

.card-btn-delete:hover {
    background: #fff5f5;
    border-color: #dc3545;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin: 0 0 8px 0;
}

.empty-state p {
    color: #6c757d;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Error Message */
.error-message {
    text-align: center;
    color: #dc3545;
    padding: 12px;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* Response Display (fallback) */
.alert-response,
.watchlist-response {
    font-size: 14px;
    line-height: 1.6;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.alert-response ul,
.watchlist-response ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.alert-response li,
.watchlist-response li {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s;
}

.alert-response li:hover,
.watchlist-response li:hover {
    background: #f8f9fa;
}

.alert-response li:last-child,
.watchlist-response li:last-child {
    border-bottom: none;
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 5px;
    max-height: 150px;
}

.quick-actions h2 {
    font-size: 12px;
    margin-bottom: 6px;
}

/* Home page section headings */
.home-left h2,
.home-middle h2,
.home-right h2 {
    font-size: 12px;
    margin-bottom: 6px;
    font-weight: 700;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    max-height: 120px;
}

.quick-action-card {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
}

.quick-action-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.action-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.action-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}


/* Footer */
.app-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 8px 20px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    max-width: 100%;
}

.footer-item {
    font-size: 10px;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

.footer-brand-item {
    font-weight: 600;
    color: #212529;
    font-size: 11px;
}

.footer-version {
    font-size: 9px;
    color: #adb5bd;
    font-weight: 400;
}

.footer-copyright-item {
    color: #6c757d;
}

.footer-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 10px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #007bff;
}

.footer-contact {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-weight: 500;
    font-size: 10px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.footer-contact:hover {
    background: #e9ecef;
    border-color: #007bff;
    color: #007bff;
}

@media (max-width: 992px) {
    .footer-content {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #666;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        flex-direction: column;
    }
}

/* ============================================
   Week 16: Deep Research Agent Enhancements
   ============================================ */

/* Settings Button (Task 4) */
.settings-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: rotate(45deg);
}

/* Settings Panel (Task 4) */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    flex-direction: column;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.settings-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.settings-header h3 {
    margin: 0;
    color: white;
    font-size: 1.3em;
}

.settings-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.2s;
}

.settings-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.settings-body {
    padding: 20px;
    overflow-y: auto;
}

.settings-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 20px 0;
}

.setting-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.scheduler-status {
    font-size: 14px;
    font-weight: 600;
}

.setting-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
}

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

.setting-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
}

.setting-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.setting-name {
    font-size: 1.1em;
}

.setting-description {
    margin: 8px 0 0 32px;
    color: #7f8c8d;
    font-size: 0.9em;
}

/* Dark mode for settings */
@media (prefers-color-scheme: dark) {
    .settings-panel {
        background: #2c3e50;
    }

    .settings-header {
        border-bottom-color: #34495e;
    }

    .setting-item {
        border-bottom-color: #34495e;
    }

    .setting-label {
        color: #ecf0f1;
    }

    .setting-description {
        color: #95a5a6;
    }
}

/* Agent Badge (Task 3) */
.agent-badge {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 8px;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Deep Research Agent Badge - Special styling */
.agent-badge[data-agent*="Deep Research"],
.agent-badge[data-agent*="deep research"] {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(16, 185, 129, 0.6);
    }
}

/* Mental Model Enhancement Blocks */
.mental-model-block {
    background: rgba(102, 126, 234, 0.08);
    border-left: 3px solid rgba(102, 126, 234, 0.4);
    padding: 10px 14px;
    margin: 12px 0;
    border-radius: 6px;
    color: rgba(102, 126, 234, 0.9);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mental-model-block:hover {
    background: rgba(102, 126, 234, 0.12);
    border-left-color: rgba(102, 126, 234, 0.6);
}

.mental-model-block strong {
    color: rgba(102, 126, 234, 1);
    font-size: 0.95em;
    font-weight: 600;
}

.mental-model-block.collapsed {
    padding: 6px 14px;
}

.mental-model-block.collapsed .mental-model-content {
    display: none;
}

.mental-model-toggle {
    float: right;
    font-size: 0.8em;
    opacity: 0.6;
    user-select: none;
    transition: transform 0.2s ease;
}

.mental-model-block:not(.collapsed) .mental-model-toggle {
    transform: rotate(180deg);
}

.mental-model-content {
    margin-top: 4px;
    line-height: 1.5;
}

/* Stress Reduction Blocks */
.stress-reduction-block {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-left: 4px solid #10b981;
    padding: 14px 18px;
    margin: 16px 0;
    border-radius: 10px;
    color: white;
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
    animation: slideIn 0.3s ease-out;
}

.stress-reduction-block strong {
    color: #fff;
    font-size: 1.05em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Enhancement Icon Styling */
.enhancement-icon {
    font-size: 1.4em;
    margin-right: 10px;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

/* Slide-in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for icons */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Thinking indicator */
.thinking-indicator {
    color: #667eea;
    font-style: italic;
    opacity: 0.8;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mental-model-block {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
    }

    .stress-reduction-block {
        box-shadow: 0 4px 12px rgba(17, 153, 142, 0.5);
    }
}
