/* ============================================
   Chatbot Widget — Personenbetreuung Kumerschek
   Passt zum bestehenden Website-Design (Gold/Braun)
   ============================================ */

/* --- Toggle Button --- */
.chatbot-toggle {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #E7BF62 0%, #D4A84A 100%);
    color: #372A2A;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(45,41,38,0.2);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(45,41,38,0.25);
}

.chatbot-toggle__icon,
.chatbot-toggle__close {
    width: 26px;
    height: 26px;
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chatbot-toggle__close {
    opacity: 0;
    transform: rotate(-90deg);
}

.chatbot-toggle--open .chatbot-toggle__icon {
    opacity: 0;
    transform: rotate(90deg);
}

.chatbot-toggle--open .chatbot-toggle__close {
    opacity: 1;
    transform: rotate(0);
}

/* --- Hint Bubble --- */
.chatbot-hint[hidden] {
    display: none !important;
}

.chatbot-hint {
    position: fixed;
    bottom: 5rem;
    right: 1.25rem;
    z-index: 999;
    background: #FFFFFF;
    color: #372A2A;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(45,41,38,0.12);
    font-size: 0.9rem;
    font-family: 'DM Sans', system-ui, sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    animation: chatbot-hint-in 0.4s ease;
    max-width: 280px;
}

.chatbot-hint__close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #9A8D80;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}

@keyframes chatbot-hint-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Chat Window --- */
.chatbot-window[hidden] {
    display: none !important;
}

.chatbot-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.25rem;
    z-index: 1001;
    width: 370px;
    max-width: calc(100vw - 2rem);
    height: 520px;
    max-height: calc(100vh - 7rem);
    background: #FAF6F0;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(45,41,38,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-window-in 0.3s ease;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

@keyframes chatbot-window-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Header --- */
.chatbot-header {
    background: linear-gradient(135deg, #56453D 0%, #372A2A 100%);
    color: #FFFFFF;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header__info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.chatbot-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E7BF62, #D4A84A);
    color: #372A2A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chatbot-header__name {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
}

.chatbot-header__status {
    font-size: 0.7rem;
    opacity: 0.7;
}

.chatbot-header__close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #FFFFFF;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.2s;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

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

/* --- Messages --- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chatbot-msg {
    display: flex;
    max-width: 85%;
}

.chatbot-msg--bot {
    align-self: flex-start;
}

.chatbot-msg--user {
    align-self: flex-end;
}

.chatbot-msg__bubble {
    padding: 0.65rem 0.9rem;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}

.chatbot-msg--bot .chatbot-msg__bubble {
    background: #FFFFFF;
    color: #372A2A;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(45,41,38,0.06);
}

.chatbot-msg--user .chatbot-msg__bubble {
    background: linear-gradient(135deg, #E7BF62, #D4A84A);
    color: #372A2A;
    border-bottom-right-radius: 4px;
}

/* --- Typing Indicator --- */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.75rem 1rem !important;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #B19475;
    animation: chatbot-bounce 1.2s infinite;
}

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

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

@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* --- Input --- */
.chatbot-input {
    display: flex;
    padding: 0.65rem;
    gap: 0.5rem;
    border-top: 1px solid #E0D6C8;
    background: #FFFFFF;
    flex-shrink: 0;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #E0D6C8;
    border-radius: 24px;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    font-family: inherit;
    background: #FAF6F0;
    color: #372A2A;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input input:focus {
    border-color: #E7BF62;
}

.chatbot-input input::placeholder {
    color: #9A8D80;
}

.chatbot-input__send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #E7BF62, #D4A84A);
    color: #372A2A;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.chatbot-input__send:hover {
    transform: scale(1.08);
}

.chatbot-input__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-input__send svg {
    width: 18px;
    height: 18px;
}

/* --- Footer --- */
.chatbot-footer {
    text-align: center;
    padding: 0.35rem;
    background: #FFFFFF;
    flex-shrink: 0;
}

.chatbot-footer a {
    font-size: 0.7rem;
    color: #9A8D80;
    text-decoration: none;
}

.chatbot-footer a:hover {
    color: #745F50;
}

/* ============================================
   Mobile (< 768px) — Vollbild-Chat
   ============================================ */
@media (max-width: 767px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 1rem;
        right: 1rem;
    }

    .chatbot-hint {
        bottom: 4.5rem;
        right: 1rem;
    }
}
