/**
 * Chatbot Styles
 */

:root {
    --teko-primary: #ff6600;
}

.chatbot-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
    max-height: 700px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    overflow: hidden;
}

/* Header */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #ff6600, #ff8533);
    color: white;
}

.chatbot-header__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.chatbot-header__icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header__actions {
    display: flex;
    gap: 0.5rem;
}

.chatbot-header__btn {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chatbot-header__btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bs-secondary-bg);
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 4px;
}

/* Message Bubbles */
.chatbot-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-message--assistant {
    align-self: flex-start;
}

.chatbot-message__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.chatbot-message--user .chatbot-message__avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chatbot-message--assistant .chatbot-message__avatar {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.chatbot-message__bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chatbot-message--user .chatbot-message__bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chatbot-message--assistant .chatbot-message__bubble {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-bottom-left-radius: 0.25rem;
}

.chatbot-message__bubble p {
    margin-bottom: 0.5rem;
}

.chatbot-message__bubble p:last-child {
    margin-bottom: 0;
}

.chatbot-message__bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
    font-family: 'Courier New', monospace;
}

.chatbot-message--user .chatbot-message__bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-message__bubble pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.chatbot-message__bubble pre code {
    background: none;
    padding: 0;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    align-self: flex-start;
}

.chatbot-typing__avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #11998e, #38ef7d);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.chatbot-typing__bubble {
    padding: 0.75rem 1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
}

.chatbot-typing__dots {
    display: flex;
    gap: 4px;
}

.chatbot-typing__dot {
    width: 8px;
    height: 8px;
    background: var(--bs-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing__dot:nth-child(1) {
    animation-delay: 0s;
}

.chatbot-typing__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing__dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Input Area */
.chatbot-input {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
}

.chatbot-input__field {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    font-size: 0.95rem;
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    transition: border-color 0.2s ease;
}

.chatbot-input__field:focus {
    outline: none;
    border-color: #667eea;
}

.chatbot-input__field::placeholder {
    color: var(--bs-secondary);
}

.chatbot-input__btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-input__btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-input__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sidebar */
.chatbot-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.chatbot-sidebar.open {
    transform: translateX(0);
    display: flex;
    flex-direction: column;
}

.chatbot-sidebar__overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.chatbot-sidebar__overlay.open {
    display: block;
}

.chatbot-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.chatbot-sidebar__title {
    font-weight: 600;
}

.chatbot-sidebar__close {
    padding: 0.5rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--bs-secondary);
}

.chatbot-sidebar__new {
    margin: 1rem;
    padding: 0.75rem;
    width: calc(100% - 2rem);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chatbot-sidebar__list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.chatbot-sidebar__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chatbot-sidebar__item:hover {
    background: var(--bs-secondary-bg);
}

.chatbot-sidebar__item.active {
    background: var(--bs-secondary-bg);
}

.chatbot-sidebar__item-icon {
    width: 32px;
    height: 32px;
    background: var(--bs-secondary-bg);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary);
}

.chatbot-sidebar__item-info {
    flex: 1;
    min-width: 0;
}

.chatbot-sidebar__item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-sidebar__item-date {
    font-size: 0.75rem;
    color: var(--bs-secondary);
}

/* Welcome Screen */
.chatbot-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.chatbot-welcome__icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 1.5rem;
}

.chatbot-welcome__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chatbot-welcome__subtitle {
    color: var(--bs-secondary);
    margin-bottom: 2rem;
}

.chatbot-welcome__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    max-width: 400px;
}

.chatbot-welcome__suggestion {
    padding: 0.5rem 1rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-welcome__suggestion:hover {
    border-color: #667eea;
    color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        height: calc(100vh - 100px);
        min-height: 400px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .chatbot-message {
        max-width: 90%;
    }

    .chatbot-welcome__suggestions {
        max-width: 100%;
    }
}
