/* =============================================
   YOKI Chat-Widget Styles
   Primärfarbe: #de6800 (YOGA AKTUELL Orange)
   ============================================= */

/* === Chat Bubble (Floating Button) === */
.yoki-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #de6800;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(222, 104, 0, 0.4);
    z-index: 999998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.yoki-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(222, 104, 0, 0.5);
}

.yoki-bubble img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.yoki-bubble-close {
    display: none;
    font-size: 28px;
    color: white;
    line-height: 1;
}

.yoki-bubble.open .yoki-bubble-close {
    display: block;
}

.yoki-bubble.open img {
    display: none;
}

/* === Teaser === */
.yoki-teaser {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    cursor: pointer;
    z-index: 999997;
    max-width: 300px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.yoki-teaser.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.yoki-teaser-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.yoki-teaser-content img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.yoki-teaser-text strong {
    display: block;
    color: #333;
    font-size: 15px;
    margin-bottom: 2px;
}

.yoki-teaser-text span {
    color: #666;
    font-size: 13px;
}

.yoki-teaser-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.yoki-teaser-close:hover {
    color: #333;
}

.yoki-teaser-pulse {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #de6800;
    border-radius: 50%;
    animation: yokiPulse 2s infinite;
}

@keyframes yokiPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

/* === Chat Window === */
.yoki-chat {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 750px;
    max-height: calc(100vh - 110px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.yoki-chat.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Maximierter Modus (nur Desktop) */
.yoki-chat.yoki-maximized {
    width: 700px;
    height: calc(100vh - 120px);
    max-height: none;
    bottom: 20px;
    right: 20px;
    transition: transform 0.25s ease, opacity 0.25s ease,
                width 0.3s ease, height 0.3s ease, bottom 0.3s ease;
}

/* === Header === */
.yoki-header {
    background: #de6800;
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.yoki-header img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.yoki-header-info {
    flex: 1;
}

.yoki-header-name {
    font-weight: 700;
    font-size: 16px;
}

.yoki-header-status {
    font-size: 12px;
    opacity: 0.85;
}

.yoki-header-maximize,
.yoki-header-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.yoki-header-maximize:hover,
.yoki-header-close:hover {
    opacity: 1;
}

.yoki-header-maximize {
    font-size: 17px;
    margin-right: 4px;
}

/* === Messages Area === */
.yoki-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f3ef;
}

.yoki-messages::-webkit-scrollbar {
    width: 5px;
}

.yoki-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* === Message Bubbles === */
.yoki-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.yoki-msg-bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.yoki-msg-user {
    background: #de6800;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.yoki-msg-user a {
    color: #ffe0c0;
}

/* === Markdown in Bot Messages === */
.yoki-msg-bot p {
    margin: 0 0 8px 0;
}

.yoki-msg-bot p:last-child {
    margin-bottom: 0;
}

.yoki-msg-bot strong {
    font-weight: 700;
}

.yoki-msg-bot em {
    font-style: italic;
}

.yoki-msg-bot a {
    color: #de6800;
    text-decoration: underline;
}

.yoki-msg-bot a:hover {
    color: #b35500;
}

.yoki-msg-bot ul,
.yoki-msg-bot ol {
    margin: 4px 0 8px 0;
    padding-left: 20px;
}

.yoki-msg-bot li {
    margin-bottom: 2px;
}

.yoki-msg-bot blockquote {
    border-left: 3px solid #de6800;
    margin: 6px 0;
    padding: 4px 10px;
    color: #555;
    background: #fdf5ee;
    border-radius: 0 6px 6px 0;
}

.yoki-msg-bot code {
    background: #f0ebe5;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 13px;
}

/* === Typing Indicator === */
.yoki-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.yoki-typing-dot {
    width: 7px;
    height: 7px;
    background: #bbb;
    border-radius: 50%;
    animation: yokiTyping 1.2s infinite;
}

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

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

/* === Input Area === */
.yoki-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: white;
    flex-shrink: 0;
}

.yoki-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 20px;
    line-height: 1.4;
    outline: none;
    font-family: inherit;
    overflow-y: auto;
}

.yoki-input:focus {
    border-color: #de6800;
}

.yoki-input::placeholder {
    color: #aaa;
}

.yoki-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #de6800;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.yoki-send:hover {
    background: #c25d00;
}

.yoki-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* === Login Form (inline in chat) === */
.yoki-login-card {
    background: white;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 16px;
    align-self: flex-start;
    max-width: 90%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.yoki-login-card h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
}

.yoki-login-field {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    box-sizing: border-box;
    font-family: inherit;
}

.yoki-login-field:focus {
    border-color: #de6800;
    outline: none;
}

.yoki-login-pw-wrap {
    position: relative;
}

.yoki-login-pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    padding: 0;
    margin-top: -4px;
}

.yoki-login-btn {
    width: 100%;
    padding: 10px;
    background: #de6800;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s;
}

.yoki-login-btn:hover {
    background: #c25d00;
}

.yoki-login-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.yoki-login-error {
    color: #cc0000;
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

.yoki-login-links {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.yoki-login-links a {
    color: #de6800;
    text-decoration: none;
}

.yoki-login-links a:hover {
    text-decoration: underline;
}

.yoki-skip-login {
    display: block;
    text-align: center;
    margin-top: 8px;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    font-family: inherit;
}

.yoki-skip-login:hover {
    color: #666;
}

/* === Member Badge === */
.yoki-member-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 6px;
}

/* === Mobile Responsive === */
/* Tablets und kleine Desktops */
@media (max-width: 768px) {
    .yoki-chat,
    .yoki-chat.yoki-maximized {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Maximieren-Button auf Mobile ausblenden (ist bereits Vollbild) */
    .yoki-header-maximize {
        display: none;
    }

    /* Font-size >= 16px verhindert iOS Safari Auto-Zoom beim Fokussieren */
    .yoki-input {
        font-size: 16px;
    }

    .yoki-login-field {
        font-size: 16px;
    }

    .yoki-bubble {
        bottom: 16px;
        right: 16px;
    }

    .yoki-teaser {
        bottom: 86px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* Kleine Smartphones (iPhone SE etc.) */
@media (max-width: 380px) {
    .yoki-bubble {
        width: 52px;
        height: 52px;
        bottom: 12px;
        right: 12px;
    }

    .yoki-bubble img {
        width: 38px;
        height: 38px;
    }

    .yoki-header {
        padding: 12px 14px;
    }

    .yoki-messages {
        padding: 12px;
    }

    .yoki-input-area {
        padding: 10px 12px;
    }
}

/* === Welcome Login Button === */
.yoki-welcome-login-btn {
    background: #de6800;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
    font-family: inherit;
}

.yoki-welcome-login-btn:hover {
    background: #c25d00;
}

/* === Inline Login Link (in Bot-Nachrichten) === */
.yoki-inline-login-btn {
    background: none;
    border: none;
    color: #de6800;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
}

/* === Hidden utility === */
.yoki-hidden {
    display: none !important;
}
