/* ========================================
   AI Bot Engine - Shared Chat UI
   ======================================== */

.aibe-chat-shell,
.aibe-chat-shell * {
    box-sizing: border-box;
}

.aibe-chat-shell {
    font-family: 'Montserrat', Arial, sans-serif;
    background: #071733;
    color: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    max-width: 1200px;
    margin: 0;
}

.aibe-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    background: #071733;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.aibe-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aibe-chat-header-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.aibe-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.aibe-chat-header-form {
    margin: 0;
}

.aibe-chat-header-form-bot-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aibe-chat-label {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.aibe-bot-select {
    min-width: 240px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: #1d2c43;
    color: #ffffff;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 14px;
    outline: none;
}

.aibe-bot-select:focus {
    border-color: #61b0e0;
    box-shadow: 0 0 0 2px rgba(97, 176, 224, 0.15);
}

.aibe-btn-new,
.aibe-btn-new-conversation,
.aibe-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: #1d2c43;
    color: #ffffff;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.aibe-btn-new:hover,
.aibe-btn-new-conversation:hover,
.aibe-send-button:hover {
    background: #243751;
    border-color: rgba(255, 255, 255, 0.4);
}

.aibe-btn-new:active,
.aibe-btn-new-conversation:active,
.aibe-send-button:active {
    transform: translateY(1px);
}

.aibe-chat-body {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 720px;
    background: #071733;
}

.aibe-conversation-list {
    background: #071733;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0;
}

.aibe-conversation-row {
    margin: 0;
}

.aibe-conversation-button {
    width: 100%;
    display: block;
    text-align: left;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    padding: 22px 24px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.aibe-conversation-button:hover {
    background: rgba(255, 255, 255, 0.04);
}

.aibe-conversation-button.selected {
    background: rgba(255, 255, 255, 0.08);
}

.aibe-conversation-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 6px;
}

.aibe-conversation-date {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.aibe-empty-conversations {
    padding: 28px 24px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    line-height: 1.5;
}

.aibe-empty-conversations p {
    margin: 0;
}

.aibe-conversation-thread {
    display: flex;
    flex-direction: column;
    min-height: 720px;
    background: #071733;
}

.aibe-messages,
.aibe-empty-thread {
    flex: 1 1 auto;
}

.aibe-messages {
    padding: 28px 28px 14px;
    overflow-y: auto;
}

.aibe-message {
    max-width: 82%;
    margin-bottom: 24px;
}

.aibe-message-user {
    margin-left: auto;
}

.aibe-message-bot,
.aibe-message-assistant {
    margin-right: auto;
}

.aibe-message-content {
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 500;
    word-break: break-word;
}

.aibe-message-user .aibe-message-content {
    background: #4498d8;
    color: #ffffff;
}

.aibe-message-bot .aibe-message-content,
.aibe-message-assistant .aibe-message-content {
    background: #e6ad23;
    color: #212a37;
}

.aibe-message-time {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.68);
}

.aibe-message-user .aibe-message-time {
    text-align: right;
}

.aibe-empty-thread {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}

.aibe-composer {
    flex: 0 0 auto;
    padding: 20px 28px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #071733;
}

.aibe-composer-form {
    margin: 0;
}

.aibe-composer-input {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: #1d2c43;
    color: #ffffff;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    outline: none;
}

.aibe-composer-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.aibe-composer-input:focus {
    border-color: #61b0e0;
    box-shadow: 0 0 0 2px rgba(97, 176, 224, 0.15);
}

.aibe-composer-actions {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.aibe-send-button {
    min-width: 110px;
}

@media (max-width: 980px) {
    .aibe-chat-body {
        grid-template-columns: 1fr;
    }

    .aibe-conversation-list {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .aibe-message {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .aibe-chat-header {
        flex-direction: column;
        align-items: stretch;
    }

    .aibe-chat-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .aibe-chat-header-form-bot-select {
        flex-direction: column;
        align-items: stretch;
    }

    .aibe-bot-select {
        min-width: 0;
        width: 100%;
    }

    .aibe-messages {
        padding: 20px 18px 10px;
    }

    .aibe-composer {
        padding: 18px;
    }
}


/* ========================================
   Processing / Loading State
   ======================================== */

.aibe-chat-shell.aibe-is-loading .aibe-composer-input,
.aibe-chat-shell.aibe-is-loading .aibe-send-button {
    opacity: 0.55;
    cursor: not-allowed;
}

.aibe-send-button:disabled,
.aibe-composer-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.aibe-processing-indicator {
    display: none;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 28px 20px;
}

.aibe-processing-indicator.is-visible {
    display: flex;
}

.aibe-processing-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(230, 173, 35, 0.9);
    animation: aibe-processing-pulse 1s infinite ease-in-out;
}

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

.aibe-processing-dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes aibe-processing-pulse {
    0%,
    80%,
    100% {
        transform: scale(0.75);
        opacity: 0.35;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}
