/* VIP AI Assistant - Floating Widget */

.vip-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 24px;
}

.vip-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.vip-fab.vip-hidden {
    display: none;
}

.vip-fab .vip-fab-icon {
    transition: transform 0.3s;
}

/* Chat Panel */
.vip-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 400px;
    height: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 10001;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: vipSlideUp 0.3s ease-out;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.vip-panel.vip-open {
    display: flex;
}

@keyframes vipSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.vip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    flex-shrink: 0;
}

.vip-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}

.vip-header-title .vip-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.vip-header-actions {
    display: flex;
    gap: 4px;
}

.vip-header-actions button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 16px;
    transition: background 0.2s;
}

.vip-header-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Messages */
.vip-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vip-messages::-webkit-scrollbar {
    width: 4px;
}

.vip-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.vip-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.vip-message.user {
    align-self: flex-end;
    background: #6366f1;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.vip-message.assistant {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.vip-message.assistant p {
    margin: 0 0 8px;
}

.vip-message.assistant p:last-child {
    margin-bottom: 0;
}

.vip-message.assistant strong {
    font-weight: 600;
}

.vip-message.assistant code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 13px;
}

.vip-message.assistant ul,
.vip-message.assistant ol {
    margin: 4px 0;
    padding-left: 20px;
}

/* Confirmation Card */
.vip-confirmation-card {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    max-width: 90%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.vip-confirmation-card .vip-card-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vip-confirmation-card .vip-card-details {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    background: #f9fafb;
    padding: 8px 10px;
    border-radius: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.vip-confirmation-card .vip-card-actions {
    display: flex;
    gap: 8px;
}

.vip-confirmation-card .vip-btn-approve {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #10b981;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.vip-confirmation-card .vip-btn-approve:hover {
    background: #059669;
}

.vip-confirmation-card .vip-btn-reject {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.vip-confirmation-card .vip-btn-reject:hover {
    background: #f3f4f6;
}

/* Input Area */
.vip-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    flex-shrink: 0;
}

.vip-input-area input[type="text"] {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.vip-input-area input[type="text"]:focus {
    border-color: #6366f1;
    background: #fff;
}

.vip-input-area .vip-btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.vip-input-area .vip-btn-icon:hover {
    background: #f3f4f6;
    color: #4f46e5;
}

.vip-input-area .vip-btn-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.vip-input-area .vip-btn-send:hover {
    background: #4f46e5;
}

.vip-input-area .vip-btn-send:disabled {
    background: #c7d2fe;
    cursor: not-allowed;
}

/* Recording State */
.vip-btn-icon.vip-recording {
    color: #ef4444 !important;
    animation: vipPulse 1.2s infinite;
}

@keyframes vipPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Typing Indicator */
.vip-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #f3f4f6;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.vip-typing span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: vipBounce 1.4s infinite ease-in-out;
}

.vip-typing span:nth-child(1) { animation-delay: 0s; }
.vip-typing span:nth-child(2) { animation-delay: 0.2s; }
.vip-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes vipBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* File upload hidden input */
.vip-file-input {
    display: none;
}

/* Dark Mode */
[data-bs-theme="dark"] .vip-panel {
    background: rgba(30, 30, 40, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .vip-message.assistant {
    background: #374151;
    color: #f3f4f6;
}

[data-bs-theme="dark"] .vip-message.assistant code {
    background: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .vip-confirmation-card {
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .vip-confirmation-card .vip-card-title {
    color: #f3f4f6;
}

[data-bs-theme="dark"] .vip-confirmation-card .vip-card-details {
    background: #111827;
    color: #9ca3af;
}

[data-bs-theme="dark"] .vip-confirmation-card .vip-btn-reject {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

[data-bs-theme="dark"] .vip-input-area {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.06);
}

[data-bs-theme="dark"] .vip-input-area input[type="text"] {
    background: #111827;
    border-color: #374151;
    color: #f3f4f6;
}

[data-bs-theme="dark"] .vip-input-area input[type="text"]:focus {
    border-color: #818cf8;
    background: #1f2937;
}

[data-bs-theme="dark"] .vip-input-area .vip-btn-icon {
    color: #9ca3af;
}

[data-bs-theme="dark"] .vip-input-area .vip-btn-icon:hover {
    background: #374151;
    color: #818cf8;
}

[data-bs-theme="dark"] .vip-typing {
    background: #374151;
}

[data-bs-theme="dark"] .vip-typing span {
    background: #6b7280;
}

/* Wake Word Button */
.vip-btn-wakeword {
    font-size: 14px !important;
}

.vip-btn-wakeword.vip-wakeword-active {
    color: #4ade80 !important;
    animation: vipPulse 1.5s infinite;
}

/* FAB listening indicator */
.vip-fab.vip-listening {
    animation: vipListening 2s infinite;
}

@keyframes vipListening {
    0%, 100% { box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(74, 222, 128, 0.6), 0 0 0 8px rgba(74, 222, 128, 0.15); }
}

/* Responsive */
@media (max-width: 480px) {
    .vip-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 120px);
        right: 8px;
        bottom: 80px;
        border-radius: 12px;
    }

    .vip-fab {
        bottom: 16px;
        right: 16px;
    }
}
