.ai-chat-fab {
    position: fixed;
    bottom: 42px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--op-accent, #E86F2C);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(232, 111, 44, 0.35);
    z-index: 9999;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ai-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(232, 111, 44, 0.45);
}

.ai-chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-height: 580px;
    background: var(--op-bg-card, #fff);
    border-radius: var(--op-radius-lg, 16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}
.ai-chat-panel.ai-chat-hidden {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--op-accent, #E86F2C);
    color: #fff;
}
.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.ai-chat-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
.ai-chat-subtitle {
    font-size: 12px;
    opacity: 0.85;
}
.ai-chat-header-actions {
    display: flex;
    gap: 4px;
}
.ai-chat-header-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s;
}
.ai-chat-header-btn:hover {
    background: rgba(255,255,255,0.2);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 360px;
    max-height: 440px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--op-bg-page, #F8F7F4);
}

.ai-chat-welcome {
    text-align: center;
    padding: 16px 8px;
    color: var(--op-text-secondary, #6B7280);
    font-size: 14px;
}
.ai-chat-welcome-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--op-accent-light, #FFF0E8);
    color: var(--op-accent, #E86F2C);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 12px;
}
.ai-chat-welcome p {
    margin: 4px 0;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 12px;
}
.ai-chat-suggestion {
    background: var(--op-bg-card, #fff);
    border: 1px solid var(--op-border, #E5E7EB);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--op-accent, #E86F2C);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.ai-chat-suggestion:hover {
    background: var(--op-accent-light, #FFF0E8);
    border-color: var(--op-accent, #E86F2C);
}

.ai-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: ai-chat-fade-in 0.2s ease;
}
.ai-chat-msg.ai-chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: var(--op-radius-md, 12px);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}
.ai-chat-msg-user .ai-chat-msg-bubble {
    background: var(--op-accent, #E86F2C);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ai-chat-msg-bot .ai-chat-msg-bubble {
    background: var(--op-bg-card, #fff);
    color: var(--op-text, #1A1A1A);
    border: 1px solid var(--op-border, #E5E7EB);
    border-bottom-left-radius: 4px;
}

.ai-chat-msg-bot-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--op-accent-light, #FFF0E8);
    color: var(--op-accent, #E86F2C);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-top: 2px;
}

.ai-chat-typing .ai-chat-msg-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
}
.ai-chat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--op-text-muted, #9CA3AF);
    animation: ai-chat-bounce 1.2s infinite;
}
.ai-chat-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-dot:nth-child(3) { animation-delay: 0.3s; }

.ai-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--op-border, #E5E7EB);
    background: var(--op-bg-card, #fff);
}
.ai-chat-input {
    flex: 1;
    border: 1px solid var(--op-border, #E5E7EB);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    background: var(--op-bg-page, #F8F7F4);
}
.ai-chat-input:focus {
    border-color: var(--op-accent, #E86F2C);
}
.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--op-accent, #E86F2C);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, transform 0.15s;
}
.ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ai-chat-send-btn:not(:disabled):hover {
    transform: scale(1.06);
}

@keyframes ai-chat-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ai-chat-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Food suggestion cards */
.ai-chat-food-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 4px;
    animation: ai-chat-fade-in 0.2s ease;
}
.ai-chat-food-group-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--op-text, #1A1A1A);
    padding: 6px 4px 2px;
    margin-top: 4px;
}
.ai-chat-food-group-header:first-child {
    margin-top: 0;
}
.ai-chat-food-group-price {
    font-weight: 400;
    color: var(--op-text-muted, #9CA3AF);
    font-size: 12px;
}
.ai-chat-food-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--op-bg-card, #fff);
    border: 1px solid var(--op-border, #E5E7EB);
    border-radius: var(--op-radius-md, 10px);
}
.ai-chat-food-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--op-text, #1A1A1A);
    line-height: 1.3;
}
.ai-chat-food-meta {
    font-size: 12px;
    color: var(--op-text-muted, #9CA3AF);
}
.ai-chat-food-select {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--op-accent, #E86F2C);
    border-radius: 16px;
    background: transparent;
    color: var(--op-accent, #E86F2C);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.ai-chat-food-select:hover {
    background: var(--op-accent, #E86F2C);
    color: #fff;
}
.ai-chat-food-selected {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

/* Highlight animation for selected food items on order page */
.ai-chat-highlight {
    animation: ai-chat-pulse 1.5s ease-out;
}
@keyframes ai-chat-pulse {
    0% { box-shadow: 0 0 0 0 rgba(232, 111, 44, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(232, 111, 44, 0); }
    100% { box-shadow: 0 0 0 0 rgba(232, 111, 44, 0); }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .ai-chat-panel {
        bottom: 45px;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: var(--op-radius-lg, 16px) var(--op-radius-lg, 16px) 0 0;
    }
    .ai-chat-messages {
        max-height: calc(100dvh - 140px);
        min-height: 60vh;
    }
    .ai-chat-fab {
        bottom: 80px;
        right: 16px;
    }
}

/* ===== Order Confirmation Card ===== */
.ai-chat-confirm-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px;
    max-width: 280px;
    font-size: 13px;
}
.ai-chat-confirm-header {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
}
.ai-chat-confirm-category {
    color: #666;
    font-size: 12px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}
.ai-chat-confirm-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    color: #444;
}
.ai-chat-confirm-item small {
    color: #999;
}
.ai-chat-confirm-total {
    font-weight: 700;
    color: var(--op-accent, #E86F2C);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 14px;
}
.ai-chat-confirm-fields {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ai-chat-confirm-name,
.ai-chat-confirm-note {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
.ai-chat-confirm-name:focus,
.ai-chat-confirm-note:focus {
    border-color: var(--op-accent, #E86F2C);
}
.ai-chat-input-error {
    border-color: #ef4444 !important;
    animation: shake 0.3s;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.ai-chat-confirm-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--op-accent, #E86F2C);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.ai-chat-confirm-btn:hover { opacity: 0.9; }
.ai-chat-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== QR Card ===== */
.ai-chat-qr-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    max-width: 280px;
    text-align: center;
}
.ai-chat-qr-header {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}
.ai-chat-qr-image { margin: 0 auto 8px; }
.ai-chat-qr-image img { max-width: 200px; height: auto; }
.ai-chat-qr-total {
    font-weight: 700;
    color: var(--op-accent, #E86F2C);
    font-size: 16px;
    margin-bottom: 6px;
}
.ai-chat-qr-timer {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}
.ai-chat-qr-link {
    font-size: 12px;
    color: var(--op-accent, #E86F2C);
    text-decoration: underline;
}

/* ===== Success Card ===== */
.ai-chat-success-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 20px;
    max-width: 280px;
    text-align: center;
}
.ai-chat-success-icon {
    font-size: 32px;
    color: #22c55e;
    margin-bottom: 8px;
}
.ai-chat-success-text {
    font-weight: 700;
    color: #166534;
    margin-bottom: 10px;
}
.ai-chat-success-link {
    display: inline-block;
    padding: 8px 16px;
    background: #22c55e;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}
.ai-chat-success-link:hover { opacity: 0.9; }

/* ===== Error Card ===== */
.ai-chat-error-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    max-width: 280px;
    text-align: center;
}
.ai-chat-error-icon { font-size: 32px; color: #ef4444; margin-bottom: 8px; }
.ai-chat-error-text { font-weight: 700; color: #991b1b; margin-bottom: 6px; }
.ai-chat-error-hint { font-size: 12px; color: #666; }

/* ===== Expired Card ===== */
.ai-chat-expired-card {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 20px;
    max-width: 280px;
    text-align: center;
}
.ai-chat-expired-icon { font-size: 32px; color: #f59e0b; margin-bottom: 8px; }
.ai-chat-expired-text { font-weight: 700; color: #92400e; margin-bottom: 6px; }
.ai-chat-expired-hint { font-size: 12px; color: #666; }

/* ===== Cart Bar ===== */
.ai-chat-cart-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--op-bg-card, #fff);
    border-top: 1px solid var(--op-border, #E5E7EB);
    animation: ai-chat-fade-in 0.2s ease;
}
.ai-chat-cart-bar.ai-chat-cart-hidden {
    display: none;
}
.ai-chat-cart-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-chat-cart-count {
    font-size: 13px;
    color: var(--op-text-secondary, #6B7280);
    font-weight: 500;
}
.ai-chat-cart-total {
    font-size: 14px;
    font-weight: 700;
    color: var(--op-accent, #E86F2C);
}
.ai-chat-cart-confirm-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 20px;
    background: var(--op-accent, #E86F2C);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    white-space: nowrap;
}
.ai-chat-cart-confirm-btn:hover {
    transform: scale(1.03);
}
.ai-chat-cart-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ai-chat-cart-error {
    color: #dc2626;
    border-color: #fecaca !important;
    background: #fef2f2 !important;
}
