/* ============================================================
   Christian Community Bot – Chat Widget Styles
   ============================================================ */

:root {
    --ccbot-primary:          #5B6FA6;
    --ccbot-secondary:        #F0F4FF;
    --ccbot-btn-hover-bg:     #3d5080;
    --ccbot-btn-hover-text:   #ffffff;
    --ccbot-max-height:       70vh;
    --ccbot-radius:           16px;
    --ccbot-shadow:           0 8px 32px rgba(0,0,0,.18);
    --ccbot-font:             -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ccbot-anim:             .25s ease;
    --ccbot-z:                99999;
}

/* ── Widget Container ───────────────────────────────────────── */
.ccbot-widget {
    position: fixed;
    z-index: var(--ccbot-z);
    font-family: var(--ccbot-font);
    font-size: 14px;
    line-height: 1.5;
}
.ccbot-bottom-right { bottom: 24px; right: 24px; }
.ccbot-bottom-left  { bottom: 24px; left:  24px; }

/* ── Trigger Button ─────────────────────────────────────────── */
.ccbot-trigger {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--ccbot-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--ccbot-shadow);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    transition: transform var(--ccbot-anim), box-shadow var(--ccbot-anim);
    position: relative;
}
.ccbot-trigger:hover { transform: scale(1.08); box-shadow: 0 12px 36px rgba(0,0,0,.25); }
.ccbot-trigger:active { transform: scale(.96); }

.ccbot-notification-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 12px; height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: ccbot-pulse 2s infinite;
}
.ccbot-notification-dot.hidden { display: none; }
@keyframes ccbot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.2); opacity: .7; }
}

/* ── Chat Panel ─────────────────────────────────────────────── */
.ccbot-panel {
    position: fixed;
    width: 360px;
    max-height: min(var(--ccbot-max-height), calc(100vh - 108px));
    background: #fff;
    border-radius: var(--ccbot-radius);
    box-shadow: var(--ccbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom center;
    animation: ccbot-slideIn var(--ccbot-anim) forwards;
    bottom: 96px;
}
.ccbot-bottom-right .ccbot-panel { right: 24px; }
.ccbot-bottom-left  .ccbot-panel { left:  24px; }

/* ── Mobile: safe-area + eigene Höhe ───────────────────────── */
@media (max-width: 768px) {
    .ccbot-panel {
        max-height: min(var(--ccbot-max-height-mobile, var(--ccbot-max-height)), calc(100dvh - 108px - env(safe-area-inset-top, 0px)));
    }
    .ccbot-widget {
        z-index: 2147483647;
    }
}

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

@keyframes ccbot-slideIn {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ─────────────────────────────────────────────────── */
.ccbot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #fff;
    flex-shrink: 0;
}
.ccbot-header-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    overflow: hidden;
    flex-shrink: 0;
}
.ccbot-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.ccbot-avatar-icon { font-size: 18px; }

.ccbot-header-info { flex: 1; }
.ccbot-header-info strong { display: block; font-size: 15px; }
.ccbot-header-info small  { font-size: 11px; opacity: .85; }

.ccbot-header-reset,
.ccbot-header-close {
    background: none; border: none; color: #fff;
    cursor: pointer; opacity: .8; font-size: 16px;
    padding: 4px 6px; border-radius: 4px;
    transition: opacity var(--ccbot-anim), background var(--ccbot-anim);
}
.ccbot-header-reset:hover,
.ccbot-header-close:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* ── Privacy Notice ─────────────────────────────────────────── */
.ccbot-privacy {
    padding: 16px;
    background: #fffbea;
    border-bottom: 1px solid #f0e060;
    flex-shrink: 0;
}
.ccbot-privacy p { margin: 0 0 10px; font-size: 12px; color: #555; }
.ccbot-privacy[hidden] { display: none; }

/* ── Messages ───────────────────────────────────────────────── */
.ccbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.ccbot-messages::-webkit-scrollbar { width: 4px; }
.ccbot-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Message bubbles */
.ccbot-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: ccbot-fadeIn .2s ease;
}
@keyframes ccbot-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ccbot-msg-bot  { align-self: flex-start; }
.ccbot-msg-user { align-self: flex-end; flex-direction: row-reverse; }

