/**
 * FastPress Bot v2 — Widget Styles
 */

#fp-bot-root {
    --fp-bot-primary:        #d13165;
    --fp-bot-primary-hover:  #b22755;
    --fp-bot-accent:         #10b981;
    --fp-bot-bg:             #ffffff;
    --fp-bot-bg-alt:         #f5f5f5;
    --fp-bot-text:           #1d324d;
    --fp-bot-text-muted:     #6b7280;
    --fp-bot-border:         #e5e7eb;
    --fp-bot-user-bg:        #1d324d;
    --fp-bot-user-text:      #ffffff;
    --fp-bot-assistant-bg:   #f3f4f6;
    --fp-bot-assistant-text: #1d324d;
    --fp-bot-warning-bg:     #fef3c7;
    --fp-bot-warning-text:   #92400e;
    --fp-bot-error-bg:       #fee2e2;
    --fp-bot-error-text:     #991b1b;
    --fp-bot-radius:         14px;
    --fp-bot-shadow:         0 10px 40px rgba(0, 0, 0, 0.18);
    --fp-bot-font:           -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------- */
/*  Toggle + Panel                                                  */
/* ---------------------------------------------------------------- */

.fp-bot-toggle {
    position: fixed; right: 24px; bottom: 24px;
    width: 56px; height: 56px; border: 0; border-radius: 50%;
    background: var(--fp-bot-primary); color: #fff;
    cursor: pointer; box-shadow: var(--fp-bot-shadow);
    display: flex; align-items: center; justify-content: center;
    z-index: 9998; transition: transform .15s ease, background .15s ease;
}
.fp-bot-toggle:hover { background: var(--fp-bot-primary-hover); transform: translateY(-2px); }

.fp-bot-panel {
    position: fixed; right: 24px; bottom: 24px;
    width: 380px; max-width: calc(100vw - 32px);
    height: 600px; max-height: calc(100vh - 48px);
    background: var(--fp-bot-bg); border-radius: var(--fp-bot-radius);
    box-shadow: var(--fp-bot-shadow);
    display: flex; flex-direction: column; overflow: hidden;
    font-family: inherit; color: var(--fp-bot-text);
    z-index: 9999;
}
.fp-bot-panel[hidden] { display: none !important; }

/* ---------------------------------------------------------------- */
/*  Header                                                          */
/* ---------------------------------------------------------------- */

.fp-bot-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: #1d324d; color: #fff;
}
.fp-bot-title {
    font-size: 15px; font-weight: 600; line-height: 1.2;
    display: flex; align-items: center; gap: 8px;
}
.fp-bot-badge {
    background: rgba(255,255,255,.22);
    font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
    letter-spacing: .5px; text-transform: uppercase;
}
.fp-bot-subtitle { font-size: 12px; opacity: .85; margin-top: 2px; }
.fp-bot-close {
    background: transparent; border: 0; color: #fff;
    font-size: 24px; line-height: 1; cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
    transition: background .15s ease;
}
.fp-bot-close:hover { background: rgba(255,255,255,.15); }

/* ---------------------------------------------------------------- */
/*  Messages                                                        */
/* ---------------------------------------------------------------- */

.fp-bot-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    background: var(--fp-bot-bg-alt);
}
.fp-bot-bubble {
    max-width: 85%; padding: 10px 13px; border-radius: 14px;
    font-size: 14px; font-weight: 400; line-height: 1.45; word-wrap: break-word;
}
.fp-bot-bubble--user {
    align-self: flex-end;
    background: var(--fp-bot-user-bg); color: var(--fp-bot-user-text);
    border-bottom-right-radius: 4px;
}
.fp-bot-bubble--assistant {
    align-self: flex-start;
    background: var(--fp-bot-assistant-bg); color: var(--fp-bot-assistant-text);
    border-bottom-left-radius: 4px;
    position: relative;
}
.fp-bot-bubble-meta {
    display: inline-block;
    font-size: 9px; font-weight: 700;
    letter-spacing: .5px; text-transform: uppercase;
    background: var(--fp-bot-primary); color: #fff;
    padding: 1px 5px; border-radius: 3px;
    margin-right: 6px; vertical-align: middle;
}
.fp-bot-bubble a { color: inherit; text-decoration: underline; }
.fp-bot-bubble ul { margin: 6px 0 4px 18px; padding: 0; }
.fp-bot-bubble li { margin-bottom: 2px; }
.fp-bot-bubble li:last-child { margin-bottom: 0; }

