/* Custom styles for ChatBot Host */

.navbar-brand i {
    margin-right: 0.5rem;
}

.chat-message {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.user-message {
    background-color: #e3f2fd;
    margin-left: 1rem;
    border-left: 4px solid #2196f3;
}

.assistant-message {
    background-color: #f5f5f5;
    margin-right: 1rem;
    border-left: 4px solid #4caf50;
}

.chat-history {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #fff;
    padding: 0.5rem;
}

/* Thinking indicator animation */
#thinkingIndicator {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Ensure the main row stays in a single row layout */
.row.g-2 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
    display: flex;
    flex-wrap: nowrap !important;
    align-items: stretch;
}

/* Compact Conversation sidebar styles */
.conversations-sidebar {
    transition: all 0.3s ease-in-out;
    flex: 0 0 auto !important;
    width: 25% !important;
    max-width: 300px !important;
}

.conversations-collapsed {
    transition: all 0.3s ease-in-out;
    flex: 0 0 auto !important;
    width: auto !important;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.chat-main-area {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
}

.conversations-expand-btn {
    height: calc(100vh - 180px);
    writing-mode: vertical-lr;
    text-orientation: mixed;
    padding: 0.75rem 0.4rem;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.conversations-expand-btn i {
    writing-mode: horizontal-tb;
    margin: 0;
}

.conversations-expand-text {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    font-size: 0.75rem;
    letter-spacing: 0.05rem;
}

.conversations-header-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.conversations-new-btn,
.conversations-toggle-btn {
    min-width: 24px;
    min-height: 24px;
    padding: 2px 6px;
    font-size: 0.7rem;
}

.conversations-body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    font-size: 0.8rem;
}

.conversations-list-item {
    padding: 0.4rem 0.5rem !important;
    transition: background-color 0.15s ease-in-out;
}

.conversation-name {
    font-size: 0.75rem !important;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 0.2rem !important;
}

.conversations-date {
    font-size: 0.65rem;
    color: #6c757d;
}

.conversations-team-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
}

.conversations-delete-btn {
    min-width: 22px !important;
    min-height: 22px !important;
    padding: 0.1rem 0.3rem !important;
    font-size: 0.7rem !important;
}

.conversations-empty {
    font-size: 0.75rem;
}

.conversations-empty i {
    font-size: 1.5rem !important;
}

/* Conversation sidebar scrollbar */
.conversations-body::-webkit-scrollbar {
    width: 5px;
}

.conversations-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2.5px;
}

.conversations-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2.5px;
}

.conversations-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* List group item styles */
.list-group-item.active {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.list-group-item {
    padding: 0.5rem 0.75rem;
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

.list-group-item.active:hover {
    background-color: #e0a800;
    border-color: #e0a800;
}

/* Center the delete icon button and add contrast for active conversations */
.list-group-item .btn-group-vertical {
    margin-left: 0.5rem;
}

.list-group-item .btn-outline-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
}

/* High contrast background for delete button when conversation is active */
.list-group-item.active .btn-outline-danger {
    background-color: #ffffff;
    border-color: #dc3545;
}

.list-group-item.active .btn-outline-danger:hover {
    background-color: #dc3545;
    color: #ffffff;
}

/* Ensure alignment of conversation items */
.list-group-item .d-flex {
    align-items: center;
}

.list-group-item .flex-grow-1 {
    min-width: 0; /* Allow text to wrap properly */
}

.search-result {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fff;
    transition: box-shadow 0.15s ease-in-out;
}

.search-result:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.document-result {
    border-left: 4px solid #007bff;
}

.fragment-score {
    font-size: 0.875rem;
}

.fragment-text {
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 0.25rem;
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border-left: 3px solid #6c757d;
}

.tag-badge {
    margin: 0.125rem;
    font-size: 0.75rem;
}

.footer {
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Configuration page styles */
.provider-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.provider-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.config-form .form-group {
    margin-bottom: 1.5rem;
}

.config-form label {
    font-weight: 600;
    color: #495057;
}

.config-form .form-text {
    font-size: 0.8rem;
    line-height: 1.4;
}

.config-description {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-line;
}

/* Collection input styles */
.collection-container {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    background-color: #f8f9fa;
}

.collection-items {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    padding: 0.5rem;
    background-color: #ffffff;
    min-height: 60px;
    position: relative;
}

.collection-items.empty::before {
    content: "No items added yet. Use the input above to add items.";
    color: #6c757d;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    padding: 1rem;
}

.collection-items.is-invalid {
    border-color: #dc3545;
}

.collection-items.is-invalid::after {
    content: "At least one item is required.";
    color: #dc3545;
    font-size: 0.875rem;
    position: absolute;
    bottom: -1.5rem;
    left: 0;
}

.collection-item {
    animation: fadeInDown 0.3s ease-out;
    transition: all 0.2s ease-in-out;
}

.collection-item:hover {
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

.collection-item .form-control {
    background-color: #ffffff;
    border: 1px solid #ced4da;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.collection-item .btn-danger {
    transition: all 0.2s ease-in-out;
}

.collection-item .btn-danger:hover {
    transform: scale(1.05);
    box-shadow: 0 0.25rem 0.5rem rgba(220, 53, 69, 0.3);
}

.collection-container .input-group .btn-success {
    transition: all 0.2s ease-in-out;
}

.collection-container .input-group .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(40, 167, 69, 0.3);
}

/* Form validation styles */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar for collection items */
.collection-items::-webkit-scrollbar {
    width: 6px;
}

.collection-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.collection-items::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.collection-items::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Custom scrollbar for chat history */
.chat-history::-webkit-scrollbar {
    width: 8px;
}

.chat-history::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.btn i {
    margin-right: 0.5rem;
}

/* Loading state for buttons */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Tighter spacing for cards */
.card-header {
    padding: 0.5rem 0.75rem;
}

.card-body {
    padding: 0.75rem;
}

/* Row gutters */
.row.g-2 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .user-message {
        margin-left: 0;
    }
    
    .assistant-message {
        margin-right: 0;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    .collection-container {
        padding: 0.75rem;
    }
    
    .collection-items {
        max-height: 200px;
        min-height: 50px;
    }
    
    .collection-items.empty::before {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    .chat-history {
        height: calc(100vh - 480px) !important;
    }
    
    .conversations-expand-btn {
        height: calc(100vh - 220px);
    }
    
    .conversations-sidebar {
        width: 100%;
        max-width: 100%;
    }
}
