/* ══════════════════════════════════════════════════════════
   MBP Chat Widget - Styles
   Prefix: .mbp-chat-  (no conflicts with existing CSS)
   ══════════════════════════════════════════════════════════ */

/* ── Toggle Button ── */
.mbp-chat-toggle {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6 0%, #22d3ee 100%);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(59, 130, 246, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.mbp-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 32px rgba(59, 130, 246, 0.55);
}
.mbp-chat-toggle svg {
    width: 26px;
    height: 26px;
    transition: transform 0.3s ease, opacity 0.2s ease;
}
.mbp-chat-toggle .mbp-chat-icon-close {
    position: absolute;
    transform: rotate(90deg) scale(0);
    opacity: 0;
}
.mbp-chat-toggle.mbp-chat-open .mbp-chat-icon-bubble {
    transform: rotate(-90deg) scale(0);
    opacity: 0;
}
.mbp-chat-toggle.mbp-chat-open .mbp-chat-icon-close {
    transform: rotate(0) scale(1);
    opacity: 1;
}

/* ── Notification Badge ── */
.mbp-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #0a0e17;
    font-size: 0;
    animation: mbp-chat-pulse 2s infinite;
}
.mbp-chat-toggle.mbp-chat-open .mbp-chat-badge {
    display: none;
}

@keyframes mbp-chat-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ── Window ── */
.mbp-chat-window {
    position: fixed;
    bottom: 160px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    border-radius: 16px;
    background: rgba(10, 14, 23, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease;
}
.mbp-chat-window.mbp-chat-visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* ── Header ── */
.mbp-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.mbp-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #22d3ee 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mbp-chat-avatar svg {
    width: 20px;
    height: 20px;
    color: #fff;
}
.mbp-chat-header-info {
    flex: 1;
    min-width: 0;
}
.mbp-chat-header-name {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #f1f5f9;
    line-height: 1.3;
}
.mbp-chat-header-status {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: #22d3ee;
    display: flex;
    align-items: center;
    gap: 5px;
}
.mbp-chat-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22d3ee;
    display: inline-block;
}
.mbp-chat-header-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mbp-chat-header-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.mbp-chat-header-close svg {
    width: 18px;
    height: 18px;
}

/* ── Messages Area ── */
.mbp-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.mbp-chat-body::-webkit-scrollbar {
    width: 4px;
}
.mbp-chat-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* Message Bubbles */
.mbp-chat-msg {
    max-width: 88%;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    line-height: 1.55;
    animation: mbp-chat-fadeIn 0.3s ease;
}
@keyframes mbp-chat-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mbp-chat-msg-bot {
    align-self: flex-start;
}
.mbp-chat-msg-user {
    align-self: flex-end;
}
.mbp-chat-msg-bot .mbp-chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px 14px 14px 14px;
    padding: 10px 14px;
    color: #cbd5e1;
}
.mbp-chat-msg-user .mbp-chat-bubble {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 14px 4px 14px 14px;
    padding: 10px 14px;
    color: #fff;
}

/* ── Typing Indicator ── */
.mbp-chat-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px 14px 14px 14px;
    align-self: flex-start;
    animation: mbp-chat-fadeIn 0.3s ease;
}
.mbp-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: mbp-chat-dot 1.4s infinite;
}
.mbp-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.mbp-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mbp-chat-dot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* ── Quick Replies ── */
.mbp-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    max-width: 100%;
    animation: mbp-chat-fadeIn 0.3s ease;
}
.mbp-chat-option {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
    color: #93c5fd;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.mbp-chat-option:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #fff;
}

/* ── Price Card ── */
.mbp-chat-price {
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 4px;
    align-self: flex-start;
    max-width: 88%;
    animation: mbp-chat-fadeIn 0.3s ease;
}
.mbp-chat-price-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.mbp-chat-price-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mbp-chat-price-note {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* ── Contact Form ── */
.mbp-chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: flex-start;
    width: 100%;
    max-width: 88%;
    animation: mbp-chat-fadeIn 0.3s ease;
}
.mbp-chat-input {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #f1f5f9;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.mbp-chat-input::placeholder {
    color: #64748b;
}
.mbp-chat-input:focus {
    border-color: #3b82f6;
}
.mbp-chat-input.mbp-chat-input-error {
    border-color: #ef4444;
}
.mbp-chat-textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}
.mbp-chat-submit {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #22d3ee);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}
.mbp-chat-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.mbp-chat-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Footer / DSGVO ── */
.mbp-chat-footer {
    padding: 10px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.mbp-chat-dsgvo {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    color: #475569;
    text-align: center;
    line-height: 1.4;
}
.mbp-chat-dsgvo a {
    color: #64748b;
    text-decoration: underline;
    text-decoration-color: rgba(100, 116, 139, 0.4);
    transition: color 0.2s;
}
.mbp-chat-dsgvo a:hover {
    color: #94a3b8;
}

/* ── Restart Button ── */
.mbp-chat-restart {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    color: #475569;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
    margin-top: 4px;
    display: block;
    text-align: center;
    width: 100%;
    transition: color 0.2s;
}
.mbp-chat-restart:hover {
    color: #94a3b8;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .mbp-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }
    .mbp-chat-toggle {
        bottom: 80px;
        right: 16px;
    }
}

@supports (padding: env(safe-area-inset-bottom)) {
    .mbp-chat-toggle {
        bottom: calc(90px + env(safe-area-inset-bottom));
    }
}
