/* Chat Widget CSS - Apple Style */
:root {
    --chat-primary: #0071e3;
    --chat-bg: rgba(255, 255, 255, 0.75);
    /* More translucent */
    --chat-text: #1d1d1f;
    --chat-gray: #f5f5f7;
    --chat-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    /* Softer, larger shadow */
    --chat-radius: 24px;
    /* Rounder corners */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.chat-window {
    font-family: var(--font-stack);
}


/* Floating Button */
.chat-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--chat-primary);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.4);
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: pulse 2s infinite;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
}

.chat-widget-btn i {
    font-size: 28px;
}

/* Tooltip */
.chat-tooltip {
    position: absolute;
    right: 70px;
    background: white;
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-widget-btn:hover .chat-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: var(--chat-bg);
    backdrop-filter: blur(25px) saturate(180%);
    /* Apple-like blur */
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    /* Smoother easing */
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background: var(--chat-primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-close {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

/* Body */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255, 255, 255, 0.5);
}

/* Messages */
.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: messageSlide 0.3s ease;
}

.chat-message.bot {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    color: var(--chat-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.chat-message.user {
    background: var(--chat-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 113, 227, 0.2);
}

/* Input Area */
.chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: none;
    background: var(--chat-gray);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 16px;
    /* Prevent iOS zoom */
    outline: none;
    transition: background 0.2s;
}

.chat-input:focus {
    background: #eaeaec;
}

.chat-send {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-send:hover {
    transform: scale(1.1);
}

/* Phone Input Overlay */
.chat-phone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.chat-phone-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    margin: 15px 0;
    font-size: 16px;
    text-align: center;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 113, 227, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 113, 227, 0);
    }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .chat-window {
        bottom: 20px;
        right: 20px;
        left: 20px;
        width: auto;
        height: 80vh;
        max-height: 600px;
        border-radius: var(--chat-radius);
    }

    .chat-widget-btn {
        bottom: 20px;
        right: 20px;
    }

    /* Mobile Blur & Scroll Lock */
    body.chat-active-mobile {
        overflow: hidden;
    }

    body.chat-active-mobile #main-content {
        filter: blur(8px);
        -webkit-filter: blur(8px);
        pointer-events: none;
        transition: filter 0.3s ease;
    }
}