:root {
    --primary-green: #40ab26;
    --primary-green-light: #eafbe3;
    --primary-green-dark: #2e7d1b;
    --primary-green-gradient: linear-gradient(90deg, #40ab26 0%, #7be86a 100%);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    width: 100vw;
    min-height: 100vh;
    background: #fff;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
}

body {
    width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    background: #fff;
}

/* SME Logo */
.quanex-logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-green);
    letter-spacing: 0.01em;
    margin: 32px 0 18px 0;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    text-align: center;
    width: 100%;
    display: block;
}

/* Markdown Table Styles - ChatGPT-like */
.qa-answer table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.4;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    table-layout: auto;
    max-width: 100%;
}

/* AGGRESSIVE table containment - force all tables to be contained */
.qa-answer table,
.qa-answer > table {
    display: block !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    width: auto !important;
    margin: 16px 0 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
}

/* Force table cells to respect container width */
.qa-answer table td,
.qa-answer table th {
    max-width: 200px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.qa-answer table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.qa-answer table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-right: 1px solid #e9ecef;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
}

.qa-answer table th:last-child {
    border-right: none;
}

.qa-answer table tbody tr {
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.qa-answer table tbody tr:hover {
    background-color: #f8f9fa;
}

.qa-answer table tbody tr:last-child {
    border-bottom: none;
}

.qa-answer table td {
    padding: 12px 16px;
    border-right: 1px solid #f1f3f4;
    vertical-align: top;
    color: #212529;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
}

.qa-answer table td:last-child {
    border-right: none;
}

.qa-answer table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.qa-answer table tbody tr:nth-child(even):hover {
    background-color: #f1f3f4;
}

/* Table main wrapper styles */
.table-main-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 16px 0;
    box-sizing: border-box;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

/* Table response container styles */
.table-response-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 400px;
    overflow: auto;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Custom scrollbar styling for table containers */
.table-response-container::-webkit-scrollbar {
    width: 12px;  /* Vertical scrollbar width */
    height: 12px; /* Horizontal scrollbar height */
}

.table-response-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
    margin: 2px;
}

.table-response-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.table-response-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
    background-clip: content-box;
}

.table-response-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* Enhanced scrollbar for better visibility */
.table-response-container {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.table-response-container .table-download-icon {
    opacity: 0.7;
    transition: opacity 0.2s, background-color 0.2s;
}

.table-response-container:hover .table-download-icon {
    opacity: 1;
}

.table-response-container .table-download-icon:hover {
    background-color: #e0e0e0 !important;
    opacity: 1;
}

/* Add scroll indicators */
.table-response-container::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,0.8), transparent);
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.table-response-container:hover::before {
    opacity: 1;
}

/* Table scroll indicator at bottom */
.table-response-container::after {
    content: "← Scroll horizontally to see more →";
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #666;
    background: rgba(255,255,255,0.9);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.table-response-container:hover::after {
    opacity: 1;
}

/* Scroll indicator styles */
.scroll-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 15;
}

/* Better mobile handling for table wrappers */
@media (max-width: 768px) {
    .table-main-wrapper {
        margin: 12px 0;
    }
    
    .scroll-indicator {
        font-size: 11px;
        bottom: 4px;
        padding: 2px 6px;
    }
}

/* Hide legacy table styles when using new wrapper */
.table-main-wrapper .qa-answer table {
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Ensure proper containment */
.qa-answer .table-main-wrapper {
    max-width: 100%;
    overflow: hidden;
}

/* Ensure tables in table response containers inherit proper styling */
.table-response-container table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    background: white;
    table-layout: auto;
    white-space: nowrap; /* Prevent text wrapping to maintain table structure */
}

/* Handle very long text content in table cells */
.table-response-container table td,
.table-response-container table th {
    position: relative;
}

.table-response-container table td > *,
.table-response-container table th > * {
    word-break: break-word;
    hyphens: auto;
}

.table-response-container table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.table-response-container table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-right: 1px solid #e9ecef;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
    min-width: 80px;
    white-space: nowrap;
}

.table-response-container table th:last-child {
    border-right: none;
}

.table-response-container table tbody tr {
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.table-response-container table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-response-container table tbody tr:last-child {
    border-bottom: none;
}

.table-response-container table td {
    padding: 12px 16px;
    border-right: 1px solid #f1f3f4;
    vertical-align: top;
    color: #212529;
    min-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-response-container table td:last-child {
    border-right: none;
}

.table-response-container table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.table-response-container table tbody tr:nth-child(even):hover {
    background-color: #f1f3f4;
}

/* Responsive table handling for smaller screens */
@media (max-width: 768px) {
    .table-response-container,
    .table-scroll-wrapper {
        margin: 12px 0;
        max-height: 300px !important; /* Smaller max height on mobile */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .table-response-container table,
    .table-scroll-wrapper table {
        font-size: 13px;
    }
    
    .table-response-container table th,
    .table-response-container table td,
    .table-scroll-wrapper table th,
    .table-scroll-wrapper table td {
        padding: 8px 12px;
        min-width: 70px;
    }
    
    .qa-answer {
        padding: 0.75rem;
        padding-right: 60px; /* Smaller padding for mobile */
    }
}

@media (max-width: 480px) {
    .table-response-container,
    .table-scroll-wrapper {
        max-height: 250px !important; /* Even smaller on very small screens */
    }
    
    .table-response-container table,
    .table-scroll-wrapper table {
        font-size: 12px;
    }
    
    .table-response-container table th,
    .table-response-container table td,
    .table-scroll-wrapper table th,
    .table-scroll-wrapper table td {
        padding: 6px 8px;
        min-width: 60px;
    }
    
    /* Make scrollbars slightly smaller on mobile */
    .table-response-container::-webkit-scrollbar,
    .table-scroll-wrapper::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
}

/* Chart container styles */
.qa-chart-container {
    margin-top: 16px;
    text-align: center;
    width: 100%;
}

.qa-chart-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.qa-chart-download-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.2s ease;
}

.qa-chart-download-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #1976d2;
    color: #1976d2;
    transform: scale(1.05);
}

.qa-chart-download-btn .material-icons {
    font-size: 16px;
}

/* Table wrapper and download icon */
.qa-table-outer-wrapper,
.table-outer-wrapper {
    position: relative;
    width: 100%;
    margin: 16px 0;
}

.qa-table-wrapper {
    position: relative;
    width: 100%;
    max-height: 400px;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.qa-table-download-icon,
.table-download-icon {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    z-index: 20 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.qa-table-download-icon:hover,
.table-download-icon:hover {
    background: #f8f9fa !important;
    border-color: #1976d2 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    transform: scale(1.05) !important;
}

.qa-table-download-icon:active,
.table-download-icon:active {
    transform: scale(0.95) !important;
}

.qa-table-download-icon .material-icons,
.table-download-icon svg {
    font-size: 16px;
    color: #666;
    transition: color 0.2s ease;
}

.qa-table-download-icon:hover .material-icons,
.table-download-icon:hover svg {
    color: #1976d2;
}

/* Table download button (legacy - keeping for compatibility) */
.qa-table-downloads {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding: 8px 0;
    border-top: 1px solid #f1f3f4;
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 8px 12px;
}

.qa-table-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    color: #495057;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.qa-table-download-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.qa-table-download-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.qa-table-download-btn .material-icons {
    font-size: 16px;
    color: #6c757d;
}

.qa-table-download-btn:hover .material-icons {
    color: #495057;
}

/* Responsive table */
@media (max-width: 768px) {
    .qa-answer table {
        font-size: 12px;
        margin: 12px 0;
    }
    
    .qa-answer table th,
    .qa-answer table td {
        padding: 8px 10px;
    }
    
    .qa-answer table th {
        font-size: 11px;
    }
    
    .qa-table-downloads {
        margin-top: 8px;
        padding: 6px 0;
    }
    
    .qa-table-download-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .qa-table-download-btn .material-icons {
        font-size: 14px;
    }
    
    .qa-table-download-icon {
        width: 28px;
        height: 28px;
        top: 6px;
        right: 6px;
    }
    
    .qa-table-download-icon .material-icons {
        font-size: 14px;
    }
    
    /* Chart responsive styles */
    .qa-chart-container {
        margin-top: 12px;
    }
    
    .qa-chart-title {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .qa-chart-download-btn {
        top: 6px;
        right: 6px;
        padding: 3px;
        font-size: 14px;
    }
    
    .qa-chart-download-btn .material-icons {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .qa-answer table {
        font-size: 11px;
        margin: 8px 0;
    }
    
    .qa-answer table th,
    .qa-answer table td {
        padding: 6px 8px;
    }
    
    .qa-answer table th {
        font-size: 10px;
    }
    
    .qa-table-downloads {
        margin-top: 6px;
        padding: 4px 0;
    }
    
    .qa-table-download-btn {
        padding: 5px 8px;
        font-size: 10px;
    }
    
    .qa-table-download-btn .material-icons {
        font-size: 12px;
    }
    
    .qa-table-download-icon {
        width: 24px;
        height: 24px;
        top: 4px;
        right: 4px;
    }
    
    .qa-table-download-icon .material-icons {
        font-size: 12px;
    }
    
    /* Chart responsive styles for small screens */
    .qa-chart-container {
        margin-top: 8px;
    }
    
    .qa-chart-title {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .qa-chart-download-btn {
        top: 4px;
        right: 4px;
        padding: 2px;
        font-size: 12px;
    }
    
    .qa-chart-download-btn .material-icons {
        font-size: 12px;
    }
}

/* Main UI container */
.main-ui {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(64,171,38,0.10), 0 1.5px 8px rgba(123,232,106,0.08);
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 10vh;
    position: relative;
}

/* Question Bar */
.question-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #f6f6fa;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(64,171,38,0.06);
    padding: 0.2rem 0.8rem;
    margin: 0 32px 12px 32px;
    position: sticky;
    top: 20px;
    z-index: 100;
    transition: all 0.3s ease;
    gap: 0.2rem;
    height: fit-content;
    min-height: fit-content;
}

.question-bar.sticky {
    background: #fff;
    box-shadow: 0 8px 24px rgba(64,171,38,0.2);
    border: 2px solid var(--primary-green);
    margin: 0 32px 12px 32px;
    transform: scale(1.02);
}

.question-bar input, .question-bar textarea {
    border: none;
    outline: none;
    background: #f8f9fa;
    font-size: 1rem;
    flex: 1 1 auto;
    padding: 0.6rem 3rem 0.6rem 0.8rem;
    color: #222;
    border-radius: 18px;
    min-height: 20px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    overflow-y: auto;
    max-height: 200px;
}

/* --- Unified chat input button styles --- */
.question-send-btn, .question-mic-btn, .question-attach-btn {
    position: absolute;
    bottom: 8px;
    top: auto;
    transform: none;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 2;
    transition: background 0.2s, box-shadow 0.2s;
}
.question-send-btn { right: 8px; background: #466842; color: #fff; box-shadow: 0 2px 8px rgba(70, 104, 66, 0.18); }
.question-send-btn:hover { background: #5a7a52; box-shadow: 0 4px 12px rgba(70, 104, 66, 0.22); }
.question-send-btn:disabled { color: #ccc; cursor: not-allowed; background: #e0e0e0; box-shadow: none; }
.question-send-btn .material-icons { font-size: 1.2rem; color: #fff; }

.question-mic-btn { right: 52px; background: #f6f6fa; color: #466842; box-shadow: 0 2px 8px rgba(70, 104, 66, 0.08); }
.question-mic-btn:hover { background: #eafbe3; box-shadow: 0 4px 12px rgba(70, 104, 66, 0.12); }
.question-mic-btn .material-icons { font-size: 1.2rem; color: #466842; }

.question-attach-btn { right: 96px; background: #f6f6fa; color: #466842; box-shadow: 0 2px 8px rgba(70, 104, 66, 0.08); }
.question-attach-btn:hover { background: #eafbe3; box-shadow: 0 4px 12px rgba(70, 104, 66, 0.12); }
.question-attach-btn .material-icons { font-size: 1.2rem; color: #466842; }

#textChatInput {
    min-height: 20px;
    max-height: 120px;
    overflow-y: hidden;
    padding-left: 8px !important;
    padding-bottom: 6px !important;
    resize: none;
    width: 100%;
    box-sizing: border-box;
    border-radius: 18px;
    background: #f8f9fa;
}

#textChatInput.scrollable {
    overflow-y: auto;
}

/* Custom scrollbar styling for textarea */
#textChatInput.scrollable::-webkit-scrollbar {
    width: 6px;
}

#textChatInput.scrollable::-webkit-scrollbar-track {
    background: transparent;
}

#textChatInput.scrollable::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#textChatInput.scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .web-search-chip { font-size: 0.85rem; padding: 1px 7px 1px 5px; height: 22px; left: 4px; bottom: 4px; }
    .question-send-btn, .question-mic-btn, .question-attach-btn { width: 32px; height: 32px; font-size: 1rem; bottom: 4px; }
    .question-send-btn { right: 6px; }
    .question-mic-btn { right: 44px; }
    .question-attach-btn { right: 78px; }
    #textChatInput { padding-left: 48px !important; padding-bottom: 48px !important; }
}

#listening-indicator {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -24px;
    background: var(--primary-green);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: none;
    animation: fadeInDown 0.3s ease-out;
}

.question-mute-btn {
    position: absolute;
    left: 3.2rem;
    color: var(--primary-green);
    font-size: 1.7rem;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.question-mute-btn:hover {
    color: var(--primary-green-dark);
}
.question-mute-btn.active {
    color: #DC2525;
}
.question-mute-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.language-select {
    position: absolute;
    left: 4rem;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    z-index: 2;
    min-width: 100px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.language-select:hover {
    border-color: var(--primary-green);
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(64, 171, 38, 0.2);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Q&A Cards */
#qa-cards-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0 32px 32px 32px;
    width: calc(100% - 64px);
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important; /* Force prevent horizontal overflow */
    overflow-y: visible;
    min-width: 0; /* Allow flex items to shrink */
}

/* EMERGENCY containment - force everything to respect bounds */
#qa-cards-container * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Specifically target any rogue tables */
#qa-cards-container table {
    max-width: 100% !important;
    width: auto !important;
    table-layout: auto !important;
    overflow-x: auto !important;
    display: block !important;
}
.qa-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.1);
    border: 1px solid var(--primary-green-light);
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important; /* Force prevent card overflow */
    overflow-y: visible;
    min-width: 0; /* Allow card to shrink */
}

/* Force all qa-card content to respect bounds */
.qa-card * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Create wrapper for better table handling */
.qa-card table {
    width: 100% !important; /* Fill available space */
    max-width: none !important;
    display: table !important; /* Keep table behavior */
    border-collapse: collapse !important;
    margin: 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    table-layout: auto !important; /* Auto layout for natural column sizing */
    background: white !important;
}

/* Wrapper div for overflow handling */
.qa-card .table-scroll-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 400px !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    margin: 8px 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background: white !important;
    /* Custom scrollbar */
    scrollbar-width: thin !important;
    scrollbar-color: #c1c1c1 #f1f1f1 !important;
}

/* Webkit scrollbars for table wrapper overflow */
.qa-card .table-scroll-wrapper::-webkit-scrollbar {
    height: 8px !important;
    width: 8px !important;
}

.qa-card .table-scroll-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 4px !important;
}

.qa-card .table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1 !important;
    border-radius: 4px !important;
}

.qa-card .table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8 !important;
}

/* Force table cells to wrap properly */
.qa-card table td,
.qa-card table th {
    max-width: 200px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    box-sizing: border-box !important;
    word-break: break-word !important;
}
.qa-question {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    position: relative;
}
.qa-question .material-icons {
    color: var(--primary-green);
    font-size: 1.2rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}
.qa-question-text {
    flex: 1;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    transition: all 0.3s ease;
}
.qa-question-expand-btn {
    background: none;
    border: none;
    color: var(--primary-green);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
.qa-question-expand-btn:hover {
    background: rgba(64, 171, 38, 0.1);
    transform: scale(1.1);
}
.qa-question-expand-btn .material-icons {
    font-size: 1rem;
    margin: 0;
}
.qa-question.expanded .qa-question-text {
    max-height: none;
}
.qa-question:not(.expanded) .qa-question-text {
    max-height: 4.5em; /* Approximately 3 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.qa-answer {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding-right: 80px; /* Make room for audio controls */
    animation: answerSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow: hidden !important; /* Force contain all content including tables */
    min-width: 0; /* Allow flex item to shrink */
}

/* Force all direct children to respect container bounds */
.qa-answer > * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.qa-answer .material-icons {
    color: #7be86a;
    font-size: 1.2em;
    margin-right: 6px;
}

/* Inline Sources Section Styles */
.qa-sources-inline {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--primary-green-light);
}

.qa-sources-inline-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-green);
    margin-bottom: 0.6rem;
}

.qa-sources-inline-title .material-icons {
    font-size: 1rem;
}

.qa-sources-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.qa-source-inline-chip {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--primary-green-light);
    border: 1px solid var(--primary-green);
    border-radius: 16px;
    padding: 0.2rem 0.4rem;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.7rem;
    max-width: 180px;
}

