/**
 * Enhanced Voice Commerce CSS
 * Modern, beautiful UI for voice shopping experience
 */

:root {
    --vc-primary: #ec7400;
    --vc-primary-dark: #c86400; /* darker orange */
    --vc-primary-light: #ff8f26; /* lighter orange */
    --vc-secondary: #ff9c33; /* supporting secondary orange */
    --vc-success: #10b981;
    --vc-error: #ef4444;
    --vc-warning: #f59e0b;
    --vc-bg: #ffffff;
    --vc-bg-secondary: #f9fafb;
    --vc-text: #111827;
    --vc-text-secondary: #6b7280;
    --vc-border: #e5e7eb;
    --vc-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --vc-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --vc-radius: 16px;
    --vc-radius-sm: 8px;
    --vc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme variables (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --vc-bg: #1f2937;
        --vc-bg-secondary: #111827;
        --vc-text: #f9fafb;
        --vc-text-secondary: #9ca3af;
        --vc-border: #374151;
    }
}

/* ======================
   Floating Button
   ====================== */

.vc-float-btn {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: var(--vc-transition);
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float-bounce 3s ease-in-out infinite;
}

.vc-float-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

.vc-float-btn .vc-mic-icon {
    width: 28px;
    height: 28px;
    position: relative;
    z-index: 2;
}

.vc-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.3);
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes float-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ======================
   Voice Panel
   ====================== */

.vc-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: var(--vc-bg);
    box-shadow: var(--vc-shadow-lg);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.vc-panel.active {
    right: 0;
}

.vc-panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Header */
.vc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--vc-border);
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    color: white;
}

.vc-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vc-logo-icon {
    width: 32px;
    height: 32px;
    opacity: 0.9;
}

.vc-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.vc-subtitle {
    margin: 2px 0 0 0;
    font-size: 13px;
    opacity: 0.85;
}

.vc-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--vc-transition);
}

.vc-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.vc-close-btn svg {
    width: 20px;
    height: 20px;
}

/* Quick Actions */
.vc-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 16px;
    background: var(--vc-bg-secondary);
    border-bottom: 1px solid var(--vc-border);
}

.vc-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--vc-bg);
    border: 1px solid var(--vc-border);
    border-radius: var(--vc-radius-sm);
    cursor: pointer;
    transition: var(--vc-transition);
    font-size: 11px;
    font-weight: 500;
    color: var(--vc-text-secondary);
}

.vc-quick-btn:hover {
    border-color: var(--vc-primary);
    color: var(--vc-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.vc-quick-btn svg {
    width: 20px;
    height: 20px;
}

/* Conversation Area */
.vc-conversation {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--vc-bg-secondary);
    scrollbar-width: thin;
    scrollbar-color: var(--vc-border) transparent;
}

.vc-conversation::-webkit-scrollbar {
    width: 6px;
}

.vc-conversation::-webkit-scrollbar-track {
    background: transparent;
}

.vc-conversation::-webkit-scrollbar-thumb {
    background: var(--vc-border);
    border-radius: 3px;
}

/* Welcome Message */
.vc-welcome-message {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: var(--vc-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

.vc-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vc-bot-avatar svg {
    width: 24px;
    height: 24px;
    color: white;
}

.vc-message-content {
    flex: 1;
}

.vc-message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--vc-text);
}

.vc-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.vc-message-content li {
    font-size: 13px;
    color: var(--vc-text-secondary);
    margin: 4px 0;
}

.vc-hint {
    color: var(--vc-primary) !important;
    font-size: 13px !important;
    font-weight: 500;
}

/* Message Bubbles */
.vc-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: slide-up 0.3s ease-out;
}

.vc-message.user {
    flex-direction: row-reverse;
}

.vc-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--vc-radius);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.vc-message.bot .vc-message-bubble {
    background: white;
    color: var(--vc-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.vc-message.user .vc-message-bubble {
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    color: white;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Area */
.vc-input-area {
    padding: 20px;
    background: var(--vc-bg);
    border-top: 1px solid var(--vc-border);
}

/* Transcript */
.vc-transcript {
    padding: 12px 16px;
    background: var(--vc-bg-secondary);
    border-radius: var(--vc-radius-sm);
    margin-bottom: 16px;
    animation: slide-up 0.3s ease-out;
}

.vc-transcript-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--vc-text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.vc-transcript-text {
    font-size: 14px;
    color: var(--vc-text);
    line-height: 1.5;
    font-style: italic;
}

/* Voice Visualizer */
.vc-visualizer {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.vc-wave-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 50px;
}

.vc-wave-bars span {
    width: 4px;
    height: 20%;
    background: linear-gradient(180deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    border-radius: 2px;
    animation: wave-pulse 1.2s ease-in-out infinite;
}

.vc-wave-bars span:nth-child(1) { animation-delay: 0s; }
.vc-wave-bars span:nth-child(2) { animation-delay: 0.1s; }
.vc-wave-bars span:nth-child(3) { animation-delay: 0.2s; }
.vc-wave-bars span:nth-child(4) { animation-delay: 0.3s; }
.vc-wave-bars span:nth-child(5) { animation-delay: 0.4s; }
.vc-wave-bars span:nth-child(6) { animation-delay: 0.5s; }
.vc-wave-bars span:nth-child(7) { animation-delay: 0.4s; }
.vc-wave-bars span:nth-child(8) { animation-delay: 0.3s; }
.vc-wave-bars span:nth-child(9) { animation-delay: 0.2s; }
.vc-wave-bars span:nth-child(10) { animation-delay: 0.1s; }

@keyframes wave-pulse {
    0%, 100% {
        height: 20%;
    }
    50% {
        height: 100%;
    }
}

/* Controls */
.vc-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.vc-record-btn {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--vc-transition);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.vc-record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
}

.vc-record-btn.recording {
    background: linear-gradient(135deg, var(--vc-error) 0%, #dc2626 100%);
    animation: recording-pulse 1.5s ease-in-out infinite;
}

.vc-record-btn svg {
    width: 32px;
    height: 32px;
}

.vc-record-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--vc-primary);
    opacity: 0;
}

.vc-record-btn.recording .vc-record-ripple {
    animation: ripple 1.5s ease-out infinite;
}

@keyframes recording-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.vc-status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--vc-text-secondary);
    text-align: center;
}

