/* ============ KARSEM Chatbot Widget ============ */

.chatbot-toggle-btn {
    position: fixed;
    left: 1.5rem;
    bottom: 9.5rem;
    z-index: 40;
    width: 3.5rem;
    height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #009BAA, #084F59);
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 16px 32px -16px rgba(2, 28, 34, 0.55);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, width 0.25s ease;
}

.chatbot-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px -18px rgba(2, 28, 34, 0.65);
}

.chatbot-toggle-btn__label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 700;
    transition: max-width 0.25s ease, opacity 0.2s ease, margin-left 0.25s ease;
}

.chatbot-widget--open .chatbot-toggle-btn {
    display: none;
}

@media (min-width: 1024px) {
    /* WhatsApp'ın hemen üstünde, sağ-alt köşede aynı kümede durur
       (bkz. public-layout.css .whatsapp-floating). */
    .chatbot-toggle-btn {
        left: auto;
        right: 1.5rem;
        bottom: 5rem;
        top: auto;
    }

    .chatbot-toggle-btn:hover {
        width: 11rem;
    }

    .chatbot-toggle-btn:hover .chatbot-toggle-btn__label {
        max-width: 8rem;
        opacity: 1;
        margin-left: 0.55rem;
    }
}

.chatbot-panel {
    position: fixed;
    z-index: 45;
    left: 1rem;
    right: 1rem;
    bottom: 9.5rem;
    max-height: min(70vh, 32rem);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 24px 48px -20px rgba(2, 28, 34, 0.45);
    border: 1px solid rgba(0, 155, 170, 0.15);
    overflow: hidden;
}

.chatbot-panel[hidden] {
    display: none;
}

@media (min-width: 640px) {
    .chatbot-panel {
        left: 1.5rem;
        right: auto;
        width: 22rem;
    }
}

@media (min-width: 1024px) {
    .chatbot-panel {
        left: auto;
        right: 1.5rem;
        bottom: 9rem;
        width: 22rem;
    }
}

.chatbot-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #009BAA, #084F59);
    color: #ffffff;
    flex-shrink: 0;
}

.chatbot-panel__title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 800;
    font-size: 0.9rem;
}

.chatbot-panel__title-icon {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.chatbot-panel__close {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 0.25rem;
    display: grid;
    place-items: center;
}

.chatbot-panel__close:hover {
    color: #ffffff;
}

.chatbot-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #f8fafc;
    min-height: 12rem;
}

.chatbot-message {
    max-width: 85%;
    padding: 0.55rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.chatbot-message--bot {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #1f2937;
    border-bottom-left-radius: 0.25rem;
}

.chatbot-message--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #009BAA, #084F59);
    color: #ffffff;
    border-bottom-right-radius: 0.25rem;
}

.chatbot-message--typing {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 0.9rem;
}

.chatbot-message--typing span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #94a3b8;
    animation: chatbot-typing 1.2s infinite ease-in-out;
}

.chatbot-message--typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chatbot-message--typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatbot-typing {

    0%,
    60%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.chatbot-panel__form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
}

.chatbot-panel__form input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-size: 0.85rem;
    outline: none;
}

.chatbot-panel__form input:focus {
    border-color: #009BAA;
    box-shadow: 0 0 0 3px rgba(0, 155, 170, 0.15);
}

.chatbot-panel__send {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #009BAA, #084F59);
    color: #ffffff;
    cursor: pointer;
}

.chatbot-panel__send:hover {
    filter: brightness(1.05);
}

.chatbot-lead-form {
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 90%;
}

.chatbot-lead-form__input {
    width: 100%;
    height: 2.4rem;
    padding: 0 0.85rem;
    border-radius: 0.6rem;
    border: 1px solid #e2e8f0;
    font-size: 0.82rem;
    outline: none;
}

.chatbot-lead-form__input:focus {
    border-color: #009BAA;
    box-shadow: 0 0 0 3px rgba(0, 155, 170, 0.15);
}

.chatbot-lead-form__actions {
    display: flex;
    justify-content: flex-end;
}

.chatbot-lead-form__submit {
    padding: 0.5rem 1.1rem;
    border-radius: 0.6rem;
    border: 0;
    background: linear-gradient(135deg, #009BAA, #084F59);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.chatbot-lead-form__submit:hover {
    filter: brightness(1.05);
}

.chatbot-lead-form__submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.chatbot-lead-form__status {
    font-size: 0.72rem;
    color: #64748b;
    min-height: 1em;
}
