/**
 * Chatbot Layout
 * 
 * Grundlegendes Layout für Floating Button und Modal.
 * 
 * @package SMG_Mall
 * @since 1.0.0
 */

/* ========================================
   Floating Button
   ======================================== */

.chatbot-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--smg-500, #e31e24);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(var(--smg-500-rgb, 227, 30, 36), 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999; /* Über Sticky Footer (999999) */
    transition: all 0.3s ease;
}

/* Höher positionieren wenn Sticky Footer aktiv */
body:not(.sticky-footer-hidden) .chatbot-floating-btn {
    bottom: 94px; /* 70px Footer + 24px Abstand */
}

.chatbot-floating-btn:hover {
    transform: scale(1.1);
    background: var(--smg-700, #b91c1c);
    box-shadow: 0 6px 16px rgba(var(--smg-700-rgb, 185, 28, 28), 0.2);
}

.chatbot-floating-btn svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   Modal
   ======================================== */

.chatbot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999; /* Über Sticky Footer (999999) */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot-modal--open {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.chatbot-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.chatbot-modal__container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom right,
        #ffffff 0%,
        var(--smg-50, #fef2f2) 50%,
        rgba(var(--smg-100-rgb, 254, 226, 226), 0.95) 100%
    );
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========================================
   Header - Kompakter Fixed Top Bar mit Glassmorphism
   ======================================== */

.chatbot-modal__header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.6);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    animation: slideInFromTop 0.4s ease-out 0.1s backwards;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chatbot-modal__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    max-width: 600px;
}

.chatbot-modal__title h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--smg-gray-900, #111827);
    margin: 0;
    line-height: 1.2;
}

.chatbot-modal__title p {
    font-size: 12px;
    font-weight: 500;
    color: var(--smg-gray-500, #6b7280);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
}

.chatbot-modal__icon {
    font-size: 28px;
}

.chatbot-modal__close {
    position: fixed;
    top: 14px;
    left: 16px;
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: var(--smg-500, #e31e24);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(229, 231, 235, 0.8);
}

.chatbot-modal__close:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--smg-700, #b91c1c);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: var(--smg-500, #e31e24);
}

.chatbot-modal__close svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.chatbot-modal__close span {
    line-height: 1;
}

/* ========================================
   Messages Container - Scrollable mit Padding für Fixed Header/Footer
   ======================================== */

.chatbot-modal__messages {
    flex: 1;
    overflow-y: auto;
    padding: 80px 16px 144px 16px; /* Top: 56px Header + 24px, Bottom: 120px Input + 24px */
    background: transparent;
    animation: slideInFromBottom 0.6s ease-out 0.4s backwards;
}

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

.chatbot-modal__messages-inner {
    max-width: 1536px; /* 6xl */
    margin: 0 auto;
    width: 100%;
}

/* Smooth Scrolling */
.chatbot-modal__messages {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chatbot-modal__messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-modal__messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-modal__messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.chatbot-modal__messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   Input Area - Fixed Bottom mit Glassmorphism
   ======================================== */

.chatbot-modal__input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(229, 231, 235, 1);
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

/* Mobile: Keyboard Handling */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    .chatbot-modal__input {
        position: fixed;
        bottom: env(safe-area-inset-bottom, 0);
    }
}

/* Android Chrome */
@media screen and (max-width: 768px) {
    .chatbot-modal__input {
        /* Verhindere dass Input unter Keyboard verschwindet */
        position: fixed;
        bottom: 0;
    }

    /* Wenn Keyboard offen ist (viewport height ändert sich) */
    @supports (height: 100dvh) {
        .chatbot-modal__messages {
            height: calc(100dvh - 200px); /* Dynamic Viewport Height */
        }
    }
}

/* Input Inner wird jetzt in chatbot-input-base.css gestylt */
.chatbot-modal__input-inner {
    max-width: 768px; /* 3xl */
    margin: 0 auto;
    width: 100%;
}

/* Input wird jetzt in chatbot-input-base.css gestylt */

/* Buttons werden jetzt in chatbot-input-base.css gestylt */

/* Button Container */
.chatbot-modal__input-buttons {
    /* Wird in chatbot-input-base.css gestylt */
}

/* DSGVO Hinweis */
.chatbot-modal__privacy-notice {
    text-align: center;
    font-size: 12px;
    color: var(--smg-gray-500, #6b7280);
    padding: 0 8px;
}

.chatbot-modal__privacy-notice a {
    color: var(--smg-gray-500, #6b7280);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.chatbot-modal__privacy-notice a:hover {
    color: var(--smg-gray-700, #374151);
}