.ccbot-msg-avatar-sm {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--ccbot-primary);
    color: #fff; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
}
.ccbot-msg-avatar-wrap {
    width: 28px; height: 28px;
    flex-shrink: 0; margin-top: 2px;
}
.ccbot-msg-avatar-img {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.ccbot-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.55;
    word-break: break-word;
}
.ccbot-msg-bot  .ccbot-bubble { background: var(--ccbot-secondary); color: #222; border-bottom-left-radius: 4px; }
.ccbot-msg-user .ccbot-bubble { background: var(--ccbot-primary);   color: #fff; border-bottom-right-radius: 4px; }

/* Links in bot messages */
.ccbot-bubble a { color: inherit; text-decoration: underline; }
.ccbot-msg-user .ccbot-bubble a { color: rgba(255,255,255,.9); }

/* Typing indicator */
.ccbot-typing .ccbot-bubble {
    display: flex; gap: 4px; align-items: center;
    padding: 12px 14px;
}
.ccbot-dot {
    width: 7px; height: 7px;
    background: #999; border-radius: 50%;
    animation: ccbot-bounce .9s infinite;
}
.ccbot-dot:nth-child(2) { animation-delay: .15s; }
.ccbot-dot:nth-child(3) { animation-delay: .30s; }
@keyframes ccbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}

/* ── Suggestions ────────────────────────────────────────────── */
.ccbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.ccbot-suggestions[hidden] { display: none; }

.ccbot-suggestion-btn {
    padding: 5px 12px;
    border: 1px solid var(--ccbot-primary);
    border-radius: 20px;
    background: #fff;
    color: var(--ccbot-primary);
    cursor: pointer; font-size: 12px;
    transition: all var(--ccbot-anim);
    white-space: nowrap;
}
.ccbot-suggestion-btn:hover {
    background: var(--ccbot-btn-hover-bg);
    border-color: var(--ccbot-btn-hover-bg);
    color: var(--ccbot-btn-hover-text);
}

/* ── Input Area ─────────────────────────────────────────────── */
.ccbot-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    align-items: flex-end;
}

.ccbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 9px 12px;
    font-family: var(--ccbot-font);
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 100px;
    transition: border-color var(--ccbot-anim);
    line-height: 1.4;
}
.ccbot-input:focus { border-color: var(--ccbot-primary); }

.ccbot-send-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--ccbot-primary);
    color: #fff; border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--ccbot-anim), transform var(--ccbot-anim);
    flex-shrink: 0;
}
.ccbot-send-btn:hover   { filter: brightness(1.1); }
.ccbot-send-btn:active  { transform: scale(.93); }
.ccbot-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Footer Note ────────────────────────────────────────────── */
.ccbot-footer-note {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    padding: 4px 0 8px;
}
.ccbot-footer-note a { color: #bbb; }

/* ── Shared Button ──────────────────────────────────────────── */
.ccbot-btn-primary {
    padding: 8px 18px;
    background: var(--ccbot-primary);
    color: #fff; border: none; border-radius: 8px;
    cursor: pointer; font-size: 13px;
    transition: filter var(--ccbot-anim);
}
.ccbot-btn-primary:hover { filter: brightness(1.1); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 420px) {
    .ccbot-panel { width: calc(100vw - 32px); left: 16px !important; right: 16px !important; }
    .ccbot-bottom-right { right: 12px; bottom: 16px; }
    .ccbot-bottom-left  { left:  12px; bottom: 16px; }
}

/* ── v1.1.0: Verlauf-Wiederherstellungs-Hinweis ───────────────────────────── */
.ccbot-history-hint {
    text-align: center;
    font-size: 11px;
    color: #bbb;
    padding: 4px 0 8px;
    font-style: italic;
}

/* ── v1.4.0: Begrüßungs-Popup ───────────────────────────────── */
.ccbot-greeting-popup {
    position: fixed;
    bottom: 96px;
    width: 280px;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--ccbot-shadow);
    padding: 14px 16px 12px;
    animation: ccbot-slideIn var(--ccbot-anim) forwards;
    z-index: var(--ccbot-z);
}
.ccbot-bottom-right .ccbot-greeting-popup { right: 24px; }
.ccbot-bottom-left  .ccbot-greeting-popup { left:  24px; }

