/* =========================================================================
   OpenAI Site KI Chat – Vollständige, geprüfte style.css
   Mit funktionierendem Dark Mode (Theme-unabhängig!)
   ========================================================================= */

/* ---------------------------------------------------------
   Haupt-Widget (Position am Bildschirm)
--------------------------------------------------------- */
#osc-ki-widget {
    position: fixed;
    bottom: 20px;
    z-index: 9999999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

/* Links oder rechts */
.osc-pos-left {
    left: 20px;
    right: auto;
}
.osc-pos-right {
    right: 20px;
    left: auto;
}

/* ---------------------------------------------------------
   Floating Bubble
--------------------------------------------------------- */
#osc-ki-bubble {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: #2271b1;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    transition: transform 0.15s ease;
    position: relative;
}
#osc-ki-bubble:hover {
    transform: translateY(-3px);
}

/* Badge (ungelesene Nachrichten) */
.osc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e11d48;
    color: #fff;
    font-size: 11px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: none;
    border-radius: 999px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
}

/* ---------------------------------------------------------
   Chat Panel
--------------------------------------------------------- */
#osc-ki-panel {
    position: absolute;
    bottom: 90px;
    width: 320px;
    max-height: 500px;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    display: none;
}

/* Panel geöffnet */
#osc-ki-panel.osc-open {
    display: flex;
    flex-direction: column;
}

/* rechts/links */
.osc-pos-left #osc-ki-panel {
    left: 0;
}
.osc-pos-right #osc-ki-panel {
    right: 0;
}

/* ---------------------------------------------------------
   Header
--------------------------------------------------------- */
#osc-ki-header {
    height: 45px;
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2271b1;
    color: #fff;
}

#osc-ki-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

#osc-ki-header-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

#osc-ki-header-close {
    font-size: 22px;
    cursor: pointer;
    user-select: none;
}

/* ---------------------------------------------------------
   Nachrichtenbereich
--------------------------------------------------------- */
#osc-ki-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: #f4f4f4;
}

.osc-msg {
    margin-bottom: 6px;
    display: flex;
}

.osc-msg-user {
    justify-content: flex-end;
}

.osc-msg-ki {
    justify-content: flex-start;
}

/* ---------------------------------------------------------
   Bubbles (KI & USER)
--------------------------------------------------------- */
.osc-bubble {
    max-width: 80%;
    padding: 9px 12px;
    border-radius: 16px;
    font-size: 13px;
    word-break: break-word;
}

.osc-bubble-user {
    background: #2271b1;
    color: white;
}

.osc-bubble-ki {
    background: #ffffff;
    color: #111;
    border: 1px solid rgba(0,0,0,0.15);
}

.osc-bubble-main strong {
    display: inline-block;
    margin-bottom: 4px;
}

/* Links */
.osc-link {
    color: #0047ff;
    text-decoration: underline;
}

/* Read receipt */
.osc-meta {
    font-size: 11px;
    margin-top: 4px;
    color: #666;
}

/* ---------------------------------------------------------
   Tipp-Animation (KI tippt…)
--------------------------------------------------------- */
.osc-typing {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.osc-typing span {
    width: 7px;
    height: 7px;
    background: #555;
    border-radius: 999px;
    animation: osc-bounce 1.4s infinite ease-in-out;
}
.osc-typing span:nth-child(2) { animation-delay: 0.15s; }
.osc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes osc-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* ---------------------------------------------------------
   Footer / Eingabe
--------------------------------------------------------- */
#osc-ki-footer {
    background: #ffffff;
    padding: 8px;
    border-top: 1px solid #e3e3e3;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
}

#osc-ki-input {
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid #ccc;
}

#osc-ki-send {
    background: #2271b1;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
}

/* ---------------------------------------------------------
   Datenschutz Modal
--------------------------------------------------------- */
#osc-ki-privacy-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999999;
}

#osc-ki-privacy-modal.osc-show {
    display: flex;
}

#osc-ki-privacy-content {
    background: white;
    padding: 16px;
    border-radius: 12px;
    width: 280px;
    text-align: center;
}

#osc-ki-privacy-close {
    background: #2271b1;
    color: white;
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
}

/* ---------------------------------------------------------
   DARK MODE (voll funktionsfähig – mit !important)
--------------------------------------------------------- */
#osc-ki-widget[data-theme="dark"] #osc-ki-panel {
    background: #111 !important;
    color: #eee !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-messages {
    background: #000 !important;
}

#osc-ki-widget[data-theme="dark"] .osc-bubble-ki {
    background: #1a1a1a !important;
    color: #eee !important;
    border-color: #333 !important;
}

#osc-ki-widget[data-theme="dark"] .osc-bubble-user {
    background: #1e40af !important;
    color: #fff !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-footer {
    background: #111 !important;
    border-color: #333 !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-input {
    background: #222 !important;
    color: #eee !important;
    border-color: #444 !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-send {
    background: #1e40af !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-btn {
    background: #333 !important;
    border-color: #555 !important;
    color: #eee !important;
}

#osc-ki-widget[data-theme="dark"] .osc-typing span {
    background: #eee !important;
}

#osc-ki-widget[data-theme="dark"] .osc-link {
    color: #38bdf8 !important;
}

#osc-ki-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#osc-ki-privacy-btn-header {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    color: #fff;
    transition: background 0.2s;
}

#osc-ki-privacy-btn-header:hover {
    background: rgba(255,255,255,0.5);
}

/* Dark Mode */
#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-btn-header {
    background: rgba(255,255,255,0.12) !important;
    border-color: rgba(255,255,255,0.3) !important;
    color: #eee !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-btn-header:hover {
    background: rgba(255,255,255,0.25) !important;
}
#osc-ki-privacy-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999999;
}

#osc-ki-privacy-modal.osc-show {
    display: flex;
}

#osc-ki-privacy-content {
    background: #fff;
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 18px 20px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

#osc-ki-privacy-content h3 {
    margin-top: 0;
    font-size: 18px;
    text-align: center;
}

#osc-ki-privacy-content ul {
    padding-left: 18px;
    margin-top: 6px;
}

#osc-ki-privacy-content li {
    font-size: 13px;
    margin-bottom: 4px;
    line-height: 1.35;
}

#osc-ki-privacy-content p {
    margin-bottom: 12px;
    line-height: 1.45;
    font-size: 14px;
}

#osc-ki-privacy-close {
    background: #2271b1;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    margin: 10px auto 0;
    display: block;
}
/* DARK MODE – Vollständig für Datenschutz-Modal */
#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-modal {
    background: rgba(0,0,0,0.65) !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-content {
    background: #111 !important;
    color: #eee !important;
    border: 1px solid #333 !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-content h3 {
    color: #fff !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-content p {
    color: #ccc !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-content ul {
    color: #ccc !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-content li {
    color: #ccc !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-close {
    background: #1e40af !important;
    color: #fff !important;
}

#osc-ki-widget[data-theme="dark"] #osc-ki-privacy-content strong {
    color: #fff !important;
}
#osc-ki-privacy-content ul {
    list-style: disc !important;
    padding-left: 22px !important;
    margin: 10px 0 !important;
}

#osc-ki-privacy-content li {
    list-style: disc !important;
    margin-bottom: 6px !important;
    font-size: 14px;
    line-height: 1.4;
}
