/**
 * SpaceKi Chatbot CSS
 * Version 1.0.0
 *
 * Der Chatbot-Button wird links neben dem Scroll-to-Top-Button platziert.
 * Scroll-to-Top: bottom: 28px, right: 28px, width: 44px
 * Chatbot-Button: bottom: 28px, right: 28px + 44px + 10px = 82px
 */

/* ============================================================
   CHATBOT BUTTON
   ============================================================ */
.spaceki-chatbot-btn {
    position: fixed;
    bottom: 28px;
    right: 82px; /* Neben dem Scroll-to-Top Button */
    width: 44px;
    height: 44px;
    background: rgba(0, 170, 255, 0.15);
    border: 1.5px solid rgba(0, 170, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    padding: 0;
    color: #00aaff;
    -webkit-tap-highlight-color: transparent;
}

.spaceki-chatbot-btn:hover {
    background: rgba(0, 170, 255, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.3);
}

.spaceki-chatbot-btn:focus {
    outline: 2px solid rgba(0, 170, 255, 0.7);
    outline-offset: 3px;
}

/* ============================================================
   CHATBOT FENSTER
   ============================================================ */
.spaceki-chatbot-window {
    position: fixed;
    bottom: 82px;
    right: 28px;
    width: 340px;
    height: 480px;
    background: rgba(8, 8, 20, 0.97);
    border: 1.5px solid rgba(0, 170, 255, 0.4);
    border-radius: 16px;
    z-index: 8001;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 170, 255, 0.1);
    overflow: hidden;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================================
   CHATBOT HEADER
   ============================================================ */
.spaceki-chatbot-header {
    background: rgba(0, 170, 255, 0.1);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 170, 255, 0.2);
    flex-shrink: 0;
}

.spaceki-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spaceki-chatbot-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

/* Grüner Online-Punkt */
.spaceki-chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    display: inline-block;
    animation: sk-status-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes sk-status-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

#spaceki-chatbot-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

#spaceki-chatbot-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

#spaceki-chatbot-close:focus {
    outline: 2px solid rgba(0, 170, 255, 0.7);
    outline-offset: 2px;
}

/* ============================================================
   NACHRICHTEN-BEREICH
   ============================================================ */
.spaceki-chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 170, 255, 0.3) transparent;
}

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

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

.spaceki-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 170, 255, 0.3);
    border-radius: 2px;
}

/* Nachrichten-Blasen */
.chatbot-message {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
}

.bot-message {
    background: rgba(0, 170, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 170, 255, 0.15);
}

.bot-message a {
    color: #00aaff;
    text-decoration: underline;
}

.user-message {
    background: linear-gradient(135deg, #00aaff, #0077cc);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Tipp-Indikator */
.sk-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.sk-typing-dot {
    width: 7px;
    height: 7px;
    background: rgba(0, 170, 255, 0.6);
    border-radius: 50%;
    display: inline-block;
    animation: sk-typing-bounce 1.2s ease-in-out infinite;
}

.sk-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.sk-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* ============================================================
   EINGABE-BEREICH
   ============================================================ */
.spaceki-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(0, 170, 255, 0.15);
    background: rgba(8, 8, 20, 0.95);
    flex-shrink: 0;
}

#spaceki-chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 9px 16px;
    color: #fff;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

#spaceki-chatbot-input:focus {
    border-color: rgba(0, 170, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.15);
}

#spaceki-chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#spaceki-chatbot-send {
    background: rgba(0, 170, 255, 0.15);
    border: 1.5px solid rgba(0, 170, 255, 0.4);
    border-radius: 50%;
    color: #00aaff;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

#spaceki-chatbot-send:hover {
    background: rgba(0, 170, 255, 0.3);
    transform: scale(1.05);
}

#spaceki-chatbot-send:focus {
    outline: 2px solid rgba(0, 170, 255, 0.7);
    outline-offset: 2px;
}

#spaceki-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   RESPONSIVE - MOBILE
   ============================================================ */
@media (max-width: 480px) {
    .spaceki-chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        bottom: 76px; /* über den Buttons */
        height: 420px;
        border-radius: 12px;
    }

    /* Mobile: Chatbot-Button links neben Scroll-to-Top
       Scroll-to-Top: right: 20px, width: 40px
       Chatbot-Button: right: 20px + 40px + 8px = 68px */
    .spaceki-chatbot-btn {
        right: 68px;
        bottom: 20px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 360px) {
    .spaceki-chatbot-window {
        width: calc(100vw - 10px);
        right: 5px;
        left: 5px;
    }

    .spaceki-chatbot-btn {
        right: 64px;
        bottom: 18px;
        width: 38px;
        height: 38px;
    }
}

/* ============================================================
   BARRIEREFREIHEIT: Reduzierte Bewegung
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .spaceki-chatbot-btn,
    .spaceki-chatbot-window,
    .sk-typing-dot,
    .spaceki-chatbot-status-dot {
        animation: none !important;
        transition: none !important;
    }
}