.qa-source-inline-chip:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(64, 171, 38, 0.3);
}

.source-inline-filename {
    font-weight: 500;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    flex: 1;
}

.source-relevance-score {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.8;
    line-height: 1;
}

.source-inline-download-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.source-inline-download-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.source-inline-download-btn .material-icons {
    font-size: 0.9rem;
}

/* Mobile responsive styles for inline sources */
@media (max-width: 768px) {
    .qa-sources-inline {
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }
    
    .qa-sources-inline-title {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .qa-sources-inline-list {
        gap: 0.3rem;
    }
    
    .qa-source-inline-chip {
        padding: 0.15rem 0.3rem;
        font-size: 0.65rem;
        max-width: 160px;
    }
    
    .source-inline-filename {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .qa-sources-inline {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .qa-sources-inline-title {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }
    
    .qa-sources-inline-list {
        gap: 0.25rem;
    }
    
    .qa-source-inline-chip {
        padding: 0.1rem 0.25rem;
        font-size: 0.6rem;
        max-width: 140px;
    }
    
    .source-inline-filename {
        font-size: 0.6rem;
    }
    
    .source-inline-download-btn {
        min-width: 16px;
        height: 16px;
    }
    
    .source-inline-download-btn .material-icons {
        font-size: 0.7rem;
    }
}

/* Audio controls */
.qa-audio-container {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.qa-audio-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-audio-loader .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Spinner overlay for play button */
.qa-audio-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(1px);
}

.qa-audio-spinner-overlay .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mobile responsive styles for spinner overlay */
@media (max-width: 768px) {
    .qa-audio-spinner-overlay .spinner {
        width: 14px;
        height: 14px;
        border-width: 1.5px;
    }
}

@media (max-width: 480px) {
    .qa-audio-spinner-overlay .spinner {
        width: 12px;
        height: 12px;
        border-width: 1px;
    }
}

.qa-play-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.3);
    padding: 4px;
    font-size: 1.05rem;
}

.qa-play-btn:hover {
    background: var(--primary-green-dark);
    box-shadow: 0 6px 16px rgba(64, 171, 38, 0.4);
    transform: scale(1.05);
}

.qa-play-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #e0e0e0;
    box-shadow: none;
}

.qa-play-btn .material-icons, .qa-reply-btn .material-icons, .qa-copy-btn .material-icons {
    color: white !important;
    font-family: 'Material Icons', 'MaterialIcons', sans-serif;
    font-size: 1.3rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: none;
    padding: 2px;
    box-sizing: border-box;
}

/* Fallback for Material Icons */
.qa-play-btn:not(:has(.material-icons))::before {
    content: "▶";
    font-family: sans-serif;
}

.qa-reply-btn {
    background: #444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.3);
    padding: 4px;
    font-size: 1.05rem;
    margin-top: 4px;
}

.qa-reply-btn:hover {
    background: #222;
}

.qa-reply-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #888;
    box-shadow: none;
}

.streaming-progress {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.progress-text {
    font-weight: 500;
}

/* Ask Button */
.ask-btn {
    margin: 0 32px;
    margin-top: 8px;
    padding: 1rem 0;
    border-radius: 24px;
    background: var(--primary-green-gradient);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    box-shadow: 0 2px 8px rgba(64,171,38,0.10);
    cursor: pointer;
    transition: background 0.2s;
}
.ask-btn:hover, .ask-btn:focus {
    background: linear-gradient(90deg, #7be86a 0%, #40ab26 100%);
}

/* Hide old chat styles for new UI */
.chat-app, .chat-header, .chat-container, .chat-list-section, .chat-typing-section, .chat-controls, .text-chat-controls, #chat-messages, .message, .user-message, .ai-message, .status {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Drawer styles */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 100%;
    background: #FFF2EB;
    box-shadow: 2px 0 12px rgba(255,214,186,0.08);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    padding: 0 0 24px 0;
}
.drawer.open {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 24px 0 24px;
    position: relative;
}
.drawer-header h2 {
    margin: 0 auto;
    font-size: 1.3rem;
    padding-left: 0;
    flex: 1;
    text-align: center;
    width: 100%;
    color: var(--primary-green);
}
.drawer .btn {
    margin: 24px 24px 0 24px;
    width: calc(100% - 48px);
    background: var(--primary-green-gradient);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.drawer .btn:hover, .drawer .btn:focus {
    background: linear-gradient(90deg, var(--primary-green-dark) 0%, var(--primary-green) 100%);
}
.drawer .file-list {
    margin: 24px 24px 0 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.drawer .file-list h3 {
    margin: 0 0 10px 0;
    color: #666;
    flex-shrink: 0;
}
.drawer #uploadedFiles {
    background: #f8fafc;
    border-radius: 8px;
    padding: 2px;
    min-height: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
    border: 1px solid #e2e8f0;
    max-height: 32px;
    align-content: flex-start;
}
.drawer-hamburger {
    position: absolute;
    top: 32px;
    left: 32px;
    font-size: 2.2rem;
    background: none;
    border: none;
    color: #466842;
    z-index: 1201;
    cursor: pointer;
    transition: color 0.2s;
    outline: none;
    display: none;
}

/* Mobile responsive design */
@media (max-width: 768px) {
    /* Hide upload drawer hamburger on mobile - show thread sidebar instead */
    .drawer-hamburger {
        display: none !important;
    }
    
    /* Ensure thread sidebar toggle is visible and properly positioned */
    .thread-sidebar-toggle {
        display: flex !important;
        position: fixed !important;
        left: 16px !important;
        top: 16px !important;
        width: 44px !important;
        height: 44px !important;
        z-index: 10002 !important;
        background: linear-gradient(135deg, #466842 0%, #5a7a52 100%) !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        box-shadow: 0 4px 16px rgba(70, 104, 66, 0.3) !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .thread-sidebar-toggle .material-icons {
        font-size: 22px !important;
        font-weight: 600 !important;
    }
    
    /* Make drawer full width on mobile */
    .drawer {
        width: 100%;
        max-width: 100vw;
    }
}
.drawer-hamburger:hover {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1100;
    background: #fff;
    border: none;
    font-size: 2rem;
    color: #466842;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: 0 2px 8px rgba(70, 104, 66, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.drawer-hamburger:hover {
    background: #9BC09C;
}

#uploadBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1.1rem 2.2rem;
    border: none;
    border-radius: 28px;
    background: var(--primary-green-gradient);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(64, 171, 38, 0.2);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    margin-top: 18px;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}
#uploadBtn:hover, #uploadBtn:focus {
    background: linear-gradient(90deg, var(--primary-green-dark) 0%, var(--primary-green) 100%);
    box-shadow: 0 6px 20px rgba(64, 171, 38, 0.3);
    transform: translateY(-2px) scale(1.03);
}
#uploadBtn .material-icons {
    font-size: 1.4em;
    margin-right: 6px;
    vertical-align: middle;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 8px 1px 8px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0c4a6e;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 500;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid #bae6fd;
    width: auto;
    min-width: 60px;
    max-width: 160px;
    overflow: hidden;
    position: relative;
    height: 18px;
    transition: all 0.2s ease;
    word-break: break-word;
    hyphens: auto;
    flex-shrink: 0;
}

.file-chip:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #7dd3fc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.file-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 2px;
    line-height: 1;
    max-width: calc(100% - 12px);
    font-size: 0.7em;
}

.file-chip-cross {
    flex: 0 0 auto;
    margin-left: 2px;
    color: #0c4a6e;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.6em;
    transition: all 0.2s ease;
    background: rgba(186, 230, 253, 0.6);
    padding: 0;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.file-chip-cross:hover {
    color: #fff;
    background: #ef4444;
    border-color: #dc2626;
    transform: scale(1.1);
}

.file-chip-cross:active {
    transform: scale(0.95);
}

/* Empty state styling */
.drawer #uploadedFiles:empty::before {
    content: "No documents uploaded";
    color: #94a3b8;
    font-style: italic;
    font-size: 0.7em;
    text-align: center;
    width: 100%;
    padding: 6px 0;
    display: block;
}

/* Responsive improvements */
@media (max-width: 900px), (max-width: 600px), (max-width: 480px), (max-width: 360px) {
    /* No changes for uploaded files view */
}

#uploadStatus {
    margin: 10px 0;
    color: #DC2525;
}

@media (max-width: 900px) {
    .chat-app {
        position: static;
        left: unset;
        bottom: unset;
        transform: none;
        z-index: unset;
        border-radius: 0;
        border: none;
        box-shadow: none;
        height: 100vh;
        max-height: 100vh;
    }
    .chat-list-section {
        padding-bottom: 72px;
    }
    .chat-typing-section {
        border-radius: 0;
    }
    .chat-controls {
        width: 100%;
        max-width: 100%;
        left: unset;
        transform: none;
        margin: 0;
    }
}

@media (max-width: 600px) {
    .chat-app {
        height: 100vh;
        width: 100vw;
        max-width: 100vw;
    }
    .chat-header {
        height: 52px;
        padding: 0.5rem 0.5rem;
    }
    .chat-avatar {
        width: 32px;
        height: 32px;
        margin-right: 0.7rem;
    }
    .chat-title {
        font-size: 1rem;
    }
    .chat-container {
        padding: 0.7rem 0.2rem 0.7rem 0.2rem;
    }
    .chat-controls {
        padding: 0.5rem 0.5rem 0.7rem 0.5rem;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    .text-chat-controls {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        width: 100%;
    }
    #textChatInput {
        font-size: 0.98rem;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
    }
    #textChatSend, .speak-btn, .mute-btn {
        min-width: 44px;
        min-height: 44px;
        max-width: 44px;
        max-height: 44px;
        font-size: 1.2rem;
        flex: 0 0 auto;
    }
    #textChatSend .material-icons, .speak-btn .material-icons, .mute-btn .material-icons {
        font-size: 1.3em;
    }
    .speak-btn, .mute-btn {
        margin: 0;
        align-self: center;
    }
    .text-chat-controls, .chat-controls {
        width: 100%;
    }
    
    /* Mobile styles for question bar */
    .question-bar {
        margin: 0 16px 16px 16px;
        padding: 0.4rem 1rem;
    }
    
    .question-bar textarea {
        font-size: 1.1rem;
        padding: 1rem 4.5rem 1rem 1rem;
        min-height: 50px;
    }
    
    .question-send-btn, .question-mic-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        padding: 5px;
    }
    
    .question-send-btn {
        right: 5.5rem;
        bottom: 1rem;
    }
    
    .question-mic-btn {
        right: 1.8rem;
        bottom: 1rem;
    }
}

@media (max-width: 400px) {
    .chat-controls {
        padding: 0.2rem 0.2rem 0.4rem 0.2rem;
    }
    #textChatInput {
        font-size: 0.95rem;
    }
    
    /* Very small screen styles for question bar */
    .question-bar {
        margin: 0 12px 12px 12px;
        padding: 0.3rem 0.8rem;
    }
    
    .question-bar textarea {
        font-size: 1rem;
        padding: 0.8rem 4rem 0.8rem 0.8rem;
        min-height: 45px;
    }
    
    .question-send-btn, .question-mic-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        padding: 5px;
    }
    
    .question-send-btn {
        right: 5.5rem;
        bottom: 0.8rem;
    }
    
    .question-mic-btn {
        right: 1.8rem;
        bottom: 0.8rem;
    }
}

.speak-btn .material-icons, .mute-btn .material-icons {
    color: #fff !important;
}
.speak-btn:active .material-icons, .speak-btn.active .material-icons,
.mute-btn:active .material-icons, .mute-btn.active .material-icons {
    color: #fff !important;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-green-light);
}
::-webkit-scrollbar-track {
    background: #fff;
}

.answer-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #7c4dff;
    font-style: italic;
}

.answer-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.quanex-logo-img {
    display: inline-block;
    vertical-align: middle;
    margin-left: 5vw;
    margin-top: 18px;
    width: 220px;
    height: auto;
    background: transparent;
    pointer-events: none;
    user-select: none;
    position: static;
}

/* Welcome Animation Styles */
.welcome-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px 20px;
    animation: fadeInUp 1s ease-out;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    animation: slideInUp 1.2s ease-out 0.3s both;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.welcome-title {
    font-size: 2.2rem;
    color: var(--primary-green);
    margin-bottom: 16px;
    font-weight: 700;
    animation: fadeInUp 1s ease-out 0.5s both;
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 40px;
    line-height: 1.6;
    animation: fadeInUp 1s ease-out 0.7s both;
}

.suggested-questions {
    margin-bottom: 30px;
    animation: fadeInUp 1s ease-out 0.9s both;
}

.suggested-questions h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.question-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideInLeft 0.8s ease-out both;
}

.suggestion-item:nth-child(1) { animation-delay: 1.1s; }
.suggestion-item:nth-child(2) { animation-delay: 1.3s; }
.suggestion-item:nth-child(3) { animation-delay: 1.5s; }
.suggestion-item:nth-child(4) { animation-delay: 1.7s; }