.fp-bot-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.fp-bot-typing span {
    width: 7px; height: 7px; background: var(--fp-bot-text-muted);
    border-radius: 50%; animation: fp-bot-bounce 1.2s infinite ease-in-out;
}
.fp-bot-typing span:nth-child(2) { animation-delay: .15s; }
.fp-bot-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes fp-bot-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: .4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ---------------------------------------------------------------- */
/*  Support-Button (immer sichtbar)                                 */
/* ---------------------------------------------------------------- */

.fp-bot-support-row {
    padding: 8px 12px;
    background: var(--fp-bot-bg);
    border-top: 1px solid var(--fp-bot-border);
}
.fp-bot-support {
    width: 100%; padding: 9px 12px;
    background: var(--fp-bot-bg-alt); color: var(--fp-bot-text);
    border: 1px dashed var(--fp-bot-border); border-radius: 8px;
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.fp-bot-support:hover {
    background: #fff; border-color: var(--fp-bot-primary);
    color: var(--fp-bot-primary-hover);
}

/* ---------------------------------------------------------------- */
/*  Chat-Form                                                       */
/* ---------------------------------------------------------------- */

.fp-bot-form {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 12px; border-top: 1px solid var(--fp-bot-border);
    background: var(--fp-bot-bg);
}
.fp-bot-input {
    flex: 1; border: 1px solid var(--fp-bot-border);
    border-radius: 10px; padding: 10px 12px;
    font-family: inherit; font-size: 14px; line-height: 1.4;
    resize: none; outline: none;
    color: var(--fp-bot-text); background: var(--fp-bot-bg);
    transition: border-color .15s ease;
    min-height: 40px; max-height: 120px;
}
.fp-bot-input:focus { border-color: var(--fp-bot-primary); }
.fp-bot-send {
    flex-shrink: 0; width: 40px; height: 40px;
    border: 0; border-radius: 10px;
    background: var(--fp-bot-primary); color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s ease, opacity .15s ease;
}
.fp-bot-send:hover:not(:disabled) { background: var(--fp-bot-primary-hover); }
.fp-bot-send:disabled { opacity: .5; cursor: wait; }

/* ---------------------------------------------------------------- */
/*  Datenschutz-Hinweis (unter Eingabefeld)                         */
/* ---------------------------------------------------------------- */

.fp-bot-privacy {
    padding: 6px 12px 4px;
    background: var(--fp-bot-bg);
    font-size: 11px;
    line-height: 1.35;
    color: var(--fp-bot-text-muted);
    text-align: center;
}
.fp-bot-privacy a {
    color: var(--fp-bot-text-muted);
    text-decoration: underline;
    font-weight: 500;
}
.fp-bot-privacy a:hover {
    color: #1d324d;
}

/* ---------------------------------------------------------------- */
/*  Footer (Branding)                                               */
/* ---------------------------------------------------------------- */

.fp-bot-footer {
    padding: 8px 12px;
    background: var(--fp-bot-bg);
    border-top: 1px solid var(--fp-bot-border);
    text-align: center;
    font-size: 11px;
    color: var(--fp-bot-text-muted);
    line-height: 1.4;
}
.fp-bot-footer a {
    color: var(--fp-bot-text-muted);
    text-decoration: none;
    font-weight: 500;
}
.fp-bot-footer a:hover {
    color: #1d324d;
    text-decoration: underline;
}

/* ---------------------------------------------------------------- */
/*  Modal (Ticket-Formular)                                         */
/* ---------------------------------------------------------------- */

.fp-bot-modal {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    font-family: inherit;
}
.fp-bot-modal[hidden] { display: none !important; }
.fp-bot-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
}
.fp-bot-modal-dialog {
    position: relative;
    width: 100%; max-width: 480px; max-height: 90vh;
    background: var(--fp-bot-bg); color: var(--fp-bot-text);
    border-radius: 16px; box-shadow: var(--fp-bot-shadow);
    display: flex; flex-direction: column; overflow: hidden;
}
.fp-bot-modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--fp-bot-border);
}
.fp-bot-modal-title {
    font-size: 16px; font-weight: 600;
}
.fp-bot-modal-intro {
    font-size: 13px; color: var(--fp-bot-text-muted);
    margin-top: 4px;
}
.fp-bot-modal-close {
    background: transparent; border: 0; color: var(--fp-bot-text-muted);
    font-size: 26px; line-height: 1; cursor: pointer;
    padding: 0 4px; border-radius: 6px;
}
.fp-bot-modal-close:hover { color: var(--fp-bot-text); }

.fp-bot-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
}

