﻿:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6d9dc5;
    --rag-blue: #2c5fa8;
    --rag-light: #e1ebf7;
    --sidebar-bg: #f8f9fa;
    --chat-bg: #ffffff;
    --user-bubble: #4a6fa5;
    --text-dark: #2d3436;
    --text-light: #ffffff;
    --border-color: #e0e0e0;

    --bot-bubble: #e6f7ff; /* Brighter ice-blue background */
    --accent-border: #69c0ff; /* More vivid blue border */
    --text-dark: #003a8c; /* Deep navy text for contrast */
    --highlight: #bae7ff; /* Inner highlight color */

    --bot-bg: #f0f7ff; /* Soft sky blue background */
    --bot-accent: #5a8fcc; /* Mid-tone blue accent */
    --bot-highlight: #c2d8f0; /* Light blue highlight */
    --bot-corner: #3a7bc8; /* Vibrant corner element */
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80vw; /* Change from 100%. 'vw' is % of viewport width */
    max-width: 1800px; /* Good to add a max-width */
    height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgb(0 0 0 / 0.1);
    overflow: hidden;
    margin: 0 auto; /* This helps keep it centered */
}

.chat-app {
    display: flex;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

    .sidebar-header i {
        font-size: 1.5rem;
    }

    .sidebar-header h2 {
        font-size: 1.3rem;
        font-weight: 500;
        margin: 0;
    }

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
}

.history-item {
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

    .history-item:hover {
/*        background: #f0f0f0;*/
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    }

    .history-item.active {
        border-left: 4px solid var(--primary-color);
        border-right: 4px solid var(--primary-color);
        /*background: #f0f0f0;*/
    }

.history-item-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2d3436;
}

.history-item-preview {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    font-size: 0.75rem;
    color: #999;
    text-align: right;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: auto;
}

.status-active {
    background-color: var(--success);
}

.status-pending {
    background-color: var(--warning);
}

.status-closed {
    background-color: #ccc;
}

.new-conversation-button {
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(58, 134, 255, 0.3);
}

    .new-conversation-button:hover {
        background: #2d74e6;
        transform: translateY(-2px);
    }

    .new-conversation-button i {
        margin-right: 8px;
    }

/* Main Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    position: relative;
}

.chat-header {
    padding: 18px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

    .chat-header i {
        font-size: 1.4rem;
        color: var(--primary-color);
    }

    .chat-header h3 {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text-dark);
        margin: 0;
    }

.conversation-status {
    margin-left: auto;
}

.no-conversation {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
}

.welcome-message {
    max-width: 500px;
    padding: 30px;
    border-radius: 16px;
    background: white;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

    .welcome-message i {
        font-size: 4rem;
        color: var(--primary-color);
        margin-bottom: 20px;
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .welcome-message h3 {
        font-size: 2rem;
        margin-bottom: 15px;
        color: var(--primary-color);
    }

    .welcome-message p {
        font-size: 1.1rem;
        margin-bottom: 30px;
        color: #555;
        line-height: 1.6;
    }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(58, 134, 255, 0.3);
    transition: all 0.3s;
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 15px rgba(58, 134, 255, 0.4);
    }

.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #fafbfc;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: fadeIn 0.4s ease-out;
}

.message-user {
    align-items: flex-end;
    margin-left: auto;
}

.message-bot {
    align-items: flex-start;
    margin-right: auto;
}

/*.bubble {
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 1.05rem;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

.user-bubble {
    background: linear-gradient(135deg, var(--user-bubble), #5a75f3);
    color: var(--text-light);
    border-bottom-right-radius: 5px;
}*/

/* User Bubble */
.user-bubble {
    background: linear-gradient(135deg, var(--accent-border), #3a5f95);
    color: var(--text-light);
    border-radius: 16px 0 16px 16px;
    align-self: flex-end;
    border-right: 4px solid #2c4d80;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1), inset -1px 0 0 rgba(255,255,255,0.3);
    margin-left: auto;
    font-weight: 500;
    padding: 10px;
}

    .user-bubble::before {
        content: "";
        position: absolute;
        top: -6px;
        right: -6px;
        width: 20px;
        height: 20px;
        background: #2c4d80;
        clip-path: polygon(100% 0, 0 0, 100% 100%);
        transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .user-bubble:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 14px rgba(0,0,0,0.15), inset -1px 0 0 rgba(255,255,255,0.4);
    }

        .user-bubble:hover::before {
            transform: rotate(-45deg) scale(1.1);
        }

/*.bot-bubble {
    background-color: var(--bot-bubble);
    color: var(--text-dark);
    border-bottom-left-radius: 5px;
}
*/

.bot-bubble {
    background: linear-gradient(95deg, var(--bot-highlight) 0%, var(--bot-bg) 20%), var(--bot-bg);
    color: var(--text-dark);
    border-radius: 0 16px 16px 16px;
    padding: 14px 18px;
   /* max-width: 85%;*/
    margin: 10px 0 14px;
    border-left: 4px solid var(--bot-accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), inset 1px 0 0 rgba(255,255,255,0.7);
    position: relative;
    line-height: 1.6;
    font-weight: 500;
    transition: all 0.25s ease-out;
}

    /* Dynamic corner element */
    .bot-bubble::before {
        content: "";
        position: absolute;
        top: -6px;
        left: -6px;
        width: 20px;
        height: 20px;
        background: var(--bot-corner);
        clip-path: polygon(0 0, 100% 0, 0 100%);
        transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* Hover animation */
    .bot-bubble:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 14px rgba(0,0,0,0.09), inset 1px 0 0 rgba(255,255,255,0.8);
    }

        .bot-bubble:hover::before {
            transform: rotate(45deg) scale(1.1);
        }

    /* Typography accents */
    .bot-bubble strong {
        color: var(--bot-corner);
        font-weight: 600;
    }

.message-time {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 8px;
    font-weight: 400;
}

.chat-input-area {
    padding: 18px 25px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: 30px;
    font-size: 1.05rem;
    outline: none;
    transition: all 0.3s;
    background: #f8f9fa;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

    .chat-input:focus {
        border-color: var(--primary-color);
        background: white;
        box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.15), inset 0 2px 4px rgba(0,0,0,0.05);
    }

.send-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(58, 134, 255, 0.3);
}

    .send-button:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 15px rgba(58, 134, 255, 0.4);
    }

    .send-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

