/* 🎨 MODERN SCOOP BOT - Professional & Beautiful Design */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

/* Chat Container - FIXED: Added pointer-events and visibility */
.scoop-chat {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    max-height: 680px;
    background: var(--bg-white);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    visibility: hidden; /* FIXED: Hide when closed */
    pointer-events: none; /* FIXED: Don't block clicks when closed */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 99999;
}

.scoop-chat.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible; /* FIXED: Show when open */
    pointer-events: auto; /* FIXED: Allow clicks when open */
}

/* Launcher Button - POSITIONED LEFT OF WHATSAPP */
#scoop-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 104px; /* Position to left of WhatsApp (which is usually at right: 24px) */
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-size: 28px;
    border-radius: 50%;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 999999; /* Higher than WhatsApp */
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#scoop-chat-launcher:hover {
    transform: scale(1.12) rotate(10deg);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

/* Header */
.scoop-head {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

#scoop-points {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Chat Log */
.scoop-log {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(to bottom, var(--bg-light) 0%, #ffffff 100%);
    min-height: 380px;
}

.scoop-log::-webkit-scrollbar {
    width: 8px;
}

.scoop-log::-webkit-scrollbar-track {
    background: transparent;
}

.scoop-log::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}

.scoop-log::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Message Bubbles */
.scoop-bubble {
    max-width: 88%;
    margin: 12px 0;
    padding: 0;
    clear: both;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.scoop-bubble.user {
    float: right;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 20px 20px 4px 20px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.scoop-bubble.bot {
    float: left;
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* Bot Message Content */
.scoop-intro {
    background: white;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 4px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
}

.scoop-text-response {
    background: white;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 4px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
}

.scoop-error {
    background: #fee;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 4px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--danger);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
    border: 1px solid #fcc;
}

/* 🎨 PRODUCT CARDS GRID - Modern & Beautiful */
.scoop-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 0;
    padding: 0;
}

.scoop-product-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.scoop-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.scoop-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.scoop-product-card:hover::before {
    transform: scaleX(1);
}

.scoop-product-header {
    margin-bottom: 10px;
}

.scoop-product-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scoop-product-title:hover {
    color: var(--primary);
}

.scoop-product-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.scoop-product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.scoop-product-stock {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.scoop-product-stock.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.scoop-product-stock.out-stock {
    background: #fee2e2;
    color: #991b1b;
}

/* Cart Button */
.scoop-cart-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    text-align: center;
    display: block;
}

.scoop-cart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.scoop-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

.scoop-cart-btn-disabled {
    background: #cbd5e1 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* View Product Button */
.scoop-view-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    text-align: center;
    display: block;
    text-decoration: none;
}

.scoop-view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    color: white;
    text-decoration: none;
}

/* Input Area */
#scoop-form {
    border-top: 1px solid var(--border);
    background: white;
}

.scoop-input-wrapper {
    display: flex;
    align-items: center;
    padding: 14px;
    gap: 10px;
}

#scoop-input {
    flex: 1;
    border: 2px solid var(--border);
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 24px;
    outline: none;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

#scoop-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Media Buttons */
.scoop-media-btn {
    background: linear-gradient(135deg, var(--bg-light) 0%, #e0e7ff 100%);
    color: var(--primary);
    border: 2px solid transparent;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 20px;
}

.scoop-media-btn:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Send Button */
.scoop-send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.scoop-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.scoop-send-btn:active {
    transform: translateY(0);
}

/* Recording Indicator */
.scoop-recording {
    padding: 14px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-top: 2px solid var(--warning);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #92400e;
    font-weight: 600;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.4; 
        transform: scale(0.85); 
    }
}

#scoop-stop-recording {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-left: auto;
    transition: all 0.3s ease;
}

#scoop-stop-recording:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Loading State */
.scoop-bubble.bot.loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Responsive - FIXED: Added pointer-events handling */
@media (max-width: 480px) {
    .scoop-chat {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 80px;
        max-height: 70vh;
        border-radius: 20px;
    }
    
    #scoop-chat-launcher {
        right: 88px; /* Position to left of WhatsApp on mobile */
        bottom: 16px;
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
    
    .scoop-bubble {
        max-width: 92%;
    }
    
    .scoop-products-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Link Styling */
.scoop-bubble a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.scoop-bubble a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* ==================== CHECKOUT FORM STYLES ==================== */

.scoop-cart-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--success);
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
}

.scoop-cart-success p {
    margin: 8px 0;
    color: var(--text-dark);
}

.scoop-checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.scoop-checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.scoop-checkout-form {
    background: white;
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 20px;
    margin: 8px 0;
}

.scoop-checkout-form h3 {
    margin: 0 0 12px 0;
    color: var(--primary);
    font-size: 16px;
}

.scoop-checkout-form p {
    margin: 0 0 16px 0;
    color: var(--text-gray);
    font-size: 14px;
}

.scoop-checkout-form input,
.scoop-checkout-form textarea {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.scoop-checkout-form input:focus,
.scoop-checkout-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.scoop-checkout-form textarea {
    resize: vertical;
    min-height: 60px;
}

.scoop-confirm-order-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.scoop-confirm-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.scoop-order-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--success);
    border-radius: 16px;
    padding: 20px;
    margin: 8px 0;
    text-align: center;
}

.scoop-order-success h3 {
    margin: 0 0 12px 0;
    color: var(--success);
    font-size: 18px;
}

.scoop-order-success p {
    margin: 8px 0;
    color: var(--text-dark);
    font-size: 14px;
}