/* Chat container styles */
.chat-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Conversation list styles */
#conversation-list {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* Custom scrollbar for conversation list */
#conversation-list::-webkit-scrollbar {
    width: 6px;
}

#conversation-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

#conversation-list::-webkit-scrollbar-thumb {
    background: rgba(75, 156, 255, 0.5);
    border-radius: 3px;
}

#conversation-list::-webkit-scrollbar-thumb:hover {
    background: rgba(75, 156, 255, 0.7);
}

.list-group-item {
    background-color: var(--bs-secondary-bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    border-radius: 6px !important;
    transition: all 0.2s ease;
    position: relative;
}

.list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.list-group-item.active {
    background-color: rgba(75, 156, 255, 0.1);
    border-color: var(--bs-primary);
    color: var(--bs-body-color);
}

/* Conversation title editing styles */
.conversation-title {
    cursor: pointer;
    display: inline-block;
    width: calc(100% - 30px);
    word-wrap: break-word;
}

.conversation-title:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
}

/* Fix date/time visibility */
.list-group-item small.text-muted {
    color: #6c757d !important;
    opacity: 0.9;
}

.conversation-title-input {
    width: calc(100% - 30px);
    padding: 2px 5px;
    font-size: 0.875rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-primary);
    border-radius: 3px;
    color: var(--bs-body-color);
}

.edit-icon {
    font-size: 0.75rem;
    opacity: 0;
    margin-left: 5px;
    color: var(--bs-primary);
}

.list-group-item:hover .edit-icon {
    opacity: 1;
}

/* Chat messages styles */
.chat-messages {
    background-color: var(--bs-secondary-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-message {
    max-width: 85%;
    margin: 0.5rem 0;
}

.chat-message .bg-primary,
.chat-message .bg-secondary {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Table styles */
.markdown-table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    table-layout: fixed;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.markdown-table th,
.markdown-table td {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-align: left;
    word-wrap: break-word;
    width: 50%;
    transition: all 0.2s ease;
}

.markdown-table thead th {
    background-color: var(--bs-secondary-bg);
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.markdown-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-responsive {
    margin: 1rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Button styles */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: #3B8DF7;
    border-color: #3B8DF7;
    transform: translateY(-1px);
}

.btn-danger {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

/* Form control styles */
.form-control {
    background-color: var(--bs-secondary-bg);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--bs-body-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: var(--font-family);
}

.form-control:focus {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(75, 156, 255, 0.25);
}

/* Delete button styles */
.delete-conversation {
    color: var(--bs-body-color);
    opacity: 0.5;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
}

.delete-conversation:hover {
    color: var(--bs-danger);
    opacity: 1;
}

/* Thinking animation styles */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--bs-secondary);
    border-radius: 12px;
    color: white;
}

.thinking-dots {
    display: flex;
    gap: 0.25rem;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: thinking-pulse 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-pulse {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Typing animation styles */
.chat-message .bg-secondary {
    position: relative;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-height: 2.5rem;
}

.chat-message .bg-secondary:not(:has(table))::after {
    content: '|';
    animation: cursor 1s infinite;
    opacity: 0;
}

@keyframes cursor {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Empty cell styles during animation */
.markdown-table td:empty,
.markdown-table th:empty {
    position: relative;
    min-width: 2em;
}

.markdown-table td:empty::after,
.markdown-table th:empty::after {
    content: '|';
    position: absolute;
    left: 1rem;
    animation: cursor 1s infinite;
}

/* Edit icon styles */
.edit-icon {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: 0.25rem;
    font-size: 0.9em;
}

.edit-icon:hover {
    opacity: 1;
}

.conversation-title-input {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-primary);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.875rem;
    width: 150px;
}