.suggestion-item:hover {
    background: linear-gradient(135deg, var(--primary-green-light) 0%, #d4edda 100%);
    border-color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(64, 171, 38, 0.15);
}

.suggestion-item .material-icons {
    font-size: 1.5rem;
    color: var(--primary-green);
}

.suggestion-item span:last-child {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.welcome-tips {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 16px 20px;
    animation: fadeInUp 1s ease-out 1.9s both;
}

.welcome-tips p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Hide welcome animation when there are Q&A cards */
#qa-cards-container:not(:empty) + .welcome-animation {
    display: none;
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.file-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    word-break: break-word;
    border: 1px solid #bbdefb;
    flex-shrink: 0;
}

.file-tag .delete-btn {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    margin-left: 4px;
    flex-shrink: 0;
}

.file-tag .delete-btn:hover {
    color: #b71c1c;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #fff;
    margin-left: 0;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

.drawer-open .chat-container {
    margin-left: 400px;
}

.drawer #uploadedFiles::-webkit-scrollbar {
    width: 6px;
}

.drawer #uploadedFiles::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.drawer #uploadedFiles::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.drawer #uploadedFiles::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Text Selection Popup Styles */
.text-selection-popup {
    position: fixed;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.popup-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.popup-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.popup-close-btn:hover {
    background-color: #e9ecef;
    color: #333;
}

.popup-content {
    padding: 16px;
}

.selected-text-container {
    margin-bottom: 16px;
}

.selected-text-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selected-text-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #495057;
    max-height: 80px;
    overflow-y: auto;
    font-style: italic;
}

.query-input-container {
    margin-bottom: 16px;
}

.query-input-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.query-input {
    width: 100%;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    box-sizing: border-box;
}

.query-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.popup-actions {
    display: flex;
    justify-content: flex-end;
}

.popup-send-btn {
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}

.popup-send-btn:hover {
    background: #1565c0;
}

.popup-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.popup-send-btn .material-icons {
    font-size: 16px;
}

/* Animation for popup appearance */
.text-selection-popup {
    animation: popupSlideIn 0.2s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Question bar layout updates */
.question-input-container {
    position: relative;
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 48px;
}

.web-search-chip {
    position: absolute;
    left: 8px;
    bottom: 8px;
    top: auto;
    transform: none;
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 2px 10px 2px 7px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #466842;
    box-shadow: 0 1px 4px rgba(70, 104, 66, 0.06);
    border: 1px solid #e0e0e0;
    cursor: pointer;
    height: 28px;
    z-index: 2;
}

#textChatInput {
    min-height: 20px;
    max-height: 120px;
    overflow-y: hidden;
    padding-left: 8px !important;
    padding-bottom: 6px !important;
    resize: none;
    width: 100%;
    box-sizing: border-box;
    border-radius: 18px;
    background: #f8f9fa;
}

@media (max-width: 600px) {
    .web-search-chip { font-size: 0.85rem; padding: 1px 7px 1px 5px; height: 22px; left: 4px; bottom: 4px; }
    .question-send-btn, .question-mic-btn, .question-attach-btn { width: 32px; height: 32px; font-size: 1rem; bottom: 4px; }
    .question-send-btn { right: 6px; }
    .question-mic-btn { right: 44px; }
    .question-attach-btn { right: 78px; }
    #textChatInput { padding-left: 48px !important; padding-bottom: 48px !important; }
}

#listening-indicator {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -24px;
    background: var(--primary-green);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: none;
    animation: fadeInDown 0.3s ease-out;
}

.question-mute-btn {
    position: absolute;
    left: 3.2rem;
    color: var(--primary-green);
    font-size: 1.7rem;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.question-mute-btn:hover {
    color: var(--primary-green-dark);
}
.question-mute-btn.active {
    color: #DC2525;
}
.question-mute-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.language-select {
    position: absolute;
    left: 4rem;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    z-index: 2;
    min-width: 100px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.language-select:hover {
    border-color: var(--primary-green);
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(64, 171, 38, 0.2);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Q&A Cards */
#qa-cards-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0 32px 32px 32px;
    width: calc(100% - 64px);
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important; /* Force prevent horizontal overflow */
    overflow-y: visible;
    min-width: 0; /* Allow flex items to shrink */
}

/* EMERGENCY containment - force everything to respect bounds */
#qa-cards-container * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Specifically target any rogue tables */
#qa-cards-container table {
    max-width: 100% !important;
    width: auto !important;
    table-layout: auto !important;
    overflow-x: auto !important;
    display: block !important;
}
.qa-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.1);
    border: 1px solid var(--primary-green-light);
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important; /* Force prevent card overflow */
    overflow-y: visible;
    min-width: 0; /* Allow card to shrink */
}

/* Force all qa-card content to respect bounds */
.qa-card * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Create wrapper for better table handling */
.qa-card table {
    width: 100% !important; /* Fill available space */
    max-width: none !important;
    display: table !important; /* Keep table behavior */
    border-collapse: collapse !important;
    margin: 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    table-layout: auto !important; /* Auto layout for natural column sizing */
    background: white !important;
}

/* Wrapper div for overflow handling */
.qa-card .table-scroll-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 400px !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    margin: 8px 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background: white !important;
    /* Custom scrollbar */
    scrollbar-width: thin !important;
    scrollbar-color: #c1c1c1 #f1f1f1 !important;
}

/* Webkit scrollbars for table wrapper overflow */
.qa-card .table-scroll-wrapper::-webkit-scrollbar {
    height: 8px !important;
    width: 8px !important;
}

.qa-card .table-scroll-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 4px !important;
}

.qa-card .table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1 !important;
    border-radius: 4px !important;
}

.qa-card .table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8 !important;
}

/* Force table cells to wrap properly */
.qa-card table td,
.qa-card table th {
    max-width: 200px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    box-sizing: border-box !important;
    word-break: break-word !important;
}
.qa-question {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    position: relative;
}
.qa-question .material-icons {
    color: var(--primary-green);
    font-size: 1.2rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}
.qa-question-text {
    flex: 1;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    transition: all 0.3s ease;
}
.qa-question-expand-btn {
    background: none;
    border: none;
    color: var(--primary-green);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
.qa-question-expand-btn:hover {
    background: rgba(64, 171, 38, 0.1);
    transform: scale(1.1);
}
.qa-question-expand-btn .material-icons {
    font-size: 1rem;
    margin: 0;
}
.qa-question.expanded .qa-question-text {
    max-height: none;
}
.qa-question:not(.expanded) .qa-question-text {
    max-height: 4.5em; /* Approximately 3 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.qa-answer {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding-right: 80px; /* Make room for audio controls */
    animation: answerSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow: hidden !important; /* Force contain all content including tables */
    min-width: 0; /* Allow flex item to shrink */
}

/* Force all direct children to respect container bounds */
.qa-answer > * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.qa-answer .material-icons {
    color: #7be86a;
    font-size: 1.2em;
    margin-right: 6px;
}

/* Inline Sources Section Styles */
.qa-sources-inline {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--primary-green-light);
}

.qa-sources-inline-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-green);
    margin-bottom: 0.6rem;
}

.qa-sources-inline-title .material-icons {
    font-size: 1rem;
}

.qa-sources-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.qa-source-inline-chip {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--primary-green-light);
    border: 1px solid var(--primary-green);
    border-radius: 16px;
    padding: 0.2rem 0.4rem;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.7rem;
    max-width: 180px;
}

.qa-source-inline-chip:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(64, 171, 38, 0.3);
}

.source-inline-filename {
    font-weight: 500;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    flex: 1;
}

.source-relevance-score {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.8;
    line-height: 1;
}

.source-inline-download-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.source-inline-download-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.source-inline-download-btn .material-icons {
    font-size: 0.9rem;
}

/* Mobile responsive styles for inline sources */
@media (max-width: 768px) {
    .qa-sources-inline {
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }
    
    .qa-sources-inline-title {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .qa-sources-inline-list {
        gap: 0.3rem;
    }
    
    .qa-source-inline-chip {
        padding: 0.15rem 0.3rem;
        font-size: 0.65rem;
        max-width: 160px;
    }
    
    .source-inline-filename {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .qa-sources-inline {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .qa-sources-inline-title {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }
    
    .qa-sources-inline-list {
        gap: 0.25rem;
    }
    
    .qa-source-inline-chip {
        padding: 0.1rem 0.25rem;
        font-size: 0.6rem;
        max-width: 140px;
    }
    
    .source-inline-filename {
        font-size: 0.6rem;
    }
    
    .source-inline-download-btn {
        min-width: 16px;
        height: 16px;
    }
    
    .source-inline-download-btn .material-icons {
        font-size: 0.7rem;
    }
}

/* Audio controls */
.qa-audio-container {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.qa-audio-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-audio-loader .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Spinner overlay for play button */
.qa-audio-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(1px);
}

.qa-audio-spinner-overlay .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mobile responsive styles for spinner overlay */
@media (max-width: 768px) {
    .qa-audio-spinner-overlay .spinner {
        width: 14px;
        height: 14px;
        border-width: 1.5px;
    }
}

@media (max-width: 480px) {
    .qa-audio-spinner-overlay .spinner {
        width: 12px;
        height: 12px;
        border-width: 1px;
    }
}

.qa-play-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.3);
    padding: 4px;
    font-size: 1.05rem;
}

.qa-play-btn:hover {
    background: var(--primary-green-dark);
    box-shadow: 0 6px 16px rgba(64, 171, 38, 0.4);
    transform: scale(1.05);
}

.qa-play-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #e0e0e0;
    box-shadow: none;
}

.qa-play-btn .material-icons, .qa-reply-btn .material-icons, .qa-copy-btn .material-icons {
    color: white !important;
    font-family: 'Material Icons', 'MaterialIcons', sans-serif;
    font-size: 1.3rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: none;
    padding: 2px;
    box-sizing: border-box;
}

/* Fallback for Material Icons */
.qa-play-btn:not(:has(.material-icons))::before {
    content: "▶";
    font-family: sans-serif;
}

.qa-reply-btn {
    background: #444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.3);
    padding: 4px;
    font-size: 1.05rem;
    margin-top: 4px;
}

.qa-reply-btn:hover {
    background: #222;
}

.qa-reply-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #888;
    box-shadow: none;
}

.streaming-progress {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.progress-text {
    font-weight: 500;
}

/* Ask Button */
.ask-btn {
    margin: 0 32px;
    margin-top: 8px;
    padding: 1rem 0;
    border-radius: 24px;
    background: var(--primary-green-gradient);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    box-shadow: 0 2px 8px rgba(64,171,38,0.10);
    cursor: pointer;
    transition: background 0.2s;
}
.ask-btn:hover, .ask-btn:focus {
    background: linear-gradient(90deg, #7be86a 0%, #40ab26 100%);
}

/* Hide old chat styles for new UI */
.chat-app, .chat-header, .chat-container, .chat-list-section, .chat-typing-section, .chat-controls, .text-chat-controls, #chat-messages, .message, .user-message, .ai-message, .status {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Drawer styles */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 100%;
    background: #FFF2EB;
    box-shadow: 2px 0 12px rgba(255,214,186,0.08);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    padding: 0 0 24px 0;
}
.drawer.open {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 24px 0 24px;
    position: relative;
}
.drawer-header h2 {
    margin: 0 auto;
    font-size: 1.3rem;
    padding-left: 0;
    flex: 1;
    text-align: center;
    width: 100%;
    color: var(--primary-green);
}
.drawer .btn {
    margin: 24px 24px 0 24px;
    width: calc(100% - 48px);
    background: var(--primary-green-gradient);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.drawer .btn:hover, .drawer .btn:focus {
    background: linear-gradient(90deg, var(--primary-green-dark) 0%, var(--primary-green) 100%);
}
.drawer .file-list {
    margin: 24px 24px 0 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.drawer .file-list h3 {
    margin: 0 0 10px 0;
    color: #666;
    flex-shrink: 0;
}
.drawer #uploadedFiles {
    background: #f8fafc;
    border-radius: 8px;
    padding: 2px;
    min-height: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
    border: 1px solid #e2e8f0;
    max-height: 32px;
    align-content: flex-start;
}
.drawer-hamburger {
    position: absolute;
    top: 32px;
    left: 32px;
    font-size: 2.2rem;
    background: none;
    border: none;
    color: #466842;
    z-index: 1201;
    cursor: pointer;
    transition: color 0.2s;
    outline: none;
    display: none;
}
.drawer-hamburger:hover {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1100;
    background: #fff;
    border: none;
    font-size: 2rem;
    color: #466842;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: 0 2px 8px rgba(70, 104, 66, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.drawer-hamburger:hover {
    background: #9BC09C;
}

#uploadBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1.1rem 2.2rem;
    border: none;
    border-radius: 28px;
    background: var(--primary-green-gradient);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(64, 171, 38, 0.2);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    margin-top: 18px;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}
#uploadBtn:hover, #uploadBtn:focus {
    background: linear-gradient(90deg, var(--primary-green-dark) 0%, var(--primary-green) 100%);
    box-shadow: 0 6px 20px rgba(64, 171, 38, 0.3);
    transform: translateY(-2px) scale(1.03);
}
#uploadBtn .material-icons {
    font-size: 1.4em;
    margin-right: 6px;
    vertical-align: middle;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 8px 1px 8px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0c4a6e;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 500;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid #bae6fd;
    width: auto;
    min-width: 60px;
    max-width: 160px;
    overflow: hidden;
    position: relative;
    height: 18px;
    transition: all 0.2s ease;
    word-break: break-word;
    hyphens: auto;
    flex-shrink: 0;
}

.file-chip:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #7dd3fc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.file-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 2px;
    line-height: 1;
    max-width: calc(100% - 12px);
    font-size: 0.7em;
}

.file-chip-cross {
    flex: 0 0 auto;
    margin-left: 2px;
    color: #0c4a6e;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.6em;
    transition: all 0.2s ease;
    background: rgba(186, 230, 253, 0.6);
    padding: 0;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.file-chip-cross:hover {
    color: #fff;
    background: #ef4444;
    border-color: #dc2626;
    transform: scale(1.1);
}

.file-chip-cross:active {
    transform: scale(0.95);
}

/* Empty state styling */
.drawer #uploadedFiles:empty::before {
    content: "No documents uploaded";
    color: #94a3b8;
    font-style: italic;
    font-size: 0.7em;
    text-align: center;
    width: 100%;
    padding: 6px 0;
    display: block;
}

/* Responsive improvements */
@media (max-width: 900px), (max-width: 600px), (max-width: 480px), (max-width: 360px) {
    /* No changes for uploaded files view */
}

#uploadStatus {
    margin: 10px 0;
    color: #DC2525;
}

@media (max-width: 900px) {
    .chat-app {
        position: static;
        left: unset;
        bottom: unset;
        transform: none;
        z-index: unset;
        border-radius: 0;
        border: none;
        box-shadow: none;
        height: 100vh;
        max-height: 100vh;
    }
    .chat-list-section {
        padding-bottom: 72px;
    }
    .chat-typing-section {
        border-radius: 0;
    }
    .chat-controls {
        width: 100%;
        max-width: 100%;
        left: unset;
        transform: none;
        margin: 0;
    }
}

@media (max-width: 600px) {
    .chat-app {
        height: 100vh;
        width: 100vw;
        max-width: 100vw;
    }
    .chat-header {
        height: 52px;
        padding: 0.5rem 0.5rem;
    }
    .chat-avatar {
        width: 32px;
        height: 32px;
        margin-right: 0.7rem;
    }
    .chat-title {
        font-size: 1rem;
    }
    .chat-container {
        padding: 0.7rem 0.2rem 0.7rem 0.2rem;
    }
    .chat-controls {
        padding: 0.5rem 0.5rem 0.7rem 0.5rem;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    .text-chat-controls {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        width: 100%;
    }
    #textChatInput {
        font-size: 0.98rem;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
    }
    #textChatSend, .speak-btn, .mute-btn {
        min-width: 44px;
        min-height: 44px;
        max-width: 44px;
        max-height: 44px;
        font-size: 1.2rem;
        flex: 0 0 auto;
    }
    #textChatSend .material-icons, .speak-btn .material-icons, .mute-btn .material-icons {
        font-size: 1.3em;
    }
    .speak-btn, .mute-btn {
        margin: 0;
        align-self: center;
    }
    .text-chat-controls, .chat-controls {
        width: 100%;
    }
    
    /* Mobile styles for question bar */
    .question-bar {
        margin: 0 16px 16px 16px;
        padding: 0.4rem 1rem;
    }
    
    .question-bar textarea {
        font-size: 1.1rem;
        padding: 1rem 4.5rem 1rem 1rem;
        min-height: 50px;
    }
    
    .question-send-btn, .question-mic-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        padding: 5px;
    }
    
    .question-send-btn {
        right: 5.5rem;
        bottom: 1rem;
    }
    
    .question-mic-btn {
        right: 1.8rem;
        bottom: 1rem;
    }
}