/* Suggestions */
.vc-suggestions {
    margin-top: 16px;
}

.vc-suggestion-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--vc-text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.vc-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vc-chip {
    padding: 6px 14px;
    background: var(--vc-bg-secondary);
    border: 1px solid var(--vc-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--vc-text-secondary);
    cursor: pointer;
    transition: var(--vc-transition);
}

.vc-chip:hover {
    background: var(--vc-primary);
    color: white;
    border-color: var(--vc-primary);
    transform: translateY(-1px);
}

/* ======================
   Shopping Cart Preview
   ====================== */

.vc-cart-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 400px;
    max-height: 600px;
    background: var(--vc-bg);
    border-radius: var(--vc-radius);
    box-shadow: var(--vc-shadow-lg);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: var(--vc-transition);
}

.vc-cart-preview.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.vc-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--vc-border);
}

.vc-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.vc-cart-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--vc-bg-secondary);
    border: none;
    font-size: 24px;
    color: var(--vc-text-secondary);
    cursor: pointer;
    transition: var(--vc-transition);
}

.vc-cart-close:hover {
    background: var(--vc-error);
    color: white;
}

.vc-cart-items {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
}

.vc-cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--vc-bg-secondary);
    border-radius: var(--vc-radius-sm);
    margin-bottom: 12px;
}

.vc-cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.vc-cart-item-details {
    flex: 1;
}

.vc-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.vc-cart-item-price {
    font-size: 16px;
    color: var(--vc-primary);
    font-weight: 700;
}

.vc-cart-item-quantity {
    font-size: 12px;
    color: var(--vc-text-secondary);
}

.vc-cart-footer {
    padding: 20px;
    border-top: 1px solid var(--vc-border);
}

.vc-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 700;
}

.vc-cart-checkout-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--vc-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--vc-transition);
}

.vc-cart-checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

/* ======================
   Toast Notifications
   ====================== */

.vc-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    min-width: 300px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--vc-radius-sm);
    box-shadow: var(--vc-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    opacity: 0;
    transition: var(--vc-transition);
    z-index: 1002;
}

.vc-toast.active {
    transform: translateX(0);
    opacity: 1;
}

.vc-toast.success {
    border-left: 4px solid var(--vc-success);
}

.vc-toast.error {
    border-left: 4px solid var(--vc-error);
}

.vc-toast.info {
    border-left: 4px solid var(--vc-primary);
}

.vc-toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vc-toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--vc-text);
}

/* ======================
   Product Modal
   ====================== */

.vc-product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.vc-product-modal.active {
    opacity: 1;
    pointer-events: all;
}

.vc-product-modal-content {
    position: relative;
    background: var(--vc-bg);
    border-radius: var(--vc-radius);
    padding: 32px;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.vc-product-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--vc-bg-secondary);
    border: none;
    font-size: 24px;
    color: var(--vc-text-secondary);
    cursor: pointer;
    transition: var(--vc-transition);
}

.vc-product-close:hover {
    background: var(--vc-error);
    color: white;
    transform: rotate(90deg);
}

.vc-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.vc-product-card {
    background: var(--vc-bg-secondary);
    border-radius: var(--vc-radius-sm);
    padding: 16px;
    transition: var(--vc-transition);
    cursor: pointer;
    position: relative;
}

.vc-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.vc-product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.vc-product-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    z-index: 10;
}

.vc-product-badge.store-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.vc-product-badge.category-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.vc-product-badge.menu-badge {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.vc-product-badge.soldout-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.vc-product-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--vc-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vc-product-store {
    font-size: 13px;
    color: var(--vc-text-secondary);
    margin: 0 0 8px 0;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vc-product-distance {
    font-size: 12px;
    color: var(--vc-primary);
    margin: 0 0 8px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.vc-product-distance::before {
    content: "📍";
    font-size: 14px;
}

.vc-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--vc-primary);
    margin: 0 0 12px 0;
}

.vc-product-add-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--vc-primary) 0%, var(--vc-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--vc-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--vc-transition);
}

.vc-product-add-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.vc-product-add-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ======================
   Responsive Design
   ====================== */

@media (max-width: 768px) {
    .vc-float-btn {
        width: 56px;
        height: 56px;
        bottom: 80px;
        right: 16px;
    }

    .vc-panel {
        width: 100%;
        right: -100%;
    }

    .vc-quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }

    .vc-quick-btn {
        font-size: 10px;
        padding: 10px 4px;
    }

    .vc-cart-preview {
        width: 90%;
        max-width: 350px;
    }

    .vc-product-modal-content {
        padding: 20px;
    }

    .vc-product-grid {
        grid-template-columns: 1fr;
    }

    .vc-toast {
        right: 16px;
        left: 16px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .vc-conversation {
        padding: 12px;
    }

    .vc-input-area {
        padding: 16px;
    }

    .vc-record-btn {
        width: 64px;
        height: 64px;
    }
}

/* ======================
   Utility Classes
   ====================== */

.vc-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: var(--vc-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.vc-fade-in {
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Accessibility */
.vc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Print styles */
@media print {
    .vc-float-btn,
    .vc-panel,
    .vc-cart-preview,
    .vc-toast,
    .vc-product-modal {
        display: none !important;
    }
}
