/*
 * ai-chat-public.css — Metrics Tools Public Chat (Landing Page)
 * Branch: public_chat
 *
 * Gleiche Optik wie ai-chat.css, aber:
 * - Kein .page-container / .footer push (kein Metronic-Layout)
 * - Panel als Overlay (kein Content-Verschieben)
 * - Kein Onboarding-Modal, kein Context-Bar, kein Mode-Toggle
 * - DSGVO-Hinweis im Input-Bereich
 *
 * Zum Löschen: diese Datei + ai_chat_public.php (View) + Public_chat.php (Controller)
 * und den Load-Call in homepage.php entfernen.
 */

/* ── FAB: Floating Action Button ────────────────────────────── */
#ai-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #f97316;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(249,115,22,.45), 0 1px 4px rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .15s, box-shadow .2s, opacity .2s;
    outline: none;
    padding: 0;
}
#ai-chat-fab:hover {
    background: #ea6c0b;
    transform: scale(1.07);
    box-shadow: 0 4px 18px rgba(249,115,22,.55), 0 2px 6px rgba(0,0,0,.2);
}
#ai-chat-fab:active { transform: scale(.95); }
body.ai-chat-open #ai-chat-fab {
    opacity: 0;
    pointer-events: none;
    transform: scale(.8);
}
#ai-chat-fab svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}
/* Unread-Badge */
#ai-chat-fab .ai-fab-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 1px solid #fff;
}
#ai-chat-fab.has-unread .ai-fab-badge { display: block; }

/* ── Panel (Overlay, kein Content-Push) ──────────────────────── */
#ai-chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    z-index: 8999;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -4px 0 24px rgba(0,0,0,.10);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #374151;
}
#ai-chat-panel.open { transform: translateX(0); }

/* Mobil: Panel geht über volle Breite */
@media (max-width: 480px) {
    #ai-chat-panel { width: 100%; }
}

/* ── Header ──────────────────────────────────────────────────── */
#ai-chat-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 54px;
    background: #fff;
    border-bottom: 1px solid #f3f4f6;
    border-top: 3px solid #f97316;
}
.ai-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
}
.ai-header-left svg {
    width: 20px;
    height: 20px;
    fill: #f97316;
    flex-shrink: 0;
}
.ai-chat-title-text {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    letter-spacing: .01em;
}
.ai-chat-subtitle {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}
.ai-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d1d5db;
    transition: background .4s;
    flex-shrink: 0;
}
.ai-status-dot.online  { background: #22c55e; }
.ai-status-dot.thinking { background: #f97316; animation: ai-pub-dot-pulse 1s infinite; }
@keyframes ai-pub-dot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}
#ai-chat-new {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px 7px;
    display: flex;
    align-items: center;
    transition: color .15s, border-color .15s, background .15s;
    outline: none;
}
#ai-chat-new:hover {
    color: #f97316;
    border-color: #f97316;
    background: #fff7ed;
}
#ai-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 5px 6px;
    border-radius: 6px;
    line-height: 1;
    transition: color .15s, background .15s;
    outline: none;
    display: flex;
    align-items: center;
    margin-left: 2px;
}
#ai-chat-close:hover {
    color: #374151;
    background: #f3f4f6;
}

/* ── Messages ────────────────────────────────────────────────── */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: #fafafa;
}
#ai-chat-messages::-webkit-scrollbar { width: 4px; }
#ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
#ai-chat-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
#ai-chat-messages::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

/* Welcome */
#ai-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 36px 20px 20px;
    color: #9ca3af;
}
#ai-chat-welcome .ai-welcome-icon {
    width: 52px;
    height: 52px;
    background: #fff7ed;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#ai-chat-welcome .ai-welcome-icon svg {
    width: 26px;
    height: 26px;
    fill: #f97316;
}
#ai-chat-welcome h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}
#ai-chat-welcome p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #6b7280;
}
#ai-chat-welcome.hidden { display: none; }