@media (max-width: 400px) {
    .chat-controls {
        padding: 0.2rem 0.2rem 0.4rem 0.2rem;
    }
    #textChatInput {
        font-size: 0.95rem;
    }
    
    /* Very small screen styles for question bar */
    .question-bar {
        margin: 0 12px 12px 12px;
        padding: 0.3rem 0.8rem;
    }
    
    .question-bar textarea {
        font-size: 1rem;
        padding: 0.8rem 4rem 0.8rem 0.8rem;
        min-height: 45px;
    }
    
    .question-send-btn, .question-mic-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        padding: 5px;
    }
    
    .question-send-btn {
        right: 5.5rem;
        bottom: 0.8rem;
    }
    
    .question-mic-btn {
        right: 1.8rem;
        bottom: 0.8rem;
    }
}

.speak-btn .material-icons, .mute-btn .material-icons {
    color: #fff !important;
}
.speak-btn:active .material-icons, .speak-btn.active .material-icons,
.mute-btn:active .material-icons, .mute-btn.active .material-icons {
    color: #fff !important;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-green-light);
}
::-webkit-scrollbar-track {
    background: #fff;
}

.answer-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #7c4dff;
    font-style: italic;
}

.answer-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.quanex-logo-img {
    display: inline-block;
    vertical-align: middle;
    margin-left: 5vw;
    margin-top: 18px;
    width: 220px;
    height: auto;
    background: transparent;
    pointer-events: none;
    user-select: none;
    position: static;
}

/* Welcome Animation Styles */
.welcome-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px 20px;
    animation: fadeInUp 1s ease-out;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    animation: slideInUp 1.2s ease-out 0.3s both;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.welcome-title {
    font-size: 2.2rem;
    color: var(--primary-green);
    margin-bottom: 16px;
    font-weight: 700;
    animation: fadeInUp 1s ease-out 0.5s both;
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 40px;
    line-height: 1.6;
    animation: fadeInUp 1s ease-out 0.7s both;
}

.suggested-questions {
    margin-bottom: 30px;
    animation: fadeInUp 1s ease-out 0.9s both;
}

.suggested-questions h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.question-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideInLeft 0.8s ease-out both;
}

.suggestion-item:nth-child(1) { animation-delay: 1.1s; }
.suggestion-item:nth-child(2) { animation-delay: 1.3s; }
.suggestion-item:nth-child(3) { animation-delay: 1.5s; }
.suggestion-item:nth-child(4) { animation-delay: 1.7s; }

.suggestion-item:hover {
    background: linear-gradient(135deg, var(--primary-green-light) 0%, #d4edda 100%);
    border-color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(64, 171, 38, 0.15);
}

.suggestion-item .material-icons {
    font-size: 1.5rem;
    color: var(--primary-green);
}

.suggestion-item span:last-child {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.welcome-tips {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 16px 20px;
    animation: fadeInUp 1s ease-out 1.9s both;
}

.welcome-tips p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Hide welcome animation when there are Q&A cards */
#qa-cards-container:not(:empty) + .welcome-animation {
    display: none;
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.file-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    word-break: break-word;
    border: 1px solid #bbdefb;
    flex-shrink: 0;
}

.file-tag .delete-btn {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    margin-left: 4px;
    flex-shrink: 0;
}

.file-tag .delete-btn:hover {
    color: #b71c1c;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #fff;
    margin-left: 0;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

.drawer-open .chat-container {
    margin-left: 400px;
}

.drawer #uploadedFiles::-webkit-scrollbar {
    width: 6px;
}

.drawer #uploadedFiles::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.drawer #uploadedFiles::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.drawer #uploadedFiles::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Text Selection Popup Styles */
.text-selection-popup {
    position: fixed;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.popup-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.popup-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.popup-close-btn:hover {
    background-color: #e9ecef;
    color: #333;
}

.popup-content {
    padding: 16px;
}

.selected-text-container {
    margin-bottom: 16px;
}

.selected-text-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selected-text-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #495057;
    max-height: 80px;
    overflow-y: auto;
    font-style: italic;
}

.query-input-container {
    margin-bottom: 16px;
}

.query-input-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.query-input {
    width: 100%;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    box-sizing: border-box;
}

.query-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.popup-actions {
    display: flex;
    justify-content: flex-end;
}

.popup-send-btn {
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}

.popup-send-btn:hover {
    background: #1565c0;
}

.popup-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.popup-send-btn .material-icons {
    font-size: 16px;
}

/* Animation for popup appearance */
.text-selection-popup {
    animation: popupSlideIn 0.2s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Question bar layout updates */
.question-input-container {
    position: relative;
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 48px;
}

.web-search-chip {
    position: absolute;
    left: 8px;
    bottom: 8px;
    top: auto;
    transform: none;
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 2px 10px 2px 7px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #466842;
    box-shadow: 0 1px 4px rgba(70, 104, 66, 0.06);
    border: 1px solid #e0e0e0;
    cursor: pointer;
    height: 28px;
    z-index: 2;
}

#textChatInput {
    min-height: 20px;
    max-height: 120px;
    overflow-y: hidden;
    padding-left: 8px !important;
    padding-bottom: 6px !important;
    resize: none;
    width: 100%;
    box-sizing: border-box;
    border-radius: 18px;
    background: #f8f9fa;
}

@media (max-width: 600px) {
    .web-search-chip { font-size: 0.85rem; padding: 1px 7px 1px 5px; height: 22px; left: 4px; bottom: 4px; }
    .question-send-btn, .question-mic-btn, .question-attach-btn { width: 32px; height: 32px; font-size: 1rem; bottom: 4px; }
    .question-send-btn { right: 6px; }
    .question-mic-btn { right: 44px; }
    .question-attach-btn { right: 78px; }
    #textChatInput { padding-left: 48px !important; padding-bottom: 48px !important; }
}

/* WhatsApp-style Reply Preview - Enhanced Modern Design */
.reply-preview {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 1px solid #e1e8ff;
    border-left: 4px solid var(--primary-green);
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(64, 171, 38, 0.08);
    position: relative;
    z-index: 1000;
    overflow: hidden;
    animation: replySlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

/* Add a subtle gradient overlay */
.reply-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--primary-green) 50%, transparent 100%);
    opacity: 0.3;
}

/* Debug: Add a visible border when debugging */
.reply-preview.debug {
    border: 2px solid red !important;
    background: yellow !important;
}

.reply-content {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 12px;
    position: relative;
}

/* Reply indicator icon */
.reply-content::before {
    content: '↩';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--primary-green);
    opacity: 0.7;
    font-weight: bold;
}

.reply-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
    line-height: 1.4;
    max-height: 200px;
    overflow-y: auto;
    display: block;
    font-style: normal;
    font-weight: 400;
    margin-left: 16px;
    padding: 4px 0;
    position: relative;
    word-wrap: break-word;
}

/* Remove the ellipsis overlay since we now allow scrolling */
.reply-text::after {
    display: none;
}

.reply-close-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(64, 171, 38, 0.2);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    backdrop-filter: blur(4px);
}

.reply-close-btn:hover {
    background-color: rgba(64, 171, 38, 0.1);
    color: var(--primary-green);
    border-color: var(--primary-green);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(64, 171, 38, 0.2);
}

.reply-close-btn:active {
    transform: scale(0.95);
}

.reply-close-btn .material-icons {
    font-size: 16px;
    font-weight: 500;
}

/* Enhanced animation for reply preview */
@keyframes replySlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
        max-height: 0;
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 300px;
        filter: blur(0);
    }
}

/* Exit animation for reply preview */
@keyframes replySlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 300px;
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
        max-height: 0;
        filter: blur(1px);
    }
}

