/* OrderLocal Voice Agent — Chat Widget v1.1 */

/* ── Floating Bubble ──────────────────────────────────── */

.olv-floating {
    position: fixed;
    bottom: 36px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.olv-bubble-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.olv-bubble-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}

.olv-bubble-btn:active {
    transform: scale(0.96);
}

/* ── Chat Window ──────────────────────────────────────── */

.olv-chat-window {
    position: fixed;
    bottom: 108px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    border-radius: 14px;
    border: 1px solid;
    overflow: hidden;
    display: none;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    animation: olv-slide-up 0.25s ease;
}

.olv-chat-window.open {
    display: flex;
}

@keyframes olv-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ───────────────────────────────────────────── */

.olv-chat-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.olv-header-icon {
    object-fit: contain;
    flex-shrink: 0;
    margin-right: 10px;
    align-self: center;
}

.olv-header-icon.circle {
    border-radius: 50%;
}

.olv-header-icon.square {
    border-radius: 4px;
}

.olv-header-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.olv-chat-title {
    font-size: 15px;
    font-weight: 700;
}

.olv-chat-subtitle {
    font-size: 11px;
    font-weight: 400;
    margin-left: 2px;
}

.olv-header-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
}

.olv-new-chat-btn,
.olv-close-btn {
    background: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
    padding: 0;
}

.olv-close-btn {
    width: 28px;
    height: 28px;
}

.olv-new-chat-btn:hover,
.olv-close-btn:hover {
    background: rgba(255,255,255,0.08);
}

/* ── Messages ─────────────────────────────────────────── */

.olv-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.olv-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.olv-chat-messages::-webkit-scrollbar-thumb {
    border-radius: 3px;
}

.olv-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: olv-msg-in 0.2s ease;
}

@keyframes olv-msg-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.olv-message-agent {
    align-self: flex-start;
}

.olv-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.olv-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.olv-bubble {
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.olv-message-agent .olv-bubble {
    border-bottom-left-radius: 4px;
}

.olv-message-user .olv-bubble {
    border-bottom-right-radius: 4px;
}

/* ── Input Area ───────────────────────────────────────── */

.olv-chat-input-area {
    display: flex;
    padding: 10px 14px;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.olv-chat-input {
    flex: 1;
    border: 1px solid;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    min-width: 0;
}

.olv-send-btn {
    border: none;
    border-radius: 8px;
    padding: 9px 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.olv-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Typing Indicator ─────────────────────────────────── */

.olv-typing {
    display: flex;
    gap: 4px;
    padding: 8px 18px;
    align-items: center;
    flex-shrink: 0;
}

.olv-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    animation: olv-bounce 1.2s infinite;
}

.olv-typing span:nth-child(2) { animation-delay: 0.2s; }
.olv-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes olv-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 480px) {
    .olv-floating {
        bottom: 12px;
        right: 12px;
    }
    .olv-bubble-btn {
        width: 50px;
        height: 50px;
    }
    .olv-chat-window {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100dvh;
        max-width: none;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        animation: olv-slide-up-mobile 0.2s ease;
    }
    @keyframes olv-slide-up-mobile {
        from { opacity: 0; transform: translateY(10px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .olv-chat-header {
        padding: 12px 14px;
        flex-shrink: 0;
    }
    .olv-chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .olv-chat-input-area {
        padding: 8px 12px;
        flex-shrink: 0;
    }
    .olv-chat-input {
        font-size: 16px; /* prevent iOS zoom */
    }
    .olv-close-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}


/* ── Floppy Disk Banner ──────────────────────────────── */

.olv-floppy-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(74,108,247,0.12) 0%, rgba(138,180,248,0.08) 100%);
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 9px;
    color: #8ab4f8;
    flex-shrink: 0;
    animation: olv-floppy-in 0.4s ease, olv-floppy-pulse 2s ease-in-out 0.5s infinite;
}

.olv-floppy-banner.show {
    display: flex;
}

.olv-floppy-icon {
    flex-shrink: 0;
    opacity: 0.8;
    animation: olv-floppy-spin 3s linear infinite;
}

@keyframes olv-floppy-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes olv-floppy-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}

@keyframes olv-floppy-spin {
    0%   { transform: rotate(0deg); }
    25%  { transform: rotate(15deg); }
    75%  { transform: rotate(-15deg); }
    100% { transform: rotate(0deg); }
}

/* ── Product Cards ───────────────────────────────────── */

.olv-product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.olv-product-card {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 10px;
    margin: 0 0 15px 0;
    transition: background 0.15s;
    cursor: pointer;
}

.olv-product-card:hover {
    background: rgba(255,255,255,0.08);
}

.olv-product-card:hover .olv-product-name,
.olv-product-card:hover .olv-product-price {
    color: inherit;
}

.olv-product-card + .olv-product-card {
    margin-top: 4px;
}

.olv-product-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
}

.olv-product-info {
    flex: 1;
    min-width: 0;
}

.olv-product-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 2px;
}

.olv-product-price {
    font-size: 12px;
    opacity: 0.8;
}