.action-button {
    background: #f0f2f5;
    color: #555;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

    .action-button:hover {
        background: #e2e6ea;
        transform: scale(1.05);
    }

    .action-button.listening {
        background-color: red;
        color: white;
    }


.ai-label {
    background-color: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

    .ai-label i {
        font-size: 0.7rem;
    }
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
}

.typing-text {
    color: #666;
    font-size: 0.95rem;
    margin-right: 10px;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 8px;
}

    .typing-dots span {
        width: 9px;
        height: 9px;
        background-color: #666;
        border-radius: 50%;
        display: inline-block;
        animation: typingAnimation 1.4s infinite ease-in-out;
    }

        .typing-dots span:nth-child(1) {
            animation-delay: 0s;
        }

        .typing-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container-wrapper {
        height: 95vh;
    }

    .sidebar {
        width: 320px;
    }
}

@media (max-width: 992px) {
    .container-wrapper {
        height: 100%;
        padding: 0;
    }

    .chat-app {
        flex-direction: column;
        height: 100vh;
        border-radius: 0;
    }

    .sidebar {
        width: 100%;
        height: 280px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .history-list {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 15px 10px;
    }

    .history-item {
        min-width: 280px;
        margin-right: 15px;
        margin-bottom: 0;
    }

    .new-conversation-button {
        min-width: 280px;
        margin-right: 15px;
        margin-top: 0;
    }
}

@media (max-width: 576px) {
    body {
        padding: 0;
    }

    .chat-app {
        height: 100vh;
    }

    .bubble {
        max-width: 90%;
        padding: 12px 16px;
    }

    .chat-input-area {
        padding: 15px;
    }

    .chat-header {
        padding: 15px;
    }

    .action-button, .send-button {
        width: 45px;
        height: 45px;
    }

    .chat-input {
        padding: 12px 16px;
    }
}

.rag-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--rag-blue);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 3px 8px rgba(44, 95, 168, 0.3);
}

/* RAG Source Section */
.rag-source {
    margin-top: 15px;
    padding: 15px;
    background: var(--rag-light);
    border-radius: 12px;
    border-left: 3px solid var(--rag-blue);
}

.rag-source-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--rag-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.source-item {
    background: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid rgba(44, 95, 168, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

    .source-item i {
        color: var(--rag-blue);
    }

/* RAG Processing Animation */
.rag-processing {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 22px;
    background: var(--rag-light);
    border-radius: 18px;
    margin-top: 10px;
}

.rag-processing-text {
    color: var(--rag-blue);
    font-weight: 500;
}
.language-toggle {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 20px;
    background: rgba(108, 92, 231, 0.08);
    border-radius: 20px;
    padding: 2px;
    border: 1px solid rgba(108, 92, 231, 0.15);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    height: 32px;
}

.language-toggle-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.8rem;
    padding: 6px 12px 6px 30px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
    font-weight: 500;
    display: flex;
    align-items: center;
}

    .language-toggle-btn::before {
        content: '';
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 18px;
        height: 12px;
        background-size: cover;
        background-position: center;
        border-radius: 2px;
    }

#lang-en::before {
    background-image: url('https://upload.wikimedia.org/wikipedia/en/a/ae/Flag_of_the_United_Kingdom.svg');
    background-size: cover;
}

#lang-ru::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30"><path d="M0 0h60v30H0z" fill="%23fff"/><path d="M0 10h60v10H0z" fill="%23003aa0"/><path d="M0 20h60v10H0z" fill="%23d52b1e"/></svg>');
}

.language-toggle-btn.active {
    color: white;
}

.language-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    height: calc(100% - 4px);
    width: calc(50% - 2px);
    background: var(--primary-color);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 5px rgba(108, 92, 231, 0.3);
}

.language-toggle.en .language-toggle-slider {
    transform: translateX(0);
}

.language-toggle.ru .language-toggle-slider {
    transform: translateX(100%);
}


#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNT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TTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}
.hidden {
    display: none !important;
}
.initialization-prompt {
    padding: 1rem;
    text-align: center; /* This centers the text */
    display: flex;
    flex-direction: column;
    align-items: center; /* This centers the button */
    gap: 1rem; /* Adds some space between the text and the button */
}