.fp-bot-offhours {
    background: var(--fp-bot-warning-bg);
    color: var(--fp-bot-warning-text);
    padding: 10px 12px; border-radius: 8px;
    font-size: 13px; line-height: 1.4;
    margin-bottom: 16px;
}

.fp-bot-ticket-form { display: flex; flex-direction: column; gap: 14px; }
.fp-bot-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.fp-bot-field label {
    font-size: 12px; font-weight: 600; color: var(--fp-bot-text);
}
.fp-bot-field input,
.fp-bot-field textarea {
    width: 100%; box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid var(--fp-bot-border); border-radius: 8px;
    font-family: inherit; font-size: 14px; line-height: 1.4;
    color: var(--fp-bot-text); background: var(--fp-bot-bg);
    outline: none;
    transition: border-color .15s ease;
}
.fp-bot-field textarea { resize: vertical; min-height: 80px; }
.fp-bot-field input:focus,
.fp-bot-field textarea:focus { border-color: var(--fp-bot-primary); }

.fp-bot-field-row {
    display: flex; gap: 12px;
}
@media (max-width: 460px) {
    .fp-bot-field-row { flex-direction: column; }
}

.fp-bot-save-row {
    margin-top: -6px;
}
.fp-bot-save-contact {
    background: transparent; border: 1px solid var(--fp-bot-border);
    padding: 6px 10px; border-radius: 6px;
    font-family: inherit; font-size: 12px;
    color: var(--fp-bot-text-muted); cursor: pointer;
    transition: all .15s ease;
}
.fp-bot-save-contact:hover {
    color: var(--fp-bot-text); border-color: var(--fp-bot-text);
}
.fp-bot-save-contact.fp-bot-saved {
    color: var(--fp-bot-accent);
    border-color: var(--fp-bot-accent);
}

.fp-bot-checkbox {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; cursor: pointer;
    user-select: none;
}
.fp-bot-checkbox input { width: 16px; height: 16px; cursor: pointer; }

.fp-bot-modal-error {
    background: var(--fp-bot-error-bg);
    color: var(--fp-bot-error-text);
    padding: 9px 11px; border-radius: 6px;
    font-size: 13px;
}

.fp-bot-modal-actions {
    display: flex; gap: 10px; justify-content: flex-start;
    margin-top: 4px;
}
.fp-bot-cancel {
    background: transparent;
    border: 1px solid var(--fp-bot-border); border-radius: 8px;
    padding: 9px 16px;
    font-family: inherit; font-size: 14px; cursor: pointer;
    color: var(--fp-bot-text);
}
.fp-bot-cancel:hover { background: var(--fp-bot-bg-alt); }

.fp-bot-submit {
    background: var(--fp-bot-primary); color: #fff;
    border: 0; border-radius: 8px;
    padding: 9px 18px;
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background .15s ease;
}
.fp-bot-submit:hover:not(:disabled) { background: var(--fp-bot-primary-hover); }
.fp-bot-submit:disabled { opacity: .6; cursor: wait; }

.fp-bot-modal-success {
    text-align: center; padding: 20px 0;
}
.fp-bot-success-icon {
    width: 56px; height: 56px;
    background: var(--fp-bot-accent); color: #fff;
    border-radius: 50%;
    font-size: 28px; line-height: 56px;
    margin: 0 auto 14px;
}

/* ---------------------------------------------------------------- */
/*  Scroll-Lock (Hintergrund einfrieren, solange Widget offen)      */
/* ---------------------------------------------------------------- */

html.fp-bot-no-scroll,
body.fp-bot-no-scroll {
    overflow: hidden !important;
    overscroll-behavior: contain;
    touch-action: none;
}

/* ---------------------------------------------------------------- */
/*  Mobile — Panel und Modal als echtes Vollbild                    */
/* ---------------------------------------------------------------- */

@media (max-width: 480px) {
    .fp-bot-panel {
        top: 0; right: 0; bottom: 0; left: 0;
        width: 100%; height: 100vh; height: 100dvh;
        max-width: none; max-height: none;
        border-radius: 0;
    }

    .fp-bot-modal {
        padding: 0;
    }
    .fp-bot-modal-dialog {
        width: 100%; height: 100vh; height: 100dvh;
        max-width: none; max-height: none;
        border-radius: 0;
    }
    .fp-bot-modal-backdrop {
        /* Auf Vollbild-Modal nicht mehr sichtbar — Klick zum Schließen entfällt,
           der Close-Button im Header übernimmt. */
        display: none;
    }

    /* Touch-Targets auf Mobile etwas größer */
    .fp-bot-close,
    .fp-bot-modal-close {
        padding: 8px 12px;
        font-size: 28px;
    }
}
