/* Agent Page Styles */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=Lato:wght@400;700&display=swap');

:root {
    --bs-primary: #0A749A;
    --bs-secondary: #2E9599;
    --accent-color: #F2C14E;
    --neutral-light: #F8F9FA;
    --neutral-dark-text: #343A40;
    --neutral-dark-bg: #212529;

    --bs-primary-rgb: 10, 116, 154;
    --bs-secondary-rgb: 46, 149, 153;
    --bs-body-color: var(--neutral-dark-text);
    --bs-body-bg: var(--neutral-light);
    --bs-font-sans-serif: 'Lato', sans-serif;
    --headings-font-family: 'Poppins', sans-serif;
    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.8rem;
    --bs-border-radius-sm: 0.3rem;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.07);
}

html, body {
    overscroll-behavior: none;
}

body {
    font-family: var(--bs-font-sans-serif);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Typographic Scale */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--headings-font-family);
    font-weight: 700;
    color: var(--neutral-dark-text);
}

h1 { font-size: 2.5rem; margin-bottom: 2rem; }
h2 { font-size: 2rem; margin-bottom: 1.5rem; }
h3 { font-size: 1.75rem; margin-bottom: 1.5rem; }
p { font-size: 1rem; line-height: 1.6; margin-bottom: 1rem; }
small { font-size: 0.875rem; }

/* Shared Components Styling */

/* Frosted Glass Navbar */
.navbar-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700;
    font-size: 1.5rem;
    color: #34495E !important;
}

.nav-link {
    font-family: 'Open Sans', sans-serif;
    font-weight: 500;
    color: #34495E !important;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #8E44AD !important;
}

#logout-link {
    color: #dc3545 !important;
}

#logout-link:hover {
    color: #a71d2a !important;
}

/* Chat Container */
.chat-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 0;
    min-height: 400px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Messages */
.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in-out;
}

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

.message-content {
    padding: 16px 20px;
    border-radius: 16px;
    max-width: 90%;
}

.user-message .message-content {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
    background: #f1f3f5;
    color: #212529;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.assistant-message .message-content p:last-child,
.assistant-message .message-content ul:last-child {
    margin-bottom: 0;
}

/* Verdict Cards */
.verdict-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #6c757d;
}

.verdict-card.verdict-green {
    border-left-color: #198754;
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.05), rgba(25, 135, 84, 0.02));
}

.verdict-card.verdict-yellow {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.08), rgba(255, 193, 7, 0.03));
}

.verdict-card.verdict-red {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.05), rgba(220, 53, 69, 0.02));
}

.verdict-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verdict-badge.badge-green {
    background: #198754;
    color: white;
}

.verdict-badge.badge-yellow {
    background: #ffc107;
    color: #212529;
}

.verdict-badge.badge-red {
    background: #dc3545;
    color: white;
}

.verdict-claim {
    font-weight: 500;
    margin: 8px 0;
    font-size: 0.95rem;
}

.verdict-explanation {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 8px;
}

/* Collapsible Sources */
.verdict-sources-collapsible {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.sources-toggle {
    background: none;
    border: none;
    padding: 4px 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.sources-toggle:hover {
    color: #495057;
}

.sources-toggle .toggle-icon {
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.sources-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(90deg);
}

.sources-content {
    padding-top: 8px;
}

.source-item {
    font-size: 0.8rem;
    color: #495057;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.source-file {
    font-weight: 600;
    color: #0d6efd;
    font-size: 0.75rem;
}

.source-excerpt {
    display: block;
    color: #6c757d;
    font-style: italic;
    margin-top: 6px;
    padding-left: 12px;
    border-left: 2px solid #dee2e6;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 16px 24px;
    color: #6c757d;
}

/* Input Area */
.input-area {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 16px;
    margin-top: 16px;
}

.message-form .input-group {
    border-radius: 12px;
    overflow: hidden;
}

.message-form textarea {
    border: 2px solid #e9ecef;
    border-right: none;
    border-radius: 12px 0 0 12px;
    resize: none;
    transition: border-color 0.2s;
}

.message-form textarea:focus {
    border-color: #0d6efd;
    box-shadow: none;
}

.message-form button {
    border-radius: 0 12px 12px 0;
    padding: 0 20px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* Detected Stocks Bar */
.detected-stocks-bar {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.detected-stocks-bar .label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    white-space: nowrap;
}

.stock-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stock-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(26, 188, 156, 0.1);
    color: #1ABC9C;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Previous Sessions */
.previous-sessions {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.session-item:hover {
    background: #e9ecef;
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-date {
    font-size: 0.875rem;
    font-weight: 500;
}

.session-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.session-meta {
    font-size: 0.75rem;
    color: #6c757d;
}

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

/* Modal Styles */
.messages-selection {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.message-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
}

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

.message-content-preview {
    flex: 1;
    font-size: 0.9rem;
    color: #495057;
}

.claims-selection {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.claim-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
}

.claim-item:last-child {
    margin-bottom: 0;
}

.claim-checkbox {
    margin-top: 4px;
}

.claim-content {
    flex: 1;
}

.stocks-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stock-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 20px;
}

/* Footer */
.site-footer {
    background-color: #212529;
    color: #F8F9FA;
    padding: 2rem 0;
    margin-top: auto;
}

.site-footer a {
    color: #F2C14E;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: #F8F9FA;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        max-height: 50vh;
    }

    .action-buttons .btn {
        flex: none;
        width: 100%;
    }

    .detected-stocks-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}
