/* ============================================
   BOOK A BENNY – Pergament unter Liquid Glass
   Floating Chat Widget for V4
   ============================================ */

/* --- FAB (Floating Action Button) --- */
.bab-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255,248,237,0.95), rgba(237,224,204,0.9));
    border: 2px solid rgba(200,168,110,0.4);
    box-shadow: 0 6px 24px rgba(0,0,0,0.15), 0 0 20px rgba(200,168,110,0.15), inset 0 1px 0 rgba(255,255,255,0.8);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}
.bab-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 30px rgba(200,168,110,0.25);
}
.bab-fab:active { transform: scale(0.95); }
.bab-fab svg { width: 28px; height: 28px; color: #8B6914; }
.bab-fab.open { display: none; }

/* Pulse ring */
.bab-fab::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(200,168,110,0.3);
    animation: bab-pulse 2.5s ease-in-out infinite;
}
@keyframes bab-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
}

/* --- Widget Container --- */
.bab-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99991;
    width: 380px;
    max-height: 620px;
    display: none;
    flex-direction: column;
    font-family: 'Inter', -apple-system, sans-serif;
    transform: scale(0.8) translateY(40px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s;
}
.bab-widget.open {
    display: flex;
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* --- Glass Phone Body --- */
.bab-phone {
    background: linear-gradient(145deg, rgba(255,248,237,0.92), rgba(245,230,200,0.88));
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-radius: 28px;
    border: 1px solid rgba(200,168,110,0.3);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.12),
        0 0 0 1px rgba(255,255,255,0.5),
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(0,0,0,0.03);
    overflow: hidden;
    position: relative;
}
/* Glass reflection */
.bab-phone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    border-radius: 28px 28px 0 0;
    z-index: 10;
}

/* Top bar */
.bab-top {
    padding: 14px 16px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(139,105,20,0.1);
    position: relative;
    z-index: 5;
}
.bab-notch {
    display: flex;
    gap: 3px;
    align-items: center;
}
.bab-notch-dot {
    width: 4px;
    height: 4px;
    background: rgba(139,105,20,0.25);
    border-radius: 50%;
}
.bab-brand {
    font-family: 'Georgia', serif;
    font-size: 0.75rem;
    color: #8B6914;
    letter-spacing: 0.2em;
    font-weight: 700;
}
.bab-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(139,105,20,0.08);
    border: 1px solid rgba(139,105,20,0.15);
    color: #8B6914;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}
.bab-close-btn:hover {
    background: rgba(139,105,20,0.15);
    border-color: rgba(139,105,20,0.3);
}

/* --- Pergament Screen --- */
.bab-screen-wrap {
    margin: 10px 12px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    z-index: 5;
    /* Liquid glass over parchment */
    background: linear-gradient(170deg, #F5E6C8 0%, #EDE0CC 30%, #E8D8BE 60%, #F0E4D0 100%);
    border: 1px solid rgba(139,105,20,0.12);
    box-shadow: inset 0 2px 8px rgba(139,105,20,0.06);
}
/* Paper texture overlay */
.bab-screen-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
    border-radius: 16px;
}
/* Subtle glass reflection on top */
.bab-screen-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 3;
    border-radius: 16px 16px 0 0;
}

.bab-screen {
    height: 340px;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 2;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,105,20,0.2) transparent;
}
.bab-screen::-webkit-scrollbar { width: 4px; }
.bab-screen::-webkit-scrollbar-track { background: transparent; }
.bab-screen::-webkit-scrollbar-thumb { background: rgba(139,105,20,0.2); border-radius: 2px; }

/* Messages */
.bab-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.55;
    animation: bab-msg-in 0.3s ease-out;
}
@keyframes bab-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.bab-msg-bot {
    align-self: flex-start;
    background: rgba(255,255,255,0.55);
    color: #4a3a1a;
    border: 1px solid rgba(139,105,20,0.1);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.bab-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(139,105,20,0.2), rgba(139,105,20,0.12));
    color: #3a2a0a;
    border: 1px solid rgba(139,105,20,0.18);
    border-bottom-right-radius: 4px;
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.bab-msg-typing {
    align-self: flex-start;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(139,105,20,0.08);
    padding: 12px 18px;
    border-bottom-left-radius: 4px;
}
.bab-typing-dots {
    display: flex;
    gap: 5px;
}
.bab-typing-dots span {
    width: 6px;
    height: 6px;
    background: #8B6914;
    border-radius: 50%;
    opacity: 0.4;
    animation: bab-dot-bounce 1.2s ease-in-out infinite;
}
.bab-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.bab-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bab-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.bab-input-area {
    padding: 10px 12px 14px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    position: relative;
    z-index: 5;
}
.bab-input-wrap { flex: 1; }
.bab-input {
    width: 100%;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(139,105,20,0.15);
    border-radius: 12px;
    padding: 10px 14px;
    color: #3a2a0a;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    resize: none;
    min-height: 40px;
    max-height: 80px;
    backdrop-filter: blur(8px);
    box-sizing: border-box;
}
.bab-input::placeholder { color: rgba(139,105,20,0.4); }
.bab-input:focus {
    border-color: rgba(139,105,20,0.35);
    background: rgba(255,255,255,0.75);
}

/* Send button */
.bab-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, #C8A86E, #8B6914);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(139,105,20,0.25);
    flex-shrink: 0;
}
.bab-send-btn:hover {
    box-shadow: 0 6px 20px rgba(139,105,20,0.35);
    transform: scale(1.05);
}
.bab-send-btn:active { transform: scale(0.92); }
.bab-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.bab-send-btn svg { width: 18px; height: 18px; }

/* Bottom status */
.bab-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px 12px;
    position: relative;
    z-index: 5;
}
.bab-status {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bab-status-led {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 6px rgba(76,175,80,0.4);
}
.bab-status-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    color: rgba(139,105,20,0.5);
    letter-spacing: 0.12em;
    font-weight: 500;
}

/* Mobile */
@media (max-width: 480px) {
    .bab-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 88vh;
    }
    .bab-phone { border-radius: 20px 20px 0 0; }
    .bab-fab { bottom: 16px; right: 16px; width: 56px; height: 56px; }
    .bab-fab svg { width: 24px; height: 24px; }
}
