/* ==========================================================================
   1. GLOBAL & UTILITIES (Aus HTML & Basis)
   ========================================================================== */
body {
    background-color: #f8f9fa;
    overflow-x: hidden;
}

.cursor-pointer { cursor: pointer; }
.cursor-pointer-strong { cursor: pointer; }

.hidden {
    display: none !important;
}

.backdrop-blur-sm {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* Bootstrap Overrides & Helpers */
.rounded-tl-none { border-top-left-radius: 0 !important; }
.rounded-br-none { border-bottom-right-radius: 0 !important; }
.bg-transparent { background-color: transparent !important; }
.ignore_click { pointer-events: none; }

/* Alert Styles aus HTML */
.alert-info-subtle {
    background-color: #e6f7ff;
    border-color: #b3e0ff;
    color: #0056b3;
}

/* ==========================================================================
   2. MAIN LAYOUT STRUKTUR (Neu aus HTML)
   ========================================================================== */
#vdc_wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%; 
    display: flex;
}

.main-content {
    min-height: calc(100vh - 77px);
    flex-grow: 1;
    transition: margin-left 0.3s ease, margin-right 0.3s ease;
    padding: 0;
    /* Mobile-First: Kein horizontaler Padding */
    padding-right: 0;
    padding-left: 0;
}

#vdc_main {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    max-height: 100vh;
    transition: all 0.3s;
    padding: 0;
}

/* Main Chat Area Container */
.main-chat-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main-chat-header {
    background: #dbeafe;
}

/* Justiniuan Badge im Header */
.justinian_subtitle {
    transition: all 0.2s ease-in-out;
    cursor: default;
}
.justinian_subtitle:hover {
    transform: scale(1.03);
    filter: brightness(1.1);
}

/* ==========================================================================
   3. SIDEBAR (Logik aus alter CSS + Design aus HTML)
   ========================================================================== */
#vdc_side {
    height: 100vh;
}

/* Anpassung der Buttons in der aktiven Sidebar (aus HTML Style) */
#vdc_side.active .btn {
    height: 35px !important;
    min-height: 35px !important;
    max-height: 35px !important;
    padding: 0 !important;
    margin: 2px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
}

/* Mobile Sidebar Logic */
@media (max-width: 991px) {
    #toggle-sidebar { display: block !important; }
    
    #vdc_side.active #collapse-sidebar { display: none !important; }
    
    #vdc_side {
        position: fixed !important;
        width: 80px;
        height: 10vh;
        z-index: 1100;
        top: 0; left: 0;
        transform: translateX(0%);
        transition: transform 0.3s ease-in-out;
    }
    
    #vdc_side.active {
        display: block;
        width: 280px;
        height: 100vh;
        background-color: #dbeafe;
        transform: translateX(0%);
        box-shadow: 0 0 15px rgba(0,0,0,0.25);
    }
    
    #vdc_side .sidebar-content-collapsible { display: none; }   
    #vdc_side.active .sidebar-content-collapsible { display: block; }
    
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0; left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 1099;
    }
    .sidebar-logo { display: none; }
    .info-button { display: none !important; }
}