.ccbot-greeting-popup[hidden] { display: none; }

/* Kleines Dreieck nach unten zum Trigger */
.ccbot-greeting-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 16px; height: 16px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 6px rgba(0,0,0,.08);
}
.ccbot-bottom-right .ccbot-greeting-popup::after { right: 28px; }
.ccbot-bottom-left  .ccbot-greeting-popup::after { left:  28px; }

.ccbot-greeting-close {
    position: absolute; top: 8px; right: 10px;
    background: none; border: none;
    color: #aaa; cursor: pointer; font-size: 13px; line-height: 1;
    padding: 2px 4px;
}
.ccbot-greeting-close:hover { color: #555; }

.ccbot-greeting-popup p {
    margin: 0 20px 10px 0;
    font-size: 13px; line-height: 1.5; color: #333;
}

.ccbot-greeting-cta {
    display: block; width: 100%;
    padding: 8px 0;
    background: var(--ccbot-primary);
    color: #fff; border: none; border-radius: 8px;
    cursor: pointer; font-size: 13px; font-weight: 600;
    transition: filter var(--ccbot-anim);
}
.ccbot-greeting-cta:hover { filter: brightness(1.1); }

/* ── v1.4.0: Font Awesome Trigger-Icon ──────────────────────── */
.ccbot-trigger-icon i,
.ccbot-trigger-close i {
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 420px) {
    .ccbot-greeting-popup { width: calc(100vw - 48px); }
    .ccbot-bottom-right .ccbot-greeting-popup { right: 12px; }
    .ccbot-bottom-left  .ccbot-greeting-popup { left:  12px; }
}

/* ── Newsletter-Formular im Chat (v1.8.0) ────────────────────────────────── */
.ccbot-nl-form {
    background: var(--ccbot-secondary, #F0F4FF);
    border-radius: 12px 12px 12px 2px;
    padding: 14px 16px;
    margin: 4px 0 4px 36px;
    max-width: 88%;
}
.ccbot-nl-title {
    font-weight: 600;
    margin: 0 0 10px;
    font-size: 14px;
    color: #1d2327;
}
.ccbot-nl-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.ccbot-nl-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d5e8;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s;
}
.ccbot-nl-input:focus {
    outline: none;
    border-color: var(--ccbot-primary, #5B6FA6);
}
.ccbot-nl-submit {
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    background: var(--ccbot-primary, #5B6FA6);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.ccbot-nl-submit:hover { opacity: .88; }
.ccbot-nl-submit:disabled { opacity: .6; cursor: not-allowed; }
.ccbot-nl-status {
    font-size: 12px;
    margin: 6px 0 0;
    min-height: 16px;
    color: #2d6a2d;
}
.ccbot-nl-status.error { color: #c0392b; }

/* ── Newsletter Inline-Button in Chat-Bubble (v1.8.9) ───────────────────── */
.ccbot-nl-inline-btn-wrap {
    text-align: center;
    margin: 10px 0 4px;
}
.ccbot-nl-inline-btn {
    display: inline-block;
    background: var(--ccbot-primary, #5B6FA6);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    font-family: inherit;
}
.ccbot-nl-inline-btn:hover {
    opacity: .88;
    transform: translateY(-1px);
}