/* Animation classes for JavaScript control */
.reply-preview.reply-visible {
    animation: replySlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.reply-preview.reply-hiding {
    animation: replySlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Hover effects for reply preview */
.reply-preview:hover {
    box-shadow: 0 4px 16px rgba(64, 171, 38, 0.12);
    transform: translateY(-1px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced reply text hover effect */
.reply-text:hover {
    /* Removed color change on hover */
}

/* Pulse animation for reply indicator */
.reply-content::before {
    animation: replyPulse 2s ease-in-out infinite;
}

@keyframes replyPulse {
    0%, 100% {
        opacity: 0.7;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.1);
    }
}

/* Update textarea to work with enhanced reply preview */
#textChatInput {
    border-radius: 0 0 12px 12px;
    border-top: 1px solid rgba(64, 171, 38, 0.1);
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#textChatInput:focus {
    border-radius: 18px !important;
    border-top: 1px solid rgba(64, 171, 38, 0.2);
    box-shadow: 0 2px 8px rgba(64, 171, 38, 0.1);
    background: #f8f9fa;
}

/* When no reply preview, restore normal border radius */
.question-input-container:not(:has(.reply-preview[style*="display: block"])) #textChatInput {
    border-radius: 18px;
    border-top: 1px solid rgba(64, 171, 38, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* When no reply preview and focused, maintain rounded corners */
.question-input-container:not(:has(.reply-preview[style*="display: block"])) #textChatInput:focus {
    border-radius: 18px !important;
    border-top: 1px solid rgba(64, 171, 38, 0.2);
    box-shadow: 0 2px 8px rgba(64, 171, 38, 0.1);
    background: #f8f9fa;
}

/* Mobile responsiveness for reply preview */
@media (max-width: 768px) {
    .reply-preview {
        border-radius: 8px 8px 0 0;
        margin: 0 8px 0 8px;
    }
    
    .reply-content {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .reply-text {
        font-size: 13px;
        margin-left: 12px;
        max-height: 150px;
    }
    
    .reply-close-btn {
        width: 24px;
        height: 24px;
        padding: 4px;
    }
    
    .reply-close-btn .material-icons {
        font-size: 14px;
    }
    
    #textChatInput {
        border-radius: 0 0 8px 8px;
        margin: 0 8px;
    }
    
    .question-input-container:not(:has(.reply-preview[style*="display: block"])) #textChatInput {
        border-radius: 8px;
        margin: 0 8px;
    }
}

@media (max-width: 480px) {
    .reply-preview {
        margin: 0 4px 0 4px;
    }
    
    .reply-content {
        padding: 8px 10px;
    }
    
    .reply-text {
        font-size: 12px;
        margin-left: 8px;
        max-height: 120px;
        overflow-y: auto;
        word-wrap: break-word;
    }
    
    .reply-close-btn {
        width: 20px;
        height: 20px;
        padding: 3px;
    }
    
    .reply-close-btn .material-icons {
        font-size: 12px;
    }
    
    #textChatInput {
        margin: 0 4px;
    }
    
    .question-input-container:not(:has(.reply-preview[style*="display: block"])) #textChatInput {
        margin: 0 4px;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .reply-preview {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
        border-left-color: var(--primary-green);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .reply-text {
        color: #d1d5db;
    }
    
    .reply-text::after {
        background: linear-gradient(90deg, transparent 0%, #1f2937 100%);
    }
    
    .reply-close-btn {
        background: rgba(55, 65, 81, 0.8);
        border-color: rgba(64, 171, 38, 0.3);
        color: #9ca3af;
    }
    
    .reply-close-btn:hover {
        background-color: rgba(64, 171, 38, 0.2);
        color: var(--primary-green);
    }
}

/* Accessibility improvements */
.reply-preview:focus-within {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

.reply-close-btn:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .reply-preview {
        border-width: 2px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .reply-text {
        color: #000;
    }
    
    .reply-close-btn {
        border-width: 2px;
        background: #fff;
        color: #000;
    }
}

/* Mobile responsive styles for expandable questions */
@media (max-width: 768px) {
    .qa-question {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        gap: 0.4rem;
    }
    
    .qa-question .material-icons {
        font-size: 1.1rem;
    }
    
    .qa-question-text {
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    .qa-question-expand-btn {
        padding: 0.15rem;
        margin-left: 0.3rem;
    }
    
    .qa-question-expand-btn .material-icons {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .qa-question {
        padding: 0.6rem;
        margin-bottom: 0.6rem;
        gap: 0.3rem;
    }
    
    .qa-question .material-icons {
        font-size: 1rem;
    }
    
    .qa-question-text {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .qa-question-expand-btn {
        padding: 0.1rem;
        margin-left: 0.2rem;
    }
    
    .qa-question-expand-btn .material-icons {
        font-size: 0.8rem;
    }
    
    .qa-question:not(.expanded) .qa-question-text {
        max-height: 3.9em; /* Approximately 3 lines on mobile */
    }
}

/* Mobile responsive styles for answer section */
@media (max-width: 768px) {
    .qa-answer {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        gap: 0.4rem;
        padding-right: 70px; /* Slightly less padding on mobile */
    }
    
    .qa-audio-container {
        top: 14px;
        right: 14px;
        gap: 4px;
    }
    
    .qa-play-btn, .qa-reply-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .qa-play-btn .material-icons, .qa-reply-btn .material-icons {
        font-size: 14px;
    }
    
    .qa-card-actions {
        margin-top: 8px;
        padding-top: 8px;
        gap: 6px;
    }
    
    .qa-card-action-icon {
        padding: 3px;
    }
    
    .qa-card-action-icon .material-icons {
        font-size: 16px;
    }
    
    .qa-pair-actions {
        margin-top: 6px;
        padding-top: 6px;
        gap: 4px;
    }
    
    .qa-pair-action-icon {
        padding: 2px;
    }
    
    .qa-pair-action-icon .material-icons {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .qa-answer {
        padding: 0.6rem;
        margin-bottom: 0.6rem;
        gap: 0.3rem;
        padding-right: 60px; /* Even less padding on small mobile */
    }
    
    .qa-audio-container {
        top: 12px;
        right: 12px;
        gap: 3px;
    }
    
    .qa-play-btn, .qa-reply-btn, .qa-like-btn, .qa-dislike-btn {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    
    .qa-play-btn .material-icons, .qa-reply-btn .material-icons, .qa-like-btn .material-icons, .qa-dislike-btn .material-icons {
        font-size: 10px;
    }
    
    .qa-card-actions {
        margin-top: 6px;
        padding-top: 6px;
        gap: 4px;
    }
    
    .qa-card-action-icon {
        padding: 2px;
    }
    
    .qa-card-action-icon .material-icons {
        font-size: 14px;
    }
    
    .qa-pair-actions {
        margin-top: 4px;
        padding-top: 4px;
        gap: 3px;
    }
    
    .qa-pair-action-icon {
        padding: 1px;
    }
    
    .qa-pair-action-icon .material-icons {
        font-size: 12px;
    }
}

.qa-copy-btn {
    background: #444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.3);
    padding: 4px;
    font-size: 1.05rem;
    margin-top: 4px;
}

.qa-copy-btn:hover {
    background: #222;
}

.qa-copy-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #888;
    box-shadow: none;
}

.qa-copy-btn .material-icons {
    color: white !important;
    font-family: 'Material Icons', 'MaterialIcons', sans-serif;
    font-size: 0.91rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: none;
    padding: 2px;
    box-sizing: border-box;
}

/* Card Action Icons */
.qa-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.qa-card-action-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-card-action-icon:hover {
    background-color: #f5f5f5;
    color: #333;
}

.qa-card-action-icon:active {
    transform: scale(0.95);
}

.qa-card-action-icon .material-icons {
    font-size: 18px;
    transition: color 0.2s ease;
}

.qa-copy-icon.copied {
    color: #40ab26;
}

.qa-copy-icon.copied .material-icons {
    color: #40ab26;
}

/* Q/A Pair Action Icons */
.qa-pair-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.qa-pair-action-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px;
    border-radius: 3px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-pair-action-icon:hover {
    background-color: #f5f5f5;
    color: #333;
}

.qa-pair-action-icon:active {
    transform: scale(0.95);
}

.qa-pair-action-icon .material-icons {
    font-size: 16px;
    transition: color 0.2s ease;
}

.qa-pair-copy-icon.copied {
    color: #40ab26;
}

.qa-pair-copy-icon.copied .material-icons {
    color: #40ab26;
}

@keyframes answerSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-24px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.qa-answer {
    animation: answerSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-mic-btn:active {
    transform: scale(0.95);
}

.question-mic-btn:focus {
    outline: none;
    transform: scale(1.05);
}

/* Thread Sidebar Styles */
.thread-sidebar {
    position: fixed;
    left: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-right: 1px solid #e8eaed;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    z-index: 10001;
    transition: left 0.3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}

.thread-sidebar.open {
    left: 0 !important;
    background: linear-gradient(135deg, #ffcccc 0%, #ffffff 100%) !important;
}

.thread-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #e8eaed;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
}

.thread-sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e8eaed 50%, transparent 100%);
}

.thread-sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.025em;
}

.thread-sidebar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.new-thread-btn {
    background: linear-gradient(135deg, #466842 0%, #5a7a52 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(70, 104, 66, 0.25);
    position: relative;
    overflow: hidden;
}

.new-thread-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.new-thread-btn:hover::before {
    left: 100%;
}

.new-thread-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(70, 104, 66, 0.35);
    background: linear-gradient(135deg, #5a7a52 0%, #6b8a5f 100%);
}

.new-thread-btn:active {
    transform: translateY(0) scale(0.98);
}

.new-thread-btn .material-icons {
    font-size: 18px;
    font-weight: 600;
}

.thread-sidebar-close-btn {
    background: #f8f9fa;
    color: #5f6368;
    border: 1px solid #e8eaed;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.thread-sidebar-close-btn:hover {
    background: #ffffff;
    color: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: #dadce0;
}

.thread-sidebar-close-btn:active {
    transform: translateY(0);
}

.thread-sidebar-close-btn .material-icons {
    font-size: 16px;
}

.thread-search {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid #e8eaed;
    background: #ffffff;
    position: relative;
}

.thread-search::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e8eaed 50%, transparent 100%);
}

.thread-search input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e8eaed;
    border-radius: 8px 0 0 8px;
    font-size: 13px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8f9fa;
    color: #1a1a1a;
}

.thread-search input:focus {
    border-color: #466842;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(70, 104, 66, 0.1);
}

.thread-search input::placeholder {
    color: #9aa0a6;
}

.search-btn {
    background: linear-gradient(135deg, #466842 0%, #5a7a52 100%);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(70, 104, 66, 0.2);
}

.search-btn:hover {
    background: linear-gradient(135deg, #5a7a52 0%, #6b8a5f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(70, 104, 66, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

.search-btn .material-icons {
    font-size: 16px;
}

.threads-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.threads-list::-webkit-scrollbar {
    width: 6px;
}

.threads-list::-webkit-scrollbar-track {
    background: transparent;
}

.threads-list::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

.threads-list::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

.thread-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.thread-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #466842, #5a7a52);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.thread-item:hover {
    background: #ffffff;
    border-color: #e8eaed;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.thread-item:hover::before {
    transform: scaleX(1);
}

.thread-item.active {
    background: linear-gradient(135deg, #f0f7f0 0%, #e8f5e8 100%);
    border-color: #466842;
    box-shadow: 0 8px 24px rgba(70, 104, 66, 0.15);
    transform: translateY(-2px);
}

.thread-item.active::before {
    transform: scaleX(1);
    background: linear-gradient(90deg, #466842, #5a7a52);
}

.thread-item-content {
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}

.thread-title {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.thread-item.active .thread-title {
    color: #2d5016;
}

.thread-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #5f6368;
    gap: 6px;
}

.thread-date {
    white-space: nowrap;
    font-weight: 500;
}

.thread-message-count {
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaed 100%);
    color: #5f6368;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid #e8eaed;
    white-space: nowrap;
}

.thread-item.active .thread-message-count {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    color: #2d5016;
    border-color: #c3e6cb;
}

.thread-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(8px);
}

.thread-item:hover .thread-actions {
    opacity: 1;
    transform: translateX(0);
}

.thread-action-btn {
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: #5f6368;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}

/* Thread update animation */
.thread-update-animation {
    animation: threadUpdatePulse 0.5s ease-in-out;
}

@keyframes threadUpdatePulse {
    0% {
        background: #ffffff;
        transform: scale(1);
    }
    50% {
        background: #e8f5e8;
        transform: scale(1.02);
        box-shadow: 0 8px 24px rgba(70, 104, 66, 0.2);
    }
    100% {
        background: #ffffff;
        transform: scale(1);
    }
}

.thread-action-btn:hover {
    background: #ffffff;
    color: #1a1a1a;
    border-color: #dadce0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thread-action-btn:active {
    transform: translateY(0);
}

.thread-action-btn .material-icons {
    font-size: 14px;
}

.thread-action-btn.edit:hover {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.thread-action-btn.delete:hover {
    background: #ffebee;
    color: #d32f2f;
    border-color: #ffcdd2;
}

.thread-sidebar-toggle {
    position: fixed;
    left: 16px;
    top: 16px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #466842 0%, #5a7a52 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10002;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(70, 104, 66, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thread-sidebar-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(70, 104, 66, 0.4);
    background: linear-gradient(135deg, #5a7a52 0%, #6b8a5f 100%);
}

.thread-sidebar-toggle:active {
    transform: translateY(0) scale(0.98);
}

.thread-sidebar-toggle .material-icons {
    font-size: 20px;
    font-weight: 600;
}

.thread-sidebar-toggle.active {
    background: linear-gradient(135deg, #5a7a52 0%, #6b8a5f 100%);
    box-shadow: 0 6px 20px rgba(70, 104, 66, 0.4);
}

/* Hide hamburger menu when sidebar is open to prevent overlap with "Conversations" text */
.thread-sidebar.open ~ .thread-sidebar-toggle,
.thread-sidebar.open + .thread-sidebar-toggle {
    display: none !important;
}

/* Hide search bar in side menu completely */
.thread-search {
    display: none !important;
}

/* Hide conversation button in answer, q/a, conversation section */
.conversation-button {
    display: none !important;
}

/* Hide conversation tab content completely */
.conversation-tab-content {
    display: none !important;
}

/* Hide conversation tab completely */
.chat-tab:last-child {
    display: none !important;
}

.main-ui {
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
    position: relative;
}

.thread-sidebar.open + .main-ui {
    margin-left: 350px;
}

/* Robust centering for welcome animation when sidebar is open - completely independent positioning */
.thread-sidebar.open + .main-ui .welcome-animation {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 100% !important;
    max-width: 1200px !important;
    z-index: 1000 !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 40px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
    /* Override any conflicting styles */
    min-height: auto !important;
    animation: none !important;
}

/* Ensure welcome content itself is centered */
.thread-sidebar.open + .main-ui .welcome-animation .welcome-content {
    width: 100% !important;
    max-width: 1200px !important;
    text-align: center !important;
    pointer-events: auto !important;
    /* Override any conflicting styles */
    animation: none !important;
}

/* Override any conflicting welcome-title styles */
.thread-sidebar.open + .main-ui .welcome-animation .welcome-title {
    text-align: center !important;
    margin: 0 auto 16px auto !important;
    animation: none !important;
}

/* Additional override to ensure centering works - using higher specificity */
body .thread-sidebar.open + .main-ui .welcome-animation {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 100% !important;
    max-width: 1200px !important;
    z-index: 1000 !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 40px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
    min-height: auto !important;
    animation: none !important;
}

.threads-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #5f6368;
}

.threads-empty .material-icons {
    font-size: 64px;
    color: #dadce0;
    margin-bottom: 16px;
}

.threads-empty h4 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.threads-empty p {
    font-size: 14px;
    color: #5f6368;
    margin: 0;
    line-height: 1.5;
}

.threads-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #5f6368;
}

.threads-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e8eaed;
    border-top: 3px solid #466842;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.threads-loading span {
    font-size: 14px;
    color: #5f6368;
    font-weight: 500;
}

/* Animation for thread items */
@keyframes threadItemSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thread-item {
    animation: threadItemSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive design */
@media (max-width: 768px) {
    .thread-sidebar {
        width: 100%;
        left: -100%;
    }
    
    .thread-sidebar.open {
        left: 0 !important;
    }
    
    .thread-sidebar.open + .main-ui {
        margin-left: 0;
    }
    
    /* Reset welcome animation positioning on mobile since main-ui doesn't shift */
    .thread-sidebar.open + .main-ui .welcome-animation {
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: auto !important;
        max-width: none !important;
        z-index: auto !important;
        background: auto !important;
        margin: auto !important;
        padding: 40px 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: auto !important;
        min-height: 400px !important;
        animation: fadeInUp 1s ease-out !important;
    }
    
    /* Reset welcome content styles on mobile */
    .thread-sidebar.open + .main-ui .welcome-animation .welcome-content {
        width: auto !important;
        max-width: 600px !important;
        text-align: center !important;
        pointer-events: auto !important;
        animation: slideInUp 1.2s ease-out 0.3s both !important;
    }
    
    /* Reset welcome title styles on mobile */
    .thread-sidebar.open + .main-ui .welcome-animation .welcome-title {
        text-align: center !important;
        margin: 0 0 16px 0 !important;
        animation: fadeInUp 1s ease-out 0.5s both !important;
    }
    
    /* Additional mobile override with higher specificity */
    body .thread-sidebar.open + .main-ui .welcome-animation {
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: auto !important;
        max-width: none !important;
        z-index: auto !important;
        background: auto !important;
        margin: auto !important;
        padding: 40px 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: auto !important;
        min-height: 400px !important;
        animation: fadeInUp 1s ease-out !important;
    }
    
    .thread-sidebar-toggle {
        left: 16px;
        top: 16px;
        width: 44px;
        height: 44px;
    }
    
    .thread-sidebar-toggle .material-icons {
        font-size: 22px;
    }
    
    .thread-sidebar-header {
        padding: 20px 16px 16px;
    }
    
    .thread-sidebar-header h3 {
        font-size: 1.2rem;
    }
    
    .thread-search {
        padding: 16px;
    }
    
    .threads-list {
        padding: 12px;
    }
    
    .thread-item {
        padding: 14px;
        margin-bottom: 10px;
        border-radius: 12px;
    }
    
    .thread-title {
        font-size: 14px;
    }
    
    .thread-meta {
        font-size: 11px;
    }
    
    .thread-message-count {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .thread-actions {
        gap: 3px;
    }
    
    .thread-action-btn {
        padding: 6px;
        min-width: 28px;
        height: 28px;
    }
    
    .thread-action-btn .material-icons {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .thread-sidebar-header {
        padding: 16px 12px 12px;
    }
    
    .thread-sidebar-header h3 {
        font-size: 1.1rem;
    }
    
    .thread-sidebar-actions {
        gap: 8px;
    }
    
    .new-thread-btn,
    .thread-sidebar-close-btn {
        width: 40px;
        height: 40px;
    }
    
    .new-thread-btn .material-icons,
    .thread-sidebar-close-btn .material-icons {
        font-size: 18px;
    }
    
    .thread-search {
        padding: 12px;
    }
    
    .thread-search input {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .search-btn {
        padding: 10px 14px;
    }
    
    .search-btn .material-icons {
        font-size: 16px;
    }
    
    .threads-list {
        padding: 8px;
    }
    
    .thread-item {
        padding: 12px;
        margin-bottom: 8px;
        border-radius: 10px;
    }
    
    .thread-title {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .thread-meta {
        font-size: 10px;
        gap: 6px;
    }
    
    .thread-message-count {
        padding: 2px 5px;
        font-size: 9px;
    }
    
    .thread-actions {
        gap: 2px;
    }
    
    .thread-action-btn {
        padding: 5px;
        min-width: 26px;
        height: 26px;
    }
    
    .thread-action-btn .material-icons {
        font-size: 13px;
    }
}

/* Thread Documents Area Styles - Updated for Unified Design */
.thread-documents-area {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin: 12px 0;
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.thread-documents-area:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.thread-documents-list {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.thread-document-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: var(--primary-green-light);
    border: 1.5px solid var(--primary-green);
    border-radius: 999px;
    transition: all 0.2s;
    box-shadow: none;
    min-height: 28px;
    height: auto;
    font-size: 0.97em;
    color: var(--primary-green-dark);
    margin: 4px 6px 4px 0;
    position: relative;
}

.thread-document-item.completed {
    background: var(--primary-green-gradient);
    color: #fff;
    border-color: var(--primary-green);
    box-shadow: 0 2px 8px rgba(64,171,38,0.10);
}

.thread-document-item.completed:hover {
    background: linear-gradient(90deg, #5fd34a 0%, #40ab26 100%);
    color: #fff;
    border-color: #2e7d1b;
    box-shadow: 0 4px 16px rgba(64,171,38,0.18);
}

.thread-document-item .thread-document-icon {
    background: transparent;
    color: var(--primary-green);
    box-shadow: none;
    width: 20px;
    height: 20px;
    margin-right: 4px;
}

.thread-document-item.completed .thread-document-icon {
    color: #fff;
}

.thread-document-item .thread-document-name {
    color: inherit;
    font-weight: 500;
    font-size: 0.97em;
    padding: 0 4px;
    max-width: 180px;
}

.thread-document-item .thread-document-delete {
    color: #fff;
    background: var(--primary-green);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    transition: background 0.2s, color 0.2s;
}

.thread-document-item .thread-document-delete:hover {
    background: #dc3545;
    color: #fff;
}

@keyframes documentItemSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thread-document-item:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    border-color: var(--primary-green);
}

.thread-document-item.processing {
    background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%);
    border-color: #ffeaa7;
    color: #856404;
    animation: processingPulse 2s ease-in-out infinite;
}

@keyframes processingPulse {
    0%, 100% { 
        box-shadow: 0 1px 3px rgba(255, 193, 7, 0.2);
    }
    50% { 
        box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
    }
}

.thread-document-item.completed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #c3e6cb;
    color: #155724;
}

.thread-document-item.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #f5c6cb;
    color: #721c24;
}

.thread-document-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 6px;
    background: rgba(64, 171, 38, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: var(--primary-green);
}

.thread-document-icon .material-icons {
    font-size: 14px;
    color: inherit;
}

.thread-document-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    min-width: 0;
    max-width: 300px;
    color: #2c3e50;
}

.thread-document-progress-text {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-green);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px;
}

.thread-document-progress-text.error {
    color: #dc3545;
    background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
    border-color: #fecaca;
}

.thread-document-progress-text.completed {
    color: #28a745;
    background: linear-gradient(135deg, #f0fff4 0%, #f0fff4 100%);
    border-color: #c3e6cb;
}

.thread-document-delete {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    z-index: 2;
}

.thread-document-delete:hover {
    background-color: #f8d7da;
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.15);
    color: #fff;
    transform: scale(1.05);
}

.thread-document-delete .material-icons {
    font-size: 14px;
}

.thread-document-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-green) 0%, #4CAF50 100%);
    transition: width 0.3s ease;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 1px 3px rgba(64, 171, 38, 0.3);
    overflow: hidden;
}

.thread-document-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: progressShimmer 1.5s ease-in-out infinite;
}

.thread-document-progress.error {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.3);
}

/* Progress percentage indicator */
.thread-document-progress-text {
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-green);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 1;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
    white-space: nowrap;
}

.thread-document-progress-text.error {
    color: #dc3545;
    background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
    border-color: #fecaca;
}

.thread-document-progress-text.completed {
    color: #28a745;
    background: linear-gradient(135deg, #f0fff4 0%, #f0fff4 100%);
    border-color: #c3e6cb;
}

/* Global Upload Progress Indicator */
.global-upload-progress {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 16px;
    margin: 12px 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeInDown 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.global-upload-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-green) 0%, #4CAF50 50%, var(--primary-green) 100%);
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.progress-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-green) 0%, #4CAF50 100%);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(64, 171, 38, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.progress-icon .material-icons {
    color: white;
    font-size: 1.2rem;
}

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-filename {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 600;
    text-align: left;
    word-break: break-word;
    line-height: 1.3;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-status {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    text-align: left;
}

.circular-progress-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circular-progress-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circular-progress-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 8;
    stroke-linecap: round;
}

.circular-progress-fill {
    fill: none;
    stroke: var(--primary-green);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(64, 171, 38, 0.3));
}