/* Desktop Sidebar Logic */
@media (min-width: 992px) {
    #toggle-sidebar { display: none !important; }
    
    #vdc_side {
        position: static !important;
        transform: none !important;
        width: 80px;
        flex-shrink: 0;
        transition: width 0.3s ease;
        overflow: hidden;
        background: #dbeafe;
    }

    #vdc_side .collapse { display: none !important; }
    #vdc_side:hover .collapse.show,
    #vdc_side.pinned .collapse.show { display: block !important; }

    #vdc_side .vstack { align-items: center; }
    
    /* Hover State */
    #vdc_side:hover { width: 280px; }
    #vdc_side:hover .vstack { align-items: unset; }
    
    /* Logo Animation */
    .sidebar-logo { max-width: 50px; transition: max-width 0.3s ease; }
    #vdc_side:hover .sidebar-logo { max-width: 150px; }

    /* Text Visibility */
    .sidebar-text { display: none; white-space: nowrap; }
    #vdc_side:hover .sidebar-text { display: inline; }

    /* Button Alignment */
    #vdc_side .nav-link, #vdc_side .btn { justify-content: center; }
    #vdc_side:hover .nav-link, #vdc_side:hover .btn { justify-content: flex-start; }

    /* Pinned State */
    #vdc_side.pinned { width: 280px; }
    #vdc_side.pinned .sidebar-logo { max-width: 150px; }
    #vdc_side.pinned .sidebar-text { 
        display: inline; opacity: 1; visibility: visible; 
    }
    #vdc_side.pinned .nav-link,
    #vdc_side.pinned .btn { justify-content: flex-start; }
    #vdc_side.pinned .vstack { align-items: unset; }
    #vdc_side.pinned:hover { width: 280px; } /* Prevent width change */

    /* Info Button Hover */
    #vdc_side .info-button {
        opacity: 0 !important;
        pointer-events: none;
        position: absolute;
        right: 8px;
    }
    #vdc_side:hover .info-button,
    #vdc_side.pinned .info-button {
        opacity: 1 !important;
        pointer-events: auto;
    }
    #vdc_side .accordion-header { position: relative; }
}

/* ==========================================================================
   4. TABS & CONTENT AREAS 
   ========================================================================== */

/* WICHTIG: Damit der Hauptcontainer den Platz ausfüllt */
#vdc_main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    height: 100%; 
    overflow: hidden;
}

/* Der Wrapper um die Tabs */
#vdc_main .tab-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#mode_tab_chat, 
#mode_tab_check, 
#mode_tab_info {
    flex-grow: 1;
    flex-shrink: 1;
    background-color: transparent;
    border: none;
    height: 92vh !important;
    display: none; 
    flex-direction: column;
    overflow: hidden;
}

#mode_tab_chat.active, 
#mode_tab_check.active, 
#mode_tab_info.active {
    display: flex;
}

/* Spezieller Fix für den Info-Tab (Zentrierung der Karte) */
#mode_tab_info > div {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertikale Zentrierung der Karte */
}

/* Header und Footer im Tab transparent machen */
#mode_tab_chat .card-header,
#mode_tab_chat .card-footer {
    background-color: transparent;
    border-color: rgba(0, 0, 0, 0.1);
}

/* Output Container Scrolling */
#output_tab_chat,
#output_tab_check,
#output_tab_info {
    overflow-y: auto;
    flex: 1;
    flex-shrink: 1;
    min-height: 0; 
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

/* Scrollbar Styling */
#output_tab_chat::-webkit-scrollbar { width: 6px; }
#output_tab_chat::-webkit-scrollbar-track { background: transparent; }
#output_tab_chat::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 3px; }

#output_tab_chat {
    flex-direction: column;
    gap: 0.5rem;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
}
#output_tab_chat.active { display: flex; }

/* Overlays */
.output_tab_overlay {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity ease-in-out 0.35s;
    opacity: 0;
}
.output_tab_overlay.show { opacity: 1; }

/* ==========================================================================
   5. CHAT BUBBLES & BASIC STYLING (Dein Original-Design)
   ========================================================================== */

/* Basis-Schriftgröße und Zeilenhöhe für bessere Lesbarkeit */
.output_chat, 
#output_tab_info {
    font-size: clamp(0.9rem, 2vw, 1rem); /* Leicht vergrößert für Lesbarkeit */
    line-height: 1.6;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Animations */
.output_qa, .output_chat {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInUp 0.4s ease-out;
}
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.output_chat:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Avatar Icons */
.output_qa:before, .output_chat:before {
    font-family: 'Font Awesome 6 Pro', 'Font Awesome 5 Free', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: white;
    margin-right: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    position: absolute;
    bottom: -3rem;
}
.output_chat:hover:before { transform: scale(1.05); }

/* Chat Bubbles Base */
.output_chat {
    position: relative;
    border-radius: 18px;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 85%;
    word-wrap: break-word;
}
.output_chat:first-child { margin-top: 1rem; }
.output_chat > div > *:last-child { margin-bottom: 0; }