/* Suggestion Chips */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 4px;
}
.ai-suggestion-chip {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 5px 12px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
}
.ai-suggestion-chip:hover {
    border-color: #f97316;
    color: #f97316;
    background: #fff7ed;
    box-shadow: 0 1px 4px rgba(249,115,22,.15);
}

/* Bubbles */
.ai-msg {
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: ai-pub-msg-in .16s ease;
}
@keyframes ai-pub-msg-in {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-msg-user { align-items: flex-end; }
.ai-msg-bot  { align-items: flex-start; }
.ai-msg-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    max-width: 90%;
}
.ai-msg-user .ai-msg-bubble {
    background: #f97316;
    color: #fff;
    border-bottom-right-radius: 3px;
}
.ai-msg-bot .ai-msg-bubble {
    background: #fff;
    color: #374151;
    border-bottom-left-radius: 3px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

/* Thinking Dots */
.ai-msg-thinking .ai-msg-bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.ai-thinking-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 18px;
}
.ai-thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d1d5db;
    animation: ai-pub-dot-bounce .9s infinite ease-in-out;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: .15s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-pub-dot-bounce {
    0%, 80%, 100% { transform: translateY(0); background: #d1d5db; }
    40%           { transform: translateY(-5px); background: #f97316; }
}

/* ── Input Area ──────────────────────────────────────────────── */
#ai-chat-input-area {
    flex-shrink: 0;
    padding: 10px 12px 10px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
}
.ai-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
#ai-chat-input {
    flex: 1;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 9px 12px;
    color: #374151;
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.45;
    transition: border-color .15s, background .15s;
    box-sizing: border-box;
}
#ai-chat-input::placeholder { color: #9ca3af; }
#ai-chat-input:focus {
    border-color: #f97316;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}
#ai-chat-send {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: #f97316;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .1s, box-shadow .15s;
    outline: none;
    padding: 0;
}
#ai-chat-send:hover {
    background: #ea6c0b;
    box-shadow: 0 2px 8px rgba(249,115,22,.35);
}
#ai-chat-send:active { transform: scale(.92); }
#ai-chat-send:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
    box-shadow: none;
}
#ai-chat-send svg { width: 17px; height: 17px; fill: #fff; }
#ai-chat-send:disabled svg { fill: #9ca3af; }
.ai-input-hint {
    font-size: 11px;
    color: #d1d5db;
    margin-top: 4px;
    text-align: right;
}

/* DSGVO-Hinweis */
.ai-dsgvo-hint {
    font-size: 10px;
    color: #c4c8d0;
    margin-top: 6px;
    line-height: 1.4;
    text-align: center;
    padding: 0 2px;
}
.ai-dsgvo-hint a {
    color: #c4c8d0;
    text-decoration: underline;
}
.ai-dsgvo-hint a:hover { color: #9ca3af; }

/* ── JS-Tooltip (body-level, overflow-safe) ──────────────────── */
#ai-tooltip {
    position: fixed;
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    opacity: 0;
    transition: opacity .12s ease;
}
#ai-tooltip.visible { opacity: 1; }

/* ── Feedback-Button (Thumbs Down unter Bot-Bubbles) ─────────── */
.ai-msg-feedback {
    display: flex;
    align-items: center;
    padding-left: 2px;
    margin-top: 2px;
}
.ai-feedback-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 5px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color .15s, background .15s;
    outline: none;
    font-size: 10px;
    font-family: inherit;
    line-height: 1;
}
.ai-feedback-btn:hover {
    color: #6b7280;
    background: #f3f4f6;
}
.ai-feedback-btn.sent {
    color: #ef4444;
    cursor: default;
}
.ai-feedback-btn.sent:hover {
    background: none;
    color: #ef4444;
}
.ai-feedback-btn.sending {
    opacity: .5;
    cursor: wait;
}