.circular-progress-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 8px;
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-green-dark);
    line-height: 1;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.progress-details {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.progress-actions {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.progress-cancel-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-cancel-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.progress-cancel-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-cancel-btn .material-icons {
    font-size: 1rem;
}

/* Progress states */
.global-upload-progress.processing .circular-progress-fill {
    stroke: var(--primary-green);
}

.global-upload-progress.warning .circular-progress-fill {
    stroke: #ffc107;
}

.global-upload-progress.error .circular-progress-fill {
    stroke: #dc3545;
}

.global-upload-progress.completed .circular-progress-fill {
    stroke: #28a745;
}

/* Responsive design */
@media (max-width: 768px) {
    .global-upload-progress {
        margin: 8px 12px;
        padding: 16px;
        gap: 12px;
    }
    
    .progress-header {
        gap: 10px;
    }
    
    .progress-icon {
        width: 36px;
        height: 36px;
    }
    
    .progress-icon .material-icons {
        font-size: 1.1rem;
    }
    
    .progress-filename {
        font-size: 0.9rem;
    }
    
    .progress-status {
        font-size: 0.8rem;
    }
    
    .circular-progress {
        width: 100px;
        height: 100px;
    }
    
    .progress-percentage {
        font-size: 1.3rem;
    }
    
    .progress-details {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .global-upload-progress {
        margin: 6px 8px;
        padding: 12px;
        gap: 10px;
    }
    
    .progress-header {
        gap: 8px;
    }
    
    .progress-icon {
        width: 32px;
        height: 32px;
    }
    
    .progress-icon .material-icons {
        font-size: 1rem;
    }
    
    .progress-filename {
        font-size: 0.85rem;
    }
    
    .progress-status {
        font-size: 0.75rem;
    }
    
    .circular-progress {
        width: 80px;
        height: 80px;
    }
    
    .circular-progress-bg,
    .circular-progress-fill {
        stroke-width: 6;
    }
    
    .progress-percentage {
        font-size: 1.1rem;
    }
    
    .progress-details {
        font-size: 0.65rem;
    }
    
    .progress-cancel-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .progress-cancel-btn .material-icons {
        font-size: 0.9rem;
    }
}

/* Document cards in response list */
.document-card {
    background: #f8f9fa;
    border-left: 4px solid var(--primary-green);
    margin: 8px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.document-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.document-card .qa-question {
    background: #e8f5e8;
    color: var(--primary-green-dark);
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-card .qa-question .material-icons {
    color: var(--primary-green);
    font-size: 1.2rem;
}

.document-card .qa-answer {
    background: #f8f9fa;
    color: #666;
    padding: 12px 16px;
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-style: italic;
}

.document-card .qa-answer .material-icons {
    color: var(--primary-green);
    font-size: 1.1rem;
}

.document-card .qa-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 12px 16px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.document-card .qa-action-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.2s ease;
}

.document-card .qa-action-btn:hover {
    background: var(--primary-green-light);
    border-color: var(--primary-green);
    color: var(--primary-green-dark);
}

.document-card .qa-action-btn .material-icons {
    font-size: 1rem;
}

/* Responsive design for document cards */
@media (max-width: 768px) {
    .document-card .qa-question,
    .document-card .qa-answer {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .document-card .qa-actions {
        padding: 6px 12px 10px 12px;
        gap: 6px;
    }
    
    .document-card .qa-action-btn {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .document-card .qa-question,
    .document-card .qa-answer {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .document-card .qa-actions {
        padding: 5px 10px 8px 10px;
        gap: 4px;
    }
    
    .document-card .qa-action-btn {
        padding: 4px 6px;
        font-size: 0.75rem;
    }
    
    .document-card .qa-action-btn .material-icons {
        font-size: 0.9rem;
    }
}

/* Global upload progress indicator */

/* Compact Document Card Styles - Updated for Unified Design */
.document-card.compact {
    padding: 12px 16px;
    margin: 8px 0 12px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    /* Ensure proper spacing from AI response cards */
    margin-left: 16px;
    margin-right: 16px;
    max-width: calc(100% - 32px);
    animation: documentCardSlideIn 0.3s ease-out;
}

.document-card.compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-green) 0%, #7be86a 100%);
    opacity: 0.8;
}

.document-card.compact:hover {
    background: linear-gradient(135deg, #f1f3f4 0%, #f8f9fa 100%);
    border-color: var(--primary-green);
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.15);
    transform: translateY(-2px);
}

.document-card-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.document-icon {
    color: var(--primary-green);
    font-size: 18px;
    flex-shrink: 0;
    background: rgba(64, 171, 38, 0.1);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.document-name {
    flex: 1;
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    line-height: 1.3;
}

.document-download-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #2c3e50;
    transition: all 0.2s ease;
    font-weight: 500;
    flex-shrink: 0;
}

.document-download-btn:hover {
    background: linear-gradient(135deg, var(--primary-green-light) 0%, #e8f5e8 100%);
    border-color: var(--primary-green);
    color: var(--primary-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(64, 171, 38, 0.15);
}

.document-download-btn:hover .material-icons {
    color: var(--primary-green);
}

.document-download-btn .material-icons {
    font-size: 1rem;
    color: #666;
    transition: color 0.2s ease;
}

/* Ensure document cards don't interfere with QA card spacing */
.qa-card:not(.document-card) + .document-card.compact {
    margin-top: 8px;
}

/* Mobile responsive for compact document cards */
@media (max-width: 768px) {
    .document-card.compact {
        padding: 6px 10px;
        margin: 3px 0 6px 0;
        margin-left: 12px;
        margin-right: 12px;
        max-width: calc(100% - 24px);
    }
    
    .document-card-content {
        gap: 6px;
    }
    
    .document-name {
        font-size: 12px;
        max-width: 200px;
    }
    
    .document-download-btn {
        padding: 3px 5px;
        min-width: 24px;
        height: 24px;
    }
    
    .document-download-btn .material-icons {
        font-size: 12px;
    }
    
    .document-icon {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .document-card.compact {
        padding: 5px 8px;
        margin: 2px 0 5px 0;
        margin-left: 8px;
        margin-right: 8px;
        max-width: calc(100% - 16px);
    }
    
    .document-card-content {
        gap: 5px;
    }
    
    .document-name {
        font-size: 11px;
        max-width: 150px;
    }
    
    .document-download-btn {
        padding: 2px 4px;
        min-width: 22px;
        height: 22px;
    }
    
    .document-download-btn .material-icons {
        font-size: 11px;
    }
    
    .document-icon {
        font-size: 1.2rem;
    }
}

/* Thread Documents Loading Overlay */
.thread-documents-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

.loading-spinner {
    margin-bottom: 12px;
}

.loading-spinner .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--primary-green);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

@media (max-width: 768px) {
    .thread-documents-loading-overlay {
        border-radius: 8px;
    }
    
    .loading-spinner .spinner {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }
    
    .loading-text {
        font-size: 0.8rem;
    }
}

.thread-document-progress-text {
    font-size: 0.75rem;
    color: var(--primary-green);
    font-weight: 500;
    margin-top: 2px;
    text-align: center;
    transition: all 0.3s ease;
}

.thread-document-progress-text.error {
    color: #dc3545;
}

/* Progress bar for document chips */
.thread-document-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary-green);
    border-radius: 0 0 8px 8px;
    transition: width 0.3s ease;
    z-index: 1;
}

.thread-document-progress.error {
    background: #dc3545;
}

/* Success animation for completed uploads */
@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 25px rgba(40, 167, 69, 0.2);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
}

.global-upload-progress.completed {
    animation: successPulse 0.6s ease-in-out;
}

/* Enhanced progress states with better visual feedback */
.global-upload-progress.processing .progress-icon {
    animation: pulse 2s ease-in-out infinite;
}

.global-upload-progress.warning .progress-icon {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

.global-upload-progress.error .progress-icon {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    animation: pulse 1s ease-in-out infinite;
}

.global-upload-progress.completed .progress-icon {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: none;
}

/* Progress status text animations */
.progress-status {
    transition: color 0.3s ease;
}

.global-upload-progress.processing .progress-status {
    color: var(--primary-green);
}

.global-upload-progress.warning .progress-status {
    color: #856404;
}

.global-upload-progress.error .progress-status {
    color: #721c24;
}

.global-upload-progress.completed .progress-status {
    color: #155724;
    font-weight: 600;
}

/* Enhanced cancel button states */
.progress-cancel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.progress-cancel-btn:disabled:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Loading dots animation for status text */
@keyframes loadingDots {
    0%, 20% {
        color: #6c757d;
        text-shadow: 0.25em 0 0 #6c757d, 0.5em 0 0 #6c757d;
    }
    40% {
        color: #6c757d;
        text-shadow: 0.25em 0 0 #6c757d, 0.5em 0 0 transparent;
    }
    60% {
        text-shadow: 0.25em 0 0 transparent, 0.5em 0 0 transparent;
    }
    80%, 100% {
        text-shadow: 0.25em 0 0 transparent, 0.5em 0 0 transparent;
    }
}

.progress-status.loading::after {
    content: '...';
    animation: loadingDots 1.4s infinite;
    display: inline-block;
    width: 20px;
    text-align: left;
}

/* Responsive design for thread documents */
@media (max-width: 768px) {
    .thread-document-item {
        padding: 5px 10px;
        padding-right: 14px;
        gap: 8px;
        min-height: 28px;
        margin-bottom: 3px;
    }
    
    .thread-document-name {
        font-size: 0.7rem;
        max-width: 150px;
    }
    
    .thread-document-progress-text {
        font-size: 0.6rem;
        padding: 2px 5px;
        min-width: 45px;
        height: 16px;
        margin: 0 5px;
    }
    
    .thread-document-delete {
        width: 16px;
        height: 16px;
        padding: 2px;
    }
    
    .thread-document-delete .material-icons {
        font-size: 10px;
    }
    
    .thread-document-icon {
        width: 12px;
        height: 12px;
    }
    
    .thread-document-icon .material-icons {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .thread-document-item {
        padding: 4px 8px;
        padding-right: 12px;
        gap: 6px;
        min-height: 26px;
        margin-bottom: 2px;
    }
    
    .thread-document-name {
        font-size: 0.65rem;
        max-width: 120px;
    }
    
    .thread-document-progress-text {
        font-size: 0.55rem;
        padding: 1px 4px;
        min-width: 40px;
        height: 14px;
        margin: 0 4px;
    }
    
    .thread-document-delete {
        width: 14px;
        height: 14px;
        padding: 1px;
    }
    
    .thread-document-delete .material-icons {
        font-size: 9px;
    }
    
    .thread-document-icon {
        width: 10px;
        height: 10px;
    }
    
    .thread-document-icon .material-icons {
        font-size: 8px;
    }
}

/* Uploaded Documents Card Styles - Compact Multi-Row Layout */
.uploaded-documents-card {
    background: linear-gradient(135deg, #eafbe3 0%, #f6f6fa 100%);
    border-radius: 12px;
    margin: 12px 0 8px 0;
    box-shadow: 0 2px 8px rgba(64,171,38,0.08), 0 1px 4px rgba(123,232,106,0.06);
    display: flex;
    align-items: stretch;
    padding: 0;
    width: fit-content;
    max-width: 600px;
    min-width: 300px;
    position: relative;
    border: 1px solid var(--primary-green);
    transition: box-shadow 0.2s, border 0.2s;
}
.uploaded-documents-card:hover {
    box-shadow: 0 4px 16px rgba(64,171,38,0.12);
    border: 1.5px solid var(--primary-green-dark);
}

.uploaded-documents-icon {
    background: var(--primary-green);
    color: #fff;
    border-radius: 12px 0 0 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    font-size: 20px;
    margin-right: 0;
    box-shadow: 0 1px 4px rgba(64,171,38,0.08);
    min-width: 48px;
    justify-content: center;
}

.uploaded-documents-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
    padding: 8px 12px;
    gap: 6px;
    align-items: flex-start;
    justify-content: flex-start;
}

.uploaded-document-item {
    display: flex;
    align-items: center;
    background: #fff !important;
    border-radius: 6px;
    padding: 6px 8px;
    box-shadow: 0 1px 3px rgba(64,171,38,0.06);
    transition: all 0.2s ease;
    overflow: hidden;
    max-width: 180px;
    min-width: 100px;
    width: fit-content;
    position: relative;
    border: 1px solid #e8f5e8;
    flex-shrink: 0;
}
.document-name {
    flex: 1 1 auto;
    background: transparent;
    font-size: 0.85rem;
    color: var(--primary-green-dark);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    transition: color 0.2s;
    padding: 0;
    height: auto;
    display: block;
    line-height: 1.2;
}
.document-type-label {
    background: #eafbe3;
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.7rem;
    color: #7be86a;
    font-weight: 500;
    margin-left: 4px;
    height: auto;
    display: inline-block;
    line-height: 1.2;
}
.uploaded-documents-delete {
    margin-left: 4px;
    position: static;
    transform: none;
    background: none;
    border: none;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    z-index: 2;
    border-radius: 50%;
    padding: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uploaded-document-item:hover {
    box-shadow: 0 2px 6px rgba(64,171,38,0.12);
    transform: translateY(-1px);
    border-color: var(--primary-green);
}

.uploaded-document-item:hover .document-name {
    color: var(--primary-green);
}

.uploaded-document-item:hover .uploaded-documents-delete {
    opacity: 1;
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.uploaded-documents-delete:hover {
    opacity: 1;
    color: #fff;
    background: #ff4757;
}

.uploaded-documents-list:empty::before {
    content: "No documents uploaded yet!";
    color: #b0b0b0;
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
    width: 100%;
    display: block;
    padding: 16px 0;
}

/* Responsive styles for uploaded documents */
@media (max-width: 768px) {
    .uploaded-documents-card {
        margin: 8px 0 6px 0;
        border-radius: 10px;
        max-width: 500px;
        min-width: 250px;
    }
    
    .uploaded-documents-icon {
        padding: 10px 12px;
        font-size: 18px;
        min-width: 44px;
    }
    
    .uploaded-documents-list {
        padding: 6px 10px;
        gap: 5px;
    }
    
    .uploaded-document-item {
        padding: 5px 6px;
        max-width: 140px;
        min-width: 80px;
        border-radius: 5px;
    }
    
    .document-name {
        font-size: 0.8rem;
        max-width: 80px;
    }
    
    .document-type-label {
        font-size: 0.65rem;
        padding: 1px 3px;
        margin-left: 3px;
    }
    
    .uploaded-documents-delete {
        font-size: 12px;
        width: 14px;
        height: 14px;
        padding: 1px;
        margin-left: 3px;
    }
}

@media (max-width: 480px) {
    .uploaded-documents-card {
        margin: 6px 0 4px 0;
        border-radius: 8px;
        max-width: 400px;
        min-width: 200px;
    }
    
    .uploaded-documents-icon {
        padding: 8px 10px;
        font-size: 16px;
        min-width: 40px;
    }
    
    .uploaded-documents-list {
        padding: 5px 8px;
        gap: 4px;
    }
    
    .uploaded-document-item {
        padding: 4px 5px;
        max-width: 120px;
        min-width: 70px;
        border-radius: 4px;
    }
    
    .document-name {
        font-size: 0.75rem;
        max-width: 60px;
    }
    
    .document-type-label {
        font-size: 0.6rem;
        padding: 1px 2px;
        margin-left: 2px;
    }
    
    .uploaded-documents-delete {
        font-size: 11px;
        width: 12px;
        height: 12px;
        padding: 1px;
        margin-left: 2px;
    }
}

.chat-tabs-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px 0;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  padding: 0 0 0 8px;
}
.chat-tab {
  background: none;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: #6c757d;
  padding: 7px 18px 7px 18px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.chat-tab.active {
  color: #222;
  background: #fff;
  border-bottom: 2px solid #007bff;
  font-weight: 600;
  z-index: 2;
}
.chat-tab:not(.active):hover {
  background: #f1f3f5;
  color: #343a40;
}
.chat-tab-content {
  display: block;
  padding: 0 0 0 0;
  min-height: 120px;
}
#documents-cards-container {
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

#documents-cards-container:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Document Card Styles - Updated for Unified Design */
.document-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
  animation: documentCardSlideIn 0.3s ease-out;
}

.document-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
  border-color: var(--primary-green);
}

.document-card .qa-question {
  background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
  color: var(--primary-green-dark);
  font-weight: 600;
  padding: 16px 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e1e5e9;
}

.document-card .qa-question .material-icons {
  color: var(--primary-green);
  font-size: 1.3rem;
}

.document-card .qa-answer {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  color: #2c3e50;
  padding: 16px 20px;
  border-radius: 0 0 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.4;
}

.document-card .qa-answer .material-icons {
  color: var(--primary-green);
  font-size: 1.2rem;
}

.document-card .qa-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px 16px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 0 0 12px 12px;
  border-top: 1px solid #e1e5e9;
}

.document-card .qa-action-btn {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #2c3e50;
  transition: all 0.2s ease;
  font-weight: 500;
}

.document-card .qa-action-btn:hover {
  background: linear-gradient(135deg, var(--primary-green-light) 0%, #e8f5e8 100%);
  border-color: var(--primary-green);
  color: var(--primary-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(64, 171, 38, 0.15);
}

.document-card .qa-action-btn .material-icons {
  font-size: 1.1rem;
}

@keyframes documentCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design for document cards - Updated for Unified Design */
@media (max-width: 768px) {
    .document-card .qa-question,
    .document-card .qa-answer {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .document-card .qa-actions {
        padding: 10px 16px 14px 16px;
        gap: 8px;
    }
    
    .document-card .qa-action-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    /* Thread document items responsive */
    .thread-document-item {
        padding: 10px 14px;
        min-height: 44px;
    }
    
    .thread-document-name {
        font-size: 0.8rem;
        max-width: 250px;
    }
    
    .thread-document-progress-text {
        font-size: 0.7rem;
        padding: 3px 6px;
        min-width: 50px;
        height: 20px;
    }
    
    .thread-document-delete {
        width: 20px;
        height: 20px;
    }
    
    .thread-document-delete .material-icons {
        font-size: 12px;
    }
    
    .thread-document-icon {
        width: 18px;
        height: 18px;
    }
    
    .thread-document-icon .material-icons {
        font-size: 12px;
    }
    
    /* Compact document cards responsive */
    .document-card.compact {
        padding: 10px 14px;
        margin: 6px 0 10px 0;
    }
    
    .document-card-content {
        gap: 10px;
    }
    
    .document-name {
        font-size: 0.85rem;
        max-width: 250px;
    }
    
    .document-download-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .document-download-btn .material-icons {
        font-size: 0.9rem;
    }
    
    .document-icon {
        font-size: 16px;
        padding: 5px;
    }
}

@media (max-width: 480px) {
    .document-card .qa-question,
    .document-card .qa-answer {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .document-card .qa-actions {
        padding: 8px 12px 12px 12px;
        gap: 6px;
    }
    
    .document-card .qa-action-btn {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    
    .document-card .qa-action-btn .material-icons {
        font-size: 1rem;
    }
    
    /* Thread document items responsive */
    .thread-document-item {
        padding: 8px 12px;
        min-height: 40px;
        gap: 8px;
    }
    
    .thread-document-name {
        font-size: 0.75rem;
        max-width: 200px;
    }
    
    .thread-document-progress-text {
        font-size: 0.65rem;
        padding: 2px 5px;
        min-width: 45px;
        height: 18px;
        margin: 0 6px;
    }
    
    .thread-document-delete {
        width: 18px;
        height: 18px;
        padding: 3px;
    }
    
    .thread-document-delete .material-icons {
        font-size: 11px;
    }
    
    .thread-document-icon {
        width: 16px;
        height: 16px;
    }
    
    .thread-document-icon .material-icons {
        font-size: 11px;
    }
    
    /* Compact document cards responsive */
    .document-card.compact {
        padding: 8px 12px;
        margin: 4px 0 8px 0;
    }
    
    .document-card-content {
        gap: 8px;
    }
    
    .document-name {
        font-size: 0.8rem;
        max-width: 200px;
    }
    
    .document-download-btn {
        padding: 4px 6px;
        font-size: 0.7rem;
    }
    
    .document-download-btn .material-icons {
        font-size: 0.85rem;
    }
    
    .document-icon {
        font-size: 14px;
        padding: 4px;
    }
}

/* Suggested Questions Child Card */
.suggested-questions-child-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    animation: suggestedQuestionsChildSlideIn 0.3s ease-out;
    clear: both;
    display: block;
    width: 100%;
    position: relative;
    z-index: 1;
}

.suggested-questions-child-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.suggested-questions-child-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

.suggested-questions-child-header .material-icons {
    color: var(--primary-green);
    font-size: 16px;
}

.suggested-questions-child-title {
    font-weight: 600;
    color: #495057;
    font-size: 12px;
    flex: 1;
}

.suggested-questions-child-mode {
    background: var(--primary-green);
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.suggested-questions-child-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    color: #6c757d;
    font-size: 12px;
}

.suggested-questions-child-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.suggested-questions-child-spinner .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #e9ecef;
    border-top: 2px solid var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.suggested-questions-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: opacity 0.3s ease;
}

.suggested-question-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #354831;
    color: white;
    border: 1px solid #333;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 6px;
    width: fit-content;
    min-width: 200px;
    flex-wrap: wrap;
}

.suggested-question-chip:hover {
    background: #333333;
    border-color: var(--primary-green);
    transform: translateX(4px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.suggested-question-chip.clicked {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

.suggested-question-chip.clicked .suggested-question-chip-text {
    color: white;
}

.suggested-question-chip.clicked .suggested-question-chip-icon {
    color: white;
}

.suggested-question-chip-text {
    flex: 1;
    font-size: 14px;
    color: white;
    line-height: 1.3;
    transition: color 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.suggested-question-chip-icon {
    color: #ffffff;
    font-size: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.suggested-question-chip:hover .suggested-question-chip-icon {
    transform: translateX(2px);
}

.suggested-questions-child-empty {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    font-style: italic;
    padding: 12px 0;
}

@keyframes suggestedQuestionsSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes suggestedQuestionsChildSlideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design for suggested questions child cards */
@media (max-width: 768px) {
    .suggested-questions-child-card {
        padding: 10px;
        margin-top: 10px;
    }
    
    .suggested-questions-child-header {
        margin-bottom: 8px;
        padding-bottom: 4px;
    }
    
    .suggested-questions-child-title {
        font-size: 11px;
    }
    
    .suggested-questions-child-mode {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    .suggested-question-chip {
        padding: 5px 8px;
        gap: 4px;
        min-width: 150px;
        width: fit-content;
    }
    
    .suggested-question-chip-text {
        font-size: 10px;
    }
    
    .suggested-question-chip-icon {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .suggested-questions-child-card {
        padding: 8px;
        margin-top: 8px;
    }
    
    .suggested-questions-child-header {
        margin-bottom: 6px;
        padding-bottom: 3px;
    }
    
    .suggested-questions-child-title {
        font-size: 10px;
    }
    
    .suggested-questions-child-mode {
        font-size: 7px;
        padding: 1px 3px;
    }
    
    .suggested-question-chip {
        padding: 4px 6px;
        gap: 3px;
        min-width: 120px;
        width: fit-content;
    }
    
    .suggested-question-chip-text {
        font-size: 9px;
    }
    
    .suggested-question-chip-icon {
        font-size: 9px;
    }
}

/* User Profile Dropdown Styles - Compact & Trendy */
.user-profile-dropdown {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #466842 0%, #5a7a52 100%);
    color: white;
    padding: 6px 10px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(70, 104, 66, 0.3);
    border: none;
    backdrop-filter: blur(10px);
}

.user-profile-trigger:hover {
    background: linear-gradient(135deg, #3d5a38 0%, #4e6a47 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(70, 104, 66, 0.4);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.2);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(135deg, #f8fff8 0%, #f0f8f0 100%);
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
}

.dropdown-user-info .material-icons {
    font-size: 18px;
    color: #466842;
    background: rgba(70, 104, 66, 0.1);
    padding: 6px;
    border-radius: 8px;
}

.dropdown-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.dropdown-email {
    font-weight: 600;
    font-size: 13px;
    color: #2d3748;
    line-height: 1.2;
}

.dropdown-role {
    font-weight: 500;
    font-size: 11px;
    color: #718096;
    text-transform: capitalize;
    background: rgba(70, 104, 66, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
}

.dropdown-section {
    padding: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(70, 104, 66, 0.1) 0%, transparent 100%);
    transition: width 0.3s ease;
}

.dropdown-item:hover {
    background: rgba(70, 104, 66, 0.05);
    color: #466842;
    transform: translateX(4px);
}

.dropdown-item:hover::before {
    width: 100%;
}

.dropdown-item .material-icons {
    font-size: 16px;
    color: #718096;
    transition: all 0.2s ease;
    z-index: 1;
}

.dropdown-item:hover .material-icons {
    color: #466842;
    transform: scale(1.1);
}

.dropdown-item.version-info {
    cursor: default;
    opacity: 0.6;
    font-size: 11px;
    padding: 8px 16px;
    font-weight: 400;
}

.dropdown-item.version-info:hover {
    background: none;
    transform: none;
}

.dropdown-item.version-info .material-icons {
    font-size: 12px;
    color: #a0aec0;
    transition: color 0.3s ease;
}

.dropdown-item.version-info:hover .material-icons {
    color: #a0aec0;
    transform: none;
}

/* Connection status indicator styles */
.dropdown-item.version-info .material-icons[title="Connected"] {
    color: #4caf50 !important;
}

.dropdown-item.version-info .material-icons[title="Disconnected"] {
    color: #f44336 !important;
}

.dropdown-item.version-info .material-icons[title="Connecting..."] {
    color: #ff9800 !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(70, 104, 66, 0.1) 50%, transparent 100%);
    margin: 2px 0;
}

/* Change Password Modal Styles */
.change-password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.change-password-modal.show {
    opacity: 1;
    visibility: visible;
}

.change-password-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.change-password-modal.show .change-password-content {
    transform: scale(1);
}

.change-password-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.change-password-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.change-password-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.change-password-close:hover {
    background: #ecf0f1;
}

.change-password-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input {
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.change-password-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-primary {
    background: #40ab26;
    color: white;
}

.btn-primary:hover {
    background: #2e7d1b;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e9ecef;
}

@media (max-width: 768px) {
    .user-profile-dropdown {
        top: 10px;
        right: 10px;
    }
    
    .user-profile-trigger {
        padding: 5px 8px;
        border-radius: 20px;
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .user-dropdown-menu {
        min-width: 200px;
        margin-top: 4px;
    }
    
    .dropdown-header {
        padding: 10px 14px;
    }
    
    .dropdown-user-info .material-icons {
        font-size: 16px;
        padding: 5px;
    }
    
    .dropdown-email {
        font-size: 12px;
    }
    
    .dropdown-role {
        font-size: 10px;
        padding: 1px 5px;
    }
    
    .dropdown-item {
        padding: 8px 14px;
        font-size: 12px;
        gap: 8px;
    }
    
    .dropdown-item .material-icons {
        font-size: 15px;
    }
    
    .change-password-content {
        width: 95%;
        padding: 18px;
    }
}

/* --- QA Card Tabbed Interface Styles (Chips, Centered Text) --- */
.qa-card .chat-tabs-bar {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  background: none;
  border: none;
  margin-bottom: 0;
  margin-top: 8px;
  padding-left: 4px;
}
.qa-card .chat-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 18px;
  font-size: 0.98rem;
  font-weight: 500;
  color: #40ab26;
  background: #fff;
  border: 1.5px solid #40ab26;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border 0.18s;
  outline: none;
  user-select: none;
  box-shadow: none;
  margin-bottom: 0;
  text-align: center;
}
.qa-card .chat-tab.active {
  background: #40ab26;
  color: #fff;
  border: 1.5px solid #40ab26;
  z-index: 2;
}
.qa-card .chat-tab:not(.active):hover {
  background: #eafbe3;
  color: #2e7d1b;
  border-color: #2e7d1b;
}
.qa-card .chat-tab-content {
  padding: 14px 0 0 0;
  background: #fff;
  border-radius: 0 0 8px 8px;
  min-height: 40px;
}
/* --- End QA Card Tabbed Interface Styles (Chips, Centered Text) --- */

/* --- Q/A Tab Q/A Pair Styles --- */
.qa-pair-block {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 14px 18px 10px 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(64,171,38,0.06);
  border: 1px solid #e0e0e0;
}
.qa-pair-question {
  font-weight: 600;
  color: #2e7d1b;
  margin-bottom: 6px;
  font-size: 1.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.qa-pair-answer {
  color: #222;
  font-size: 0.99em;
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.qa-pair-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.qa-pair-source-chip {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1.2px solid #40ab26;
  color: #40ab26;
  border-radius: 14px;
  padding: 2px 8px 2px 7px;
  font-size: 0.89em;
  font-weight: 500;
  margin-right: 0;
  margin-bottom: 0;
  transition: background 0.18s, color 0.18s, border 0.18s;
  cursor: pointer;
  gap: 4px;
  text-decoration: none;
  min-height: 22px;
}
.qa-pair-source-chip:hover {
  background: #eafbe3;
  color: #2e7d1b;
  border-color: #2e7d1b;
}
.qa-pair-source-chip .material-icons {
  font-size: 1em;
  margin-right: 1px;
  color: #1976d2;
}
.qa-pair-source-chip.qa-source-file {
  color: #888;
  border-color: #e0e0e0;
  background: #f8f9fa;
  cursor: default;
}
/* --- End Q/A Tab Q/A Pair Styles --- */

/* --- Conversation Tab Styles --- */
@keyframes conversationButtonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.conversation-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(70, 104, 66, 0.4) !important;
}

.conversation-button:active {
    transform: scale(0.95);
}

.conversation-status {
    transition: color 0.3s ease;
}

/* --- End Conversation Tab Styles --- */

/* --- Galaxy Animation for Conversation Button --- */
.conversation-button.galaxy-mode {
  background: radial-gradient(ellipse at 60% 40%, #aee7ff 0%, #3a6edb 40%, #466842 100%);
  box-shadow: 0 0 60px 10px #3a6edb66, 0 0 0 0 #466842;
  position: relative;
  transition: background 0.7s cubic-bezier(.4,2,.6,1), box-shadow 0.7s cubic-bezier(.4,2,.6,1);
}
.conversation-button.galaxy-mode .sound-wave-icon {
  opacity: 0;
  transition: opacity 0.4s;
}
.conversation-button .sound-wave-icon {
  transition: opacity 0.4s;
}

/* Sound wave icon animation when conversation is active */
.conversation-button.galaxy-mode .sound-wave-icon {
  animation: soundWavePulse 1.2s ease-in-out infinite;
}

@keyframes soundWavePulse {
  0%, 40%, 100% {
    transform: scale(1);
  }
  20% {
    transform: scale(1.1);
  }
}
.galaxy-animation {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.7s;
}
.conversation-button.galaxy-mode .galaxy-animation {
  opacity: 1;
  animation: galaxyRotate 60s linear infinite;
}
@keyframes galaxyRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* Animated nebula clouds */
.galaxy-animation .nebula {
  position: absolute;
  width: 180%; height: 180%;
  left: -40%; top: -40%;
  background: radial-gradient(ellipse at 60% 40%, #aee7ff88 0%, #3a6edb44 60%, transparent 100%);
  filter: blur(18px);
  animation: nebulaMove 8s linear infinite alternate;
}
@keyframes nebulaMove {
  0% { transform: scale(1) translate(0,0); opacity: 0.8; }
  100% { transform: scale(1.1) translate(10px, 20px); opacity: 1; }
}
/* Twinkling stars */
.galaxy-animation .star {
  position: absolute;
  width: 4px; height: 4px;
  background: white;
  border-radius: 50%;
  opacity: 0.7;
  box-shadow: 0 0 8px 2px #fff8;
  animation: starTwinkle 2.5s infinite, starFloat 4.5s ease-in-out infinite alternate;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}
@keyframes starFloat {
  0% { transform: translate(0,0); }
  100% { transform: translate(var(--float-x, 0px), var(--float-y, 0px)); }
}
/* Orbiting stars (elliptical) */
.galaxy-animation .orbit-star {
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -5px;
  margin-top: -5px;
  box-shadow: 0 0 16px 4px #fff8;
  opacity: 0.95;
  z-index: 2;
}
.galaxy-animation .orbit-star1 {
  animation: orbitEllipse1 5.5s linear infinite;
}
.galaxy-animation .orbit-star2 {
  animation: orbitEllipse2 8s linear infinite;
}
@keyframes orbitEllipse1 {
  0%   { transform: rotate(0deg) translateX(60px) scale(1.1) translateY(0px); }
  25%  { transform: rotate(90deg) translateX(40px) scale(0.9) translateY(18px); }
  50%  { transform: rotate(180deg) translateX(60px) scale(1.1) translateY(0px); }
  75%  { transform: rotate(270deg) translateX(40px) scale(0.9) translateY(-18px); }
  100% { transform: rotate(360deg) translateX(60px) scale(1.1) translateY(0px); }
}
@keyframes orbitEllipse2 {
  0%   { transform: rotate(0deg) translateX(38px) scale(0.8) translateY(0px); }
  20%  { transform: rotate(72deg) translateX(60px) scale(1.2) translateY(-12px); }
  50%  { transform: rotate(180deg) translateX(38px) scale(0.8) translateY(0px); }
  70%  { transform: rotate(288deg) translateX(60px) scale(1.2) translateY(12px); }
  100% { transform: rotate(360deg) translateX(38px) scale(0.8) translateY(0px); }
}
/* X Button beside the galaxy circle */
.galaxy-x-btn {
  display: none;
  position: absolute;
  left: 210px; /* 180px (circle) + 30px gap */
  top: 50%;
  transform: translateY(-50%);
  width: 54px; height: 54px;
  background: #232323;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  border: none;
  color: #fff;
  font-size: 2rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.5s, left 0.5s;
}
.galaxy-x-btn.visible {
  display: flex;
  opacity: 1;
  left: 210px;
}
.galaxy-x-btn:active {
  background: #333;
}
/* Responsive for small screens */
@media (max-width: 600px) {
  .galaxy-x-btn, .galaxy-x-btn.visible {
    width: 40px; height: 40px; left: 130px;
    font-size: 1.3rem;
  }
}

/* Star color variants */
.galaxy-animation .star { background: #fff; }
.galaxy-animation .star-white { background: #fff; box-shadow: 0 0 8px 2px #fff8; }
.galaxy-animation .star-blue { background: #7ecbff; box-shadow: 0 0 12px 3px #7ecbff99; }
.galaxy-animation .star-pink { background: #ffb6e6; box-shadow: 0 0 12px 3px #ffb6e699; }
.galaxy-animation .star-yellow { background: #ffe066; box-shadow: 0 0 12px 3px #ffe06699; }
@keyframes starTwinkle {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  20% { opacity: 1; transform: scale(1.7); }
  50% { opacity: 0.7; transform: scale(1.2); }
  80% { opacity: 1; transform: scale(1.7); }
}

/* Embedding Completion Notification Styles */
.embedding-completion-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid #e0e0e0;
    animation: notificationSlideIn 0.3s ease-out;
    overflow: hidden;
}

.embedding-completion-notification.success {
    border-left: 4px solid var(--primary-green);
}

.embedding-completion-notification.error {
    border-left: 4px solid #dc3545;
}

.notification-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.embedding-completion-notification.success .notification-icon {
    color: var(--primary-green);
}

.embedding-completion-notification.error .notification-icon {
    color: #dc3545;
}

.notification-text {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: #666;
    margin-bottom: 2px;
    font-weight: 500;
    word-break: break-word;
}

.notification-details {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-close:hover {
    background: #f5f5f5;
    color: #666;
}

.notification-close .material-icons {
    font-size: 18px;
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile responsive styles for notifications */
@media (max-width: 768px) {
    .embedding-completion-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification-content {
        padding: 12px;
        gap: 10px;
    }
    
    .notification-icon {
        font-size: 20px;
    }
    
    .notification-title {
        font-size: 13px;
    }
    
    .notification-message {
        font-size: 12px;
    }
    
    .notification-details {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .embedding-completion-notification {
        top: 5px;
        right: 5px;
        left: 5px;
    }
    
    .notification-content {
        padding: 10px;
        gap: 8px;
    }
    
    .notification-icon {
        font-size: 18px;
    }
    
    .notification-title {
        font-size: 12px;
    }
    
    .notification-message {
        font-size: 11px;
    }
    
    .notification-details {
        font-size: 10px;
    }
    
    .notification-close .material-icons {
        font-size: 16px;
    }
}

/* Like and Dislike buttons - matching play/reply/copy button styles */
.qa-like-btn {
    background: #444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(64, 171, 38, 0.3);
    padding: 4px;
    font-size: 1.05rem;
    margin-top: 4px;
}

.qa-like-btn .material-icons {
    color: white !important;
    font-family: 'Material Icons', 'MaterialIcons', sans-serif;
    font-size: 0.91rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: none;
    padding: 2px;
    box-sizing: border-box;
}

.qa-like-btn:hover {
    background: #222;
}

.qa-like-btn.liked {
    background: #4CAF50;
    color: white;
}

.qa-like-btn.liked:hover {
    background: #45a049;
}

.qa-like-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #888;
    box-shadow: none;
}

.qa-dislike-btn {
    background: #444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
    padding: 4px;
    font-size: 1.05rem;
    margin-top: 4px;
}

.qa-dislike-btn .material-icons {
    color: white !important;
    font-family: 'Material Icons', 'MaterialIcons', sans-serif;
    font-size: 0.91rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    speak: none;
    padding: 2px;
    box-sizing: border-box;
}

.qa-dislike-btn:hover {
    background: #222;
}

.qa-dislike-btn.disliked {
    background: #f44336;
    color: white;
}

.qa-dislike-btn.disliked:hover {
    background: #d32f2f;
}

.qa-dislike-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #888;
    box-shadow: none;
}

.qa-feedback-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.qa-like-btn.liked, .qa-like-btn.liked:disabled {
  background: #43b94a !important;
  color: #fff !important;
  border: none;
}
.qa-like-btn.liked .material-icons, .qa-like-btn.liked:disabled .material-icons {
  color: #fff !important;
}

.qa-dislike-btn.disliked, .qa-dislike-btn.disliked:disabled {
  background: #e74c3c !important;
  color: #fff !important;
  border: none;
}
.qa-dislike-btn.disliked .material-icons, .qa-dislike-btn.disliked:disabled .material-icons {
  color: #fff !important;
}

/* Make Perplexity source chips smaller and more compact */
.qa-source-inline-chip[data-source-number] {
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 8px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    margin-right: 4px;
    margin-bottom: 2px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 20px;
}

/* Remove extra margin for the last chip */
.qa-source-inline-chip[data-source-number]:last-child {
    margin-right: 0;
}

/* Make the number and title more compact */
.qa-source-inline-number {
    font-weight: 500;
    color: #666;
    font-size: 12px;
    margin-right: 2px;
}

.qa-source-inline-title {
    font-size: 12px;
    color: #333;
    font-weight: 400;
}

.qa-source-inline-chip[data-source-number]:hover {
    background: #222;
    color: #fff;
    transition: background 0.2s, color 0.2s;
}
.qa-source-inline-chip[data-source-number]:hover .qa-source-inline-number,
.qa-source-inline-chip[data-source-number]:hover .qa-source-inline-title {
    color: #fff;
    transition: color 0.2s;
}

/* Answer Action Buttons */
.qa-answer-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    width: 100%;
}

.qa-export-btn, .qa-summary-btn {
    background: #444;
    color: white;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qa-export-btn:hover, .qa-summary-btn:hover {
    background: #222;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.qa-export-btn:active, .qa-summary-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qa-export-btn:disabled, .qa-summary-btn:disabled {
    background: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qa-export-btn .material-icons, .qa-summary-btn .material-icons {
    font-size: 14px;
    color: white;
}

/* Export Dropdown Styles */
.qa-export-container {
    position: relative;
    display: inline-block;
}

.qa-export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 140px;
    display: none;
    margin-top: 4px;
}

.qa-export-option {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.qa-export-option:last-child {
    border-bottom: none;
}

.qa-export-option:hover {
    background: #f5f5f5;
}

.qa-export-option .material-icons {
    font-size: 16px;
    color: #666;
}

/* Query Score Popup Styles */
.query-score-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.query-score-popup.show {
    opacity: 1;
}

.query-score-popup-content {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.query-score-popup.show .query-score-popup-content {
    transform: scale(1);
}

.query-score-popup-header {
    background: linear-gradient(to bottom, #ff4444, #cc3333);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.query-score-popup-icon {
    font-size: 2rem;
    background: white;
    color: #ff4444;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.query-score-popup-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
}

.query-score-popup-body {
    padding: 1.5rem;
    color: #333;
}

.query-score-message {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    color: #333;
}

.query-score-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.score-card {
    flex: 1;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
}

.score-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.score-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff4444;
}

.contact-info {
    border-left: 4px solid #ff4444;
    padding-left: 1rem;
}

.contact-header {
    font-weight: 700;
    color: #ff4444;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.contact-email {
    color: #333;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .query-score-popup-content {
        margin: 1rem;
        max-width: 95%;
    }
    
    .query-score-popup-header {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .query-score-popup-icon {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .query-score-popup-header h3 {
        font-size: 1.2rem;
    }
    
    .query-score-popup-body {
        padding: 1rem;
    }
    
    .query-score-cards {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .score-card {
        padding: 0.75rem;
    }
    
    .score-value {
        font-size: 1.5rem;
    }
}

/* Citation Index Styles for Perplexity Responses */
.citation-index {
    display: inline-block;
    background: linear-gradient(135deg, #40ab26 0%, #7be86a 100%);
    color: white;
    font-weight: 600;
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 12px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(64, 171, 38, 0.3);
    text-decoration: none;
    line-height: 1.2;
    vertical-align: middle;
    position: relative;
    z-index: 1;
}

.citation-index:hover {
    background: linear-gradient(135deg, #2e7d1b 0%, #40ab26 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(64, 171, 38, 0.4);
}

.citation-index:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(64, 171, 38, 0.3);
}

/* Citation highlight effect when source is clicked - REMOVED CONFLICTING RULE */

/* Mobile responsive styles for citations */
@media (max-width: 768px) {
    .citation-index {
        font-size: 0.8em;
        padding: 1px 5px;
        margin: 0 1px;
    }
}

@media (max-width: 480px) {
    .citation-index {
        font-size: 0.75em;
        padding: 1px 4px;
        margin: 0 1px;
    }
}

@media (max-width: 768px) {
    .qa-answer-actions {
        gap: 6px;
    }
}

/* Refresh threads button styles */
.refresh-threads-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.refresh-threads-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: translateY(-50%) scale(1.1);
}

.refresh-threads-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.refresh-threads-btn .material-icons {
    font-size: 18px;
}

.refresh-notification {
    animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Citation Styles */
.citation-index {
    display: inline-block;
    background: var(--primary-green); /* Green color */
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    vertical-align: super;
    line-height: 1;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(64, 171, 38, 0.3);
}

.citation-index:hover {
    background: var(--primary-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(64, 171, 38, 0.4);
}

.citation-index:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(64, 171, 38, 0.3);
}

/* Citation highlight animation */
.qa-source-inline-chip.citation-highlighted {
    animation: citationHighlight 3s ease-in-out;
    background: var(--primary-green-light);
    border: 2px solid var(--primary-green);
    transform: scale(1.05);
    color: var(--primary-green-dark) !important;
}

.qa-source-inline-chip.citation-highlighted .source-inline-number,
.qa-source-inline-chip.citation-highlighted .source-inline-title,
.qa-source-inline-chip.citation-highlighted .source-inline-filename {
    color: var(--primary-green-dark) !important;
}

@keyframes citationHighlight {
    0% {
        background: var(--primary-green-light);
        border-color: var(--primary-green);
        transform: scale(1);
        color: var(--primary-green-dark);
    }
    50% {
        background: #d4f4c8;
        border-color: var(--primary-green-dark);
        transform: scale(1.05);
        color: var(--primary-green-dark);
    }
    100% {
        background: var(--primary-green-light);
        border-color: var(--primary-green);
        transform: scale(1);
        color: var(--primary-green-dark);
    }
}

/* Mobile responsive citation styles */
@media (max-width: 768px) {
    .citation-index {
        font-size: 0.7em;
        padding: 1px 4px;
        min-width: 14px;
    }
}

@media (max-width: 480px) {
    .citation-index {
        font-size: 0.65em;
        padding: 1px 3px;
        min-width: 12px;
    }
}