/* User Message */
.output_chat.output_q {
    align-self: flex-end;
    margin-left: 15%;
    background: linear-gradient(135deg, #667eea 0%, #4c63d2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.output_chat.output_q:before {
    background: linear-gradient(135deg, #5a67d8 0%, #4299e1 100%);
    border: 2px solid rgba(255,255,255,0.2);
    right: 0; margin-right: 0px;
    content: "\f007"; /* User Icon */
    font-family: 'Font Awesome 7 Free'; 
    font-weight: 900;
}
.output_chat.output_q:after {
    content: ""; position: absolute; width: 0; height: 0; bottom: 0;
    right: -8px;
    border: 8px solid transparent;
    border-left: 8px solid #4c63d2;
    border-bottom: none;
}

/* AI Message */
.output_chat.output_a {
    margin-right: 15%;
    background: linear-gradient(135deg, #e6f3ff 0%, #cce7ff 100%);
    border: 1px solid rgba(66, 153, 225, 0.2);
    color: #1a365d;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.15);
    position: relative;
    padding-bottom: 35px; /* Platz für Copy Button */
}
.output_a:before {
    content: '';
    background-color: #ffffff;
    background-image: url("../images/justinian_logo-171adf4bb77de1bf3817775833aeeb3a.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 2px solid rgba(255,255,255,0.2);
    left: 0; margin-left: 0px;
}
.output_chat.output_a:after {
    content: ""; position: absolute; width: 0; height: 0; bottom: 0;
    left: -8px;
    border: 8px solid transparent;
    border-right: 8px solid #cce7ff;
    border-bottom: none;
}

/* Typing Indicator */
.output_chat .output_pending {
    display: inline-block; margin: 0.5rem 0; width: 8px; height: 8px;
    border-radius: 50%; background: #4299e1;
    animation: typing 1.4s infinite ease-in-out; position: relative;
}
.output_chat .output_pending::before,
.output_chat .output_pending::after {
    content: ''; display: inline-block; position: absolute; top: 0;
    width: 8px; height: 8px; border-radius: 50%; background: #4299e1;
    animation: typing 1.4s infinite ease-in-out;
}
.output_chat .output_pending::before { left: -16px; animation-delay: -0.32s; }
.output_chat .output_pending::after { left: 16px; animation-delay: 0.32s; }

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

/* Copy Button */
.copy-to-clipboard-btn {
    position: absolute; bottom: 8px; right: 8px;
    background-color: #f0f0f0; border: 1px solid #ddd;
    border-radius: 5px; padding: 4px 8px; cursor: pointer;
    font-size: 14px; opacity: 0; transition: opacity 0.2s ease-in-out;
}
.output_qa.output_a:hover .copy-to-clipboard-btn,
.output_chat.output_a:hover .copy-to-clipboard-btn { opacity: 1; }
.copy-to-clipboard-btn.copied {
    border-color: rgba(191,219,239,0.9);
    background-color: rgba(191,219,239,0.9);
}

/* Responsive */
@media (max-width: 768px) {
    .output_chat { max-width: 95%; margin-left: 2.5% !important; margin-right: 2.5% !important; }
    .output_chat.output_q { margin-left: 5% !important; }
    .output_chat.output_a { margin-right: 5% !important; }
    #output_tab_chat { padding: 0.5rem 0.25rem 3rem; }
}

@media (prefers-reduced-motion: reduce) {
    .output_qa, .output_chat { animation: none; transition: none; }
    .output_chat:hover { transform: none; }
}


/* ==========================================================================
   8. CONTENT TYPOGRAPHY (NEU: Optimierung des Inhalts)
   ========================================================================== */

/* Absätze: Mehr Luft */
.output_chat p {
    margin-bottom: 1rem;
}
.output_chat p:last-child {
    margin-bottom: 0;
}

/* Listen (ul/ol): Sauber eingerückt */
.output_chat ul, 
.output_chat ol {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}
.output_chat li {
    margin-bottom: 0.4rem;
}

/* Listenpunkte einfärben (Nur bei KI) */
.output_chat.output_a li::marker {
    color: black;
    font-weight: bold;
}

/* Überschriften: Klare Struktur im Text */
.output_chat h1, .output_chat h2, .output_chat h3, .output_chat h4 {
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}
.output_chat > div > *:first-child { margin-top: 0 !important; }

/* Farben der Überschriften in der KI-Antwort */
.output_chat.output_a h1, 
.output_chat.output_a h2 { font-size: 1.3rem; color: #02376d; }
.output_chat.output_a h3 { font-size: 1.15rem; color: #2563eb; }
.output_chat.output_a h4 { font-size: 1.05rem; color: #1e293b; }

/* Farben der Überschriften in der User-Frage (Muss weiß sein) */
.output_chat.output_q h1, 
.output_chat.output_q h2, 
.output_chat.output_q h3,
.output_chat.output_q h4 { color: #ffffff !important; }

/* Links: Unterstrichen und farblich passend */
.output_chat a {
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}
/* Links KI (Blau) */
.output_chat.output_a a { color: #2563eb; font-weight: 500; }
.output_chat.output_a a:hover { 
    background: rgba(37,99,235,0.1); }
/* Links User (Weiß) */
.output_chat.output_q a { color: #fff; text-decoration: underline; }

/* Container kümmert sich um das Scrollen */
.output_chat .table-responsive {
    margin: 1rem 0;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow-x: auto; /* Wichtig für Scrollen */
    -webkit-overflow-scrolling: touch;
    background-color: #fff;
}

/* Die Tabelle selbst darf KEIN display: block haben! */
.output_chat table {
    width: 100%;
    border-collapse: collapse;
    margin: 0; /* Margin macht der Container */
    font-size: 0.9rem;
    table-layout: auto; /* Spalten passen sich dem Inhalt an */
}

/* Header Styling */
.output_chat th {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #334155;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 12px 16px;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap; 
    vertical-align: middle;
}

.output_chat td {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    vertical-align: top;
    /* min-width entfernen oder verringern, damit die Tabelle nicht unnötig breit wird, 
       wenn der Text umbrechen darf */
    min-width: 100px; 
}

/* Link-Styling innerhalb der Tabelle */
.output_chat td a {
    color: #2563eb;
    text-decoration: none;
    word-break: break-all; /* Damit lange Links die Tabelle nicht sprengen */
}
.output_chat td a:hover {
    text-decoration: underline;
}

/* Code Blöcke */
.output_chat pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.85rem;
    margin: 1rem 0;
}

/* Deine Source Links (Chips) */
.source_link {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255,255,255,0.7);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #02376d !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    transition: all 0.2s;
    margin: 0 2px;
    text-decoration: none !important;
}
.source_link:hover {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* ==========================================================================
   6. INPUT AREA & UPLOAD BUTTON (Concept 2 & Legacy Upload)
   ========================================================================== */

/* Wrapper für schwebendes Eingabefeld (aus HTML) */
.floating-input-area {
    width: 90%;
    max-width: 950px;
    margin: 1rem auto;
    position: sticky;
    bottom: 1rem;
    left: 0; right: 0;
}

/* Weißer Container Formular */
.floating-chat-form {
    background: white;
    border-radius: 30px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin: 0;
    transition: all 0.3s ease;
}
.floating-chat-form:hover { box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15); }

/* Eingabefeld Styling */
.chat-input-wrapper {
    display: flex; align-items: center; gap: 8px; padding: 8px;
}
.chat-input-wrapper:focus-within { transform: scale(1.01); }
.chat-input-wrapper:focus-within .floating-chat-form {
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.15);
}

.chat-input-wrapper .input_query {
    flex: 1; border: none; outline: none;
    padding: 15px 20px; font-size: 1rem;
    background: transparent; color: #374151;
    resize: none; transition: all 0.2s ease;
    min-height: 44px; max-height: 120px; overflow-y: auto;
}
.chat-input-wrapper .input_query::placeholder { color: #9ca3af; }
.chat-input-wrapper .input_query:focus { color: #111827; }

/* Buttons im Input Bereich */
.btn-icon {
    width: 40px; height: 40px; border-radius: 50%;
    border: none; background: #3b82f6; color: white;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease; font-size: 1rem;
    position: relative; overflow: hidden;
}
.btn-icon:hover { background: #2563eb; transform: scale(1.05); }
.btn-icon.btn-danger { background: #ef4444; }
.btn-icon.btn-danger:hover { background: #dc2626; transform: scale(1.05); }
.btn-icon::after {
    content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0;
    background: rgba(255, 255, 255, 0.3); border-radius: 50%;
    transform: translate(-50%, -50%); transition: width 0.6s, height 0.6s;
}
.btn-icon:active::after { width: 300px; height: 300px; }

/* Drag & Drop Feedback */
.floating-input-area.drag-over {
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.5) inset;
    background-color: rgba(0, 123, 255, 0.05);
}
.floating-input-area.drag-over::before {
    content: "PDF hier ablegen";
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; font-weight: bold; color: #007bff;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px); z-index: 10; border-radius: 8px;
}

/* Footer (Sessions, Folder etc.) */
.unified-footer {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 1rem;
    padding: 8px 16px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem; color: #6b7280;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    min-height: 50px;
}
.unified-footer:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.unified-footer .footer-item {
    display: flex; align-items: center; padding: 6px 10px;
    border-radius: 6px; transition: background 0.2s ease, color 0.2s ease;
    user-select: none; text-decoration: none; color: #6b7280;
}
.unified-footer .footer-item:not(.disabled):hover {
    background: #f3f4f6; color: #111827;
}
.footer-item strong { color: #3b82f6; font-weight: 600; }
.footer-item.disabled { opacity: 0.5; }

/* Badge im Footer */
.badge {
    background: #3b82f6; color: white; padding: 2px 8px;
    border-radius: 12px; font-size: 0.7rem; font-weight: 500;
    margin-left: 4px; transition: all 0.2s ease;
}
.footer-item:hover .badge { background: #2563eb; transform: scale(1.05); }

/* Disconnect Button */
.btn-disconnect {
    background: transparent; border: none; color: #9ca3af;
    padding: 2px 6px; border-radius: 4px; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center;
}
.btn-disconnect:hover { background: #fee2e2; color: #ef4444; }

/* --- Upload Button Complex Logic (Legacy but necessary) --- */
.file-upload-wrapper {
    position: relative; display: inline-block;
    height: 36px; width: 36px;
}
#attach_pdf_btn {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #6c757d; background: none; border: none;
    cursor: pointer; padding: 0; font-size: 1.25rem; overflow: hidden;
}
#attach_pdf_btn i {
    position: absolute; transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}
#attach_pdf_btn .default-icon { opacity: 1; transform: scale(1); }
#attach_pdf_btn .upload-success-icon,
#attach_pdf_btn .upload-spinner-icon,
#attach_pdf_btn .upload-failed-icon {
    opacity: 0; transform: scale(0);
}

/* Upload Progress Ring */
.progress-ring {
    position: absolute; top: 0; left: 0; transform: rotate(-90deg);
    opacity: 0; transition: opacity 0.3s ease-in-out;
}
.progress-ring-circle {
    stroke-dasharray: 100.53; stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.3s ease-in-out; transform-origin: center;
}

/* Upload States & Animations */
#attach_pdf_btn.files-selected .default-icon { transform: scale(0.9); }
#attach_pdf_btn.uploading .default-icon { opacity: 0; transform: scale(0.5); }
#attach_pdf_btn.uploading .upload-spinner-icon {
    opacity: 1; transform: scale(1); animation: spin 1.5s linear infinite;
}
#attach_pdf_btn.uploading .progress-ring { opacity: 1; }

#attach_pdf_btn.upload-complete .progress-ring {
    opacity: 0; transition: opacity 0.3s ease-in-out 0.2s;
}
#attach_pdf_btn.upload-complete .default-icon { opacity: 0; transform: scale(0); }
#attach_pdf_btn.upload-complete .upload-success-icon {
    opacity: 1; transform: scale(1); animation: success-bounce 0.5s ease;
}

#attach_pdf_btn.upload-failed .default-icon,
#attach_pdf_btn.upload-failed .upload-spinner-icon,
#attach_pdf_btn.upload-failed .upload-success-icon { opacity: 0; transform: scale(0); }
#attach_pdf_btn.upload-failed .upload-failed-icon {
    opacity: 1; transform: scale(1); color: #D9534F; animation: success-bounce 0.5s ease;
}
#attach_pdf_btn.upload-failed .progress-ring { opacity: 0; }
#attach_pdf_btn.upload-failed .upload-spinner-icon { animation: none; }

@keyframes success-bounce {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

.footer-item-list {
    display: flex; flex-direction: column; gap: 4px; margin-bottom: 5px;
}
.remove-success-item { cursor: pointer; color: #6c757d; transition: color 0.2s ease; }
.remove-success-item:hover { color: #dc3545; }
.successful-upload-item { display: flex; align-items: center; }
.successful-upload-item span {
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.successful-upload-item i:last-child { flex-shrink: 0; }
#uploaded-file-name {
    font-size: 0.9em; font-weight: 500; max-width: 250px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: inline-block; vertical-align: middle;
}
.remove-file-btn { cursor: pointer; color: #6c757d; transition: color 0.2s ease; }
.remove-file-btn:hover { color: #dc3545; }

@media (max-width: 768px) {
    .floating-input-area { width: 95%; margin: 0.5rem auto; }
    .floating-chat-form { border-radius: 25px; }
    .unified-footer { flex-direction: column; gap: 8px; padding: 12px 16px; }
    .unified-footer .footer-item { font-size: 0.75rem; }
}

/* ==========================================================================
   7. MISC COMPONENTS (Accordions, Admin, Sources, News)
   ========================================================================== */

/* Accordions (aus HTML) */
.accordion-item { border: none; background-color: transparent; }
.accordion-body { max-height: 30vh; overflow-y: auto; }
.accordion-body .btn,
.accordion-body .list-group-item,
.accordion-body .folder_btn,
.accordion-body .session_btn {
    width: 100%; margin-left: 0; margin-right: 0; border-radius: 0;
}
.accordion-body .d-flex { width: 100%; }
.accordion-body .btn { padding-left: 1rem; padding-right: 1rem; }

/* Admin Panel (Farben erhalten) */
#admin_panel .btn-light, 
#admin_panel .btn-light:active, 
#admin_panel .btn-light:focus, 
#admin_panel .btn-light:disabled:hover, 
#admin_panel .custom-file-label {
    background-color: #02376d !important;
    border-color: #02376d !important;
    color: #ffffff !important;
}
#admin_panel .btn-light:hover, 
#admin_panel .show > .btn-light.dropdown-toggle {
    background-color: #0351a1 !important;
    border-color: #0351a1 !important;
    color: #ffffff !important;
}
.custom-file-label:after {
    content: "\f574"; font-family: 'Font Awesome 5 Free'; font-weight: 900;
    background-color: #02376d; color: #ffffff;
}

/* Newsfeed Side */
#vdc_side_newsfeed {
    background-color: var(--bs-card-cap-bg);
    position: relative; max-height: 82.5vh; z-index: 1;
}
.newsfeed_content {
    max-height: calc(95vh - 45px); overflow-y: scroll; overflow-x: hidden;
}
#toggle-newsfeed { transition: all 0.3s ease; }
.sticky-news-header { background-color: #f2f2f2; }
#toggle-newsfeed.newsfeed-collapsed { right: 20px; }

/* List Groups */
.vdc_listgroups {
    display: flex; flex-direction: column; flex-grow: 1;
    flex-shrink: 1; max-height: 460px; overflow: auto;
}
.vdc_listgroup_btn:not(.collapsed) {
    border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.vdc_listgroup .btn-group-vertical .btn:first-child {
    border-top-left-radius: 0; border-top-right-radius: 0;
}
.vdc_listgroup_btn.collapsed .fa-chevron-up { transform: rotate(180deg); }
.vdc_listgroup_btn .badge { overflow: hidden; text-overflow: ellipsis; }
#vdc_listgroup_sessions .list-group-item, #vdc_listgroup_folders .list-group-item {
    padding: 0.375rem 0.75rem;
}
.session_btn.disabled, .new_session_btn.disabled { pointer-events: none !important; }
.session_btn:hover .session_edit, .folder_btn:hover .folder_edit { opacity: 1 !important; }
.session_name, .folder_name {
    height: calc(1.5em + .5rem + 2px); padding: .25rem .5rem; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.folder_doc_remove { cursor: pointer; }
.remove_doc_from_index { display: none; }
.new_session_mode_options label { cursor: pointer; }

/* Source Links (Icons erhalten) */
.source_link { position: relative; }
.source_link:before {
    font-family: 'Font Awesome 5 Free'; font-weight: 900; margin-right: 0.25rem;
}
.source_link_dif:before { content: "\f15c"; }
.source_link_gesetz:before { content: "\f111"; }
.source_link_gesetz:after {
    position: absolute; top: 0; left: 0;
    content: "\00a7"; font-family: 'Open Sans', sans-serif;
    color: #F2F4F6; padding: 0 0.25rem;
}
.source_link_beschluss:before, 
.source_link_urteil:before, 
.source_link_eughvorlage:before, 
.source_link_versaeumnisurteil:before { content: "\f0e3"; }

.sources_list .fa-paragraph:before, 
#edit_folder_docs .fa-paragraph:before {
    content: "\00a7"; font-family: 'Open Sans', sans-serif !important;
}

/* User Profile & Other Buttons */
.bottom-menu { margin-top: 0 !important; }
.user-profile-form {
    width: 100%; max-width: 800px; margin: auto;
    padding: 1rem; background-color: #fff;
    border: 1px solid #ddd; border-radius: 8px; font-family: sans-serif;
}
.user-profile-form__group { margin-bottom: 1.5rem; }
.user-profile-form__label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
.user-profile-form__input, .user-profile-form__select {
    width: 100%; padding: 0.6rem 0.8rem; font-size: 1rem;
    border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;
}
.user-profile-form__help-text {
    font-size: 0.85rem; color: #6c757d; margin-top: 0.3rem; display: block;
}
.user-profile-form__2fa-group { display: flex; flex-direction: column; gap: 0.5rem; }
.user-profile-form__2fa-option { display: flex; align-items: center; }
.user-profile-form__radio { margin-right: 0.5rem; }
.user-profile-form__radio-label { font-weight: 400; }
.user-profile-form__actions { text-align: center; }
.user-profile-button {
    font-size: 1.1rem; padding: 0.6rem 1.2rem;
    background-color: #007bff; color: white;
    border: none; border-radius: 4px; cursor: pointer;
}
.user-profile-button:hover { background-color: #0056b3; }

#share_button { background-color: #2563eb; border-color: #2563eb; }
.consta_icon { color: #2563eb; }
#chat_button { background-color: #2563eb; border-color: #2563eb; }

/* Pagefooter */
.pagefooter { padding: 1rem; }
.pagefooter .container { max-width: unset; }
.pagefooter br { display: none; }
.pagefooterlink { font-size: 0.75rem; display: inline-block; margin: 0 0.5rem !important; }
.pagefooterlink:after { content: none; }
.copyright { display: block; margin-top: 0.5rem; }

/* Tool Calls & Animations */
.tool-call-container {
    border-radius: 12px; padding: 8px;
    animation: slideInFromLeft 0.4s ease-out;
    overflow: hidden; position: relative;
}
.tool-call-container::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 2s infinite;
}
.tool-call-inner { display: flex; align-items: center; gap: 12px; }
.tool-call-icon {
    flex-shrink: 0; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.1); border-radius: 50%; font-size: 20px;
}
.icon-pulse { display: inline-block; animation: pulse 1.5s ease-in-out infinite; }
.tool-call-content { flex: 1; min-width: 0; }
.tool-call-text {
    font-size: 14px; font-weight: 500; margin-bottom: 8px; line-height: 1.4;
}
.tool-call-progress {
    height: 3px; background: rgba(255, 255, 255, 0.1);
    border-radius: 2px; overflow: hidden;
}
.progress-bar {
    height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6, #3b82f6);
    background-size: 200% 100%; border-radius: 2px;
    animation: progressMove 1.5s ease-in-out infinite;
}

@keyframes slideInFromLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}
@keyframes progressMove {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}