/* SPY PHARMA AI Assistant Widget Styles */
.spy-ai-widget {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    z-index: 2147483647 !important; /* Maximum z-index to ensure visibility */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    -webkit-transform: translateZ(0); /* Force GPU layer for iOS */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Floating Button */
.spy-ai-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(255,71,15,0.4), 0 0 0 2px rgba(255,71,15,0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    width: 60px;
    height: 60px;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
}

.spy-ai-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 32px rgba(255,71,15,0.5), 0 0 0 3px rgba(255,71,15,0.3);
}

.spy-ai-btn.expanded {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
    gap: 0;
}

/* Tooltip on hover */
.spy-ai-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a4e 100%);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.spy-ai-btn::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1a1a2e;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.spy-ai-btn:hover::after,
.spy-ai-btn:hover::before {
    opacity: 1;
    visibility: visible;
}

.spy-ai-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spy-ai-icon-img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

.spy-ai-btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: #fff;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.spy-ai-btn.expanded .spy-ai-btn-text {
    max-width: 0;
    opacity: 0;
}

.spy-ai-btn-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.spy-ai-btn-pulse {
    display: none;
}

.spy-ai-btn.expanded .spy-ai-btn-pulse {
    left: 30px;
    width: 40px;
    height: 40px;
}

@keyframes spyAiPulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Chat Window */
.spy-ai-chat {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 150px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.spy-ai-chat.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.spy-ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #0d0d15 100%);
    color: #fff;
}

.spy-ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spy-ai-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spy-ai-avatar svg,
.spy-ai-avatar img {
    width: 28px;
    height: 28px;
}

.spy-ai-chat-header-text h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.spy-ai-chat-header-text span {
    font-size: 12px;
    opacity: 0.8;
}

.spy-ai-live-btn,
.spy-ai-chat-close {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
}

.spy-ai-live-btn svg,
.spy-ai-chat-close svg {
    width: 16px;
    height: 16px;
}

.spy-ai-live-btn:hover {
    background: #ff470f;
}

.spy-ai-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

.spy-ai-chat-close svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.spy-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.spy-ai-home-btn,
.spy-ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.spy-ai-home-btn:hover,
.spy-ai-chat-close:hover {
    background: rgba(255,255,255,0.1);
}

.spy-ai-home-btn svg,
.spy-ai-chat-close svg {
    width: 20px;
    height: 20px;
}

/* Home Menu */
.spy-ai-home-menu {
    padding: 20px;
    text-align: center;
}

.spy-ai-home-menu h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: #1a1a2e;
}

.spy-ai-home-menu p {
    font-size: 13px;
    color: #666;
    margin: 0 0 24px 0;
}

.spy-ai-menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spy-ai-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.spy-ai-menu-btn:hover {
    background: #fff;
    border-color: #ff470f;
    box-shadow: 0 2px 8px rgba(255,71,15,0.1);
}

.spy-ai-menu-btn-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spy-ai-menu-btn-icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.spy-ai-menu-btn-text h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 2px 0;
}

.spy-ai-menu-btn-text span {
    font-size: 12px;
    color: #666;
}

.spy-ai-menu-btn.active-chat {
    border-color: #22c55e;
    background: #f0fdf4;
}

.spy-ai-menu-btn.active-chat .spy-ai-menu-btn-icon {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.spy-ai-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    background: #22c55e;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.spy-ai-active-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: spyAiPulse 1.5s infinite;
}

@keyframes spyAiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Body */
.spy-ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

/* Messages */
.spy-ai-message {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: spyAiMessageIn 0.3s ease-out;
}

@keyframes spyAiMessageIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.spy-ai-message.ai {
    align-self: flex-start;
}

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

.spy-ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spy-ai-message-avatar svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.spy-ai-message-avatar img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

.spy-ai-message.user .spy-ai-message-avatar {
    background: #1a1a2e;
}

.spy-ai-message-content {
    background: #fff;
    padding: 14px 18px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.spy-ai-message.user .spy-ai-message-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a4e 100%);
    color: #fff;
    border-radius: 18px;
    border-top-right-radius: 4px;
}

.spy-ai-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Quick Options */
.spy-ai-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.spy-ai-option-btn {
    padding: 10px 16px;
    background: #f1f1f1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #1a1a2e;
    text-decoration: none;
    display: inline-block;
}

.spy-ai-option-btn:hover {
    background: #ff470f;
    border-color: #ff470f;
    color: #fff;
    transform: translateY(-1px);
}

/* Contact Form */
.spy-ai-contact-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
    max-width: 280px;
}

.spy-ai-form-row {
    display: flex;
    gap: 6px;
}

.spy-ai-form-row input {
    flex: 1;
    min-width: 0;
}

.spy-ai-contact-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.spy-ai-contact-form input:focus {
    border-color: #ff470f;
}

.spy-ai-contact-form input:disabled {
    background: #f5f5f5;
    color: #999;
}

/* Phone Input with Country Code */
.spy-ai-contact-form .iti {
    width: 100%;
}

.spy-ai-contact-form .iti__flag-container {
    z-index: 10;
}

.spy-ai-contact-form .iti__selected-flag {
    padding: 0 8px;
    background: #f5f5f5;
    border-radius: 8px 0 0 8px;
}

.spy-ai-contact-form .iti__country-list {
    max-width: 260px;
    max-height: 180px;
    font-size: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.spy-ai-contact-form .iti__dial-code {
    color: #666;
}

.spy-ai-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s;
    margin-top: 4px;
}

.spy-ai-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,71,15,0.3);
}

.spy-ai-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spy-ai-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spyAiSpin 0.8s linear infinite;
}

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

/* Typing Indicator */
.spy-ai-typing {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spy-ai-typing-dots {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.spy-ai-typing-dots span {
    width: 8px;
    height: 8px;
    background: #ff470f;
    border-radius: 50%;
    animation: spyAiTyping 1.4s infinite;
}

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

@keyframes spyAiTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Connect to Agent Button */
.spy-ai-connect-agent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
}

.spy-ai-connect-agent:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255,71,15,0.4);
}

.spy-ai-connect-agent svg {
    width: 20px;
    height: 20px;
}

/* Match Score */
.spy-ai-match-score {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 16px;
    margin-top: 12px;
}

.spy-ai-match-score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.spy-ai-match-score-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spy-ai-match-score-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.spy-ai-match-score-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.spy-ai-match-score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease-out;
}

.spy-ai-match-score-fill.high { background: linear-gradient(90deg, #22c55e, #4ade80); }
.spy-ai-match-score-fill.medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.spy-ai-match-score-fill.low { background: linear-gradient(90deg, #ef4444, #f87171); }

.spy-ai-match-score-text {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

/* Summary Card */
.spy-ai-summary {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 16px;
    margin-top: 12px;
}

.spy-ai-summary h5 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spy-ai-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.spy-ai-summary-item:last-child {
    border-bottom: none;
}

.spy-ai-summary-label {
    color: #666;
}

.spy-ai-summary-value {
    color: #1a1a2e;
    font-weight: 500;
}

/* Chat Footer */
.spy-ai-chat-footer {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.spy-ai-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    padding: 6px 6px 6px 18px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.spy-ai-input-wrapper:focus-within {
    border-color: #ff470f;
    box-shadow: 0 0 0 3px rgba(255,71,15,0.1);
}

.spy-ai-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: #1a1a2e;
}

.spy-ai-input::placeholder {
    color: #999;
}

.spy-ai-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.spy-ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255,71,15,0.4);
}

.spy-ai-send svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.spy-ai-powered {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 10px;
}

/* Live Mode */
.spy-ai-chat.live-mode .spy-ai-chat-header {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.spy-ai-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
}

.spy-ai-live-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: spyAiLivePulse 1.5s infinite;
}

@keyframes spyAiLivePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Disclaimer style */
.spy-ai-message.disclaimer .spy-ai-message-content {
    background: #fef3cd;
    border: 1px solid #ffc107;
    font-size: 13px;
    color: #856404;
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* CRITICAL: Hide ALL duplicate widgets except the first one */
    .spy-ai-widget ~ .spy-ai-widget {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* CRITICAL: Only ONE widget position on mobile */
    .spy-ai-widget {
        position: fixed !important;
        bottom: 85px !important;
        left: 16px !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        z-index: 2147483647 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    /* Ensure only ONE button is visible per widget */
    .spy-ai-widget .spy-ai-btn {
        position: relative !important;
        display: flex !important;
    }
    
    /* Hide any duplicate buttons within widget */
    .spy-ai-widget .spy-ai-btn ~ .spy-ai-btn {
        display: none !important;
    }
    
    /* Hide tooltip on mobile */
    .spy-ai-btn::after,
    .spy-ai-btn::before {
        display: none !important;
    }
    
    .spy-ai-btn {
        width: 56px;
        height: 56px;
    }
    
    .spy-ai-btn.expanded {
        width: 56px;
        height: 56px;
        padding: 0;
    }
    
    .spy-ai-btn-icon {
        width: 36px;
        height: 36px;
    }
    
    .spy-ai-icon-img {
        width: 24px;
        height: 24px;
    }
    
    .spy-ai-btn-pulse {
        width: 56px;
        height: 56px;
    }
    
    .spy-ai-btn.expanded .spy-ai-btn-pulse {
        left: 26px;
        width: 36px;
        height: 36px;
    }
    
    .spy-ai-btn-title {
        font-size: 12px;
    }
    
    /* CRITICAL: Chat window FULL SCREEN on mobile */
    .spy-ai-chat {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        z-index: 2147483647 !important;
        transform: none !important;
        margin: 0 !important;
    }
    
    .spy-ai-chat.open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
    
    /* Hide button when chat is open on mobile */
    .spy-ai-widget:has(.spy-ai-chat.open) .spy-ai-btn {
        display: none !important;
    }
    
    /* Ensure chat body fills space */
    .spy-ai-chat .spy-ai-chat-body {
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    /* Safe area for notched phones */
    .spy-ai-chat .spy-ai-chat-header {
        padding-top: max(16px, env(safe-area-inset-top)) !important;
    }
    
    .spy-ai-chat .spy-ai-chat-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
    }
}

/* AI Badge for products */
.ai-recommended-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-recommended-badge svg {
    width: 14px;
    height: 14px;
}

/* AI Micro text styles */
.ai-powered-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.ai-powered-text svg {
    width: 16px;
    height: 16px;
    color: #ff470f;
}

.ai-powered-text.light {
    color: rgba(255,255,255,0.8);
}

.ai-powered-text.light svg {
    color: #fff;
}

/* AI Powered Badge for Hero */
.ai-powered-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 18px;
    background: rgba(255,71,15,0.1);
    border: 1px solid rgba(255,71,15,0.2);
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    color: #ff470f;
    transition: all 0.3s;
}

.ai-powered-badge:hover {
    background: rgba(255,71,15,0.15);
    border-color: rgba(255,71,15,0.3);
}

.ai-powered-badge svg {
    color: #ff470f;
}

.ai-service-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-service-block-header svg {
    width: 24px;
    height: 24px;
    color: #ff470f;
}

.ai-service-block-header span {
    font-size: 14px;
    font-weight: 600;
    color: #ff470f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-service-block p {
    font-size: 15px;
    color: #d1d1d1;
    line-height: 1.6;
    margin: 0;
}

/* Human Handoff Button */
.spy-ai-human-handoff {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.spy-ai-human-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.spy-ai-human-btn:hover {
    background: #fff;
    border-color: #1a1a2e;
    color: #1a1a2e;
}

.spy-ai-human-btn svg {
    color: inherit;
}

/* Product Card - Compact Design */
.spy-ai-product-card {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
}

.spy-ai-product-card-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.spy-ai-product-card-img {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
    border: none;
}

.spy-ai-product-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.spy-ai-product-card-brand {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.2;
}

.spy-ai-product-card-type {
    font-size: 11px;
    color: #888;
    margin: 2px 0 0 0;
    line-height: 1.2;
}

.spy-ai-product-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.spy-ai-product-card-slogan {
    font-size: 11px;
    color: #888;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spy-ai-product-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.spy-ai-product-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f5f7fa;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    color: #555;
    font-weight: 500;
}

.spy-ai-product-card-meta-item svg {
    width: 10px;
    height: 10px;
    color: #ff470f;
    flex-shrink: 0;
}

.spy-ai-product-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    padding: 0;
    list-style: none;
}

.spy-ai-product-card-features li {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #fff5f2;
    color: #ff470f;
    padding: 3px 7px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 600;
}

.spy-ai-product-card-features li::before {
    content: '✓';
    font-size: 8px;
}

.spy-ai-product-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    color: #fff !important;
    text-decoration: none !important;
    padding: 2px 0px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 71, 15, 0.25);
}

.spy-ai-product-card-btn:hover {
    background: linear-gradient(135deg, #e63d0a 0%, #ff470f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 15, 0.35);
}

.spy-ai-product-card-btn svg {
    width: 12px;
    height: 12px;
}

/* Regular links in messages */
.spy-ai-message-content a:not(.spy-ai-product-card-btn) {
    color: #ff470f;
    text-decoration: underline;
}

.spy-ai-message-content a:not(.spy-ai-product-card-btn):hover {
    color: #e63d0a;
}

/* Live Agent Form */
.spy-ai-live-form {
    padding: 16px 12px;
    text-align: center;
    overflow-y: auto;
    max-height: 100%;
}

.spy-ai-live-form-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.spy-ai-live-form-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.spy-ai-live-form h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px;
}

.spy-ai-live-form p {
    font-size: 12px;
    color: #666;
    margin: 0 0 14px;
    line-height: 1.4;
}

.spy-ai-form-row {
    display: flex;
    gap: 8px;
}

.spy-ai-form-row .spy-ai-form-group {
    flex: 1;
}

.spy-ai-form-group {
    margin-bottom: 8px;
}

.spy-ai-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.spy-ai-form-group input:focus {
    outline: none;
    border-color: #ff470f;
}

.spy-ai-live-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 16px;
}

.spy-ai-live-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 15, 0.3);
}

.spy-ai-live-submit svg {
    width: 18px;
    height: 18px;
}

.spy-ai-live-cancel {
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    margin-top: 12px;
    padding: 8px;
}

.spy-ai-live-cancel:hover {
    color: #1a1a2e;
}

/* Loading Transfer */
.spy-ai-loading-transfer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.spy-ai-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #ff470f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.spy-ai-loading-transfer p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Chat Input Actions - Inside input wrapper */
.spy-ai-input-actions {
    display: none;
}

.spy-ai-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px 12px;
    background: #f5f5f5;
    border-radius: 25px;
}

.spy-ai-input-wrapper .spy-ai-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    outline: none;
}

.spy-ai-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    color: #999;
    flex-shrink: 0;
}

.spy-ai-action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #666;
}

.spy-ai-action-btn svg {
    width: 18px;
    height: 18px;
}

.spy-ai-action-btn.spy-ai-end-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.spy-ai-input-wrapper .spy-ai-send {
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.spy-ai-input-wrapper .spy-ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 71, 15, 0.4);
}

.spy-ai-input-wrapper .spy-ai-send svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

/* Emoji Picker Container */
.spy-ai-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    z-index: 1000;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: none;
}

.spy-ai-emoji-picker.active {
    display: block;
}

.spy-ai-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 10px;
    max-height: 180px;
    overflow-y: auto;
}

.spy-ai-emoji-btn {
    font-size: 20px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.15s;
}

.spy-ai-emoji-btn:hover {
    background: #f0f0f0;
}

/* Chat Ended Screen */
.spy-ai-ended {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    height: 100%;
}

.spy-ai-ended-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.spy-ai-ended-icon svg {
    width: 32px;
    height: 32px;
    color: #fff;
}

.spy-ai-ended h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.spy-ai-ended p {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px;
    line-height: 1.5;
}

.spy-ai-ended-btn {
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.spy-ai-ended-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 71, 15, 0.3);
}

/* Image Preview */
.spy-ai-image-preview {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.spy-ai-image-preview img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.spy-ai-image-preview-info {
    flex: 1;
    font-size: 12px;
    color: #666;
}

.spy-ai-image-preview-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spy-ai-image-preview-remove svg {
    width: 14px;
    height: 14px;
}

/* End Conversation Modal */
.spy-ai-end-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.spy-ai-end-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    max-width: 280px;
    width: 100%;
}

.spy-ai-end-modal h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.spy-ai-end-modal p {
    font-size: 13px;
    color: #666;
    margin: 0 0 20px;
}

.spy-ai-end-modal-btns {
    display: flex;
    gap: 10px;
}

.spy-ai-end-modal-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.spy-ai-end-modal-btn.cancel {
    background: #f5f5f5;
    color: #666;
}

.spy-ai-end-modal-btn.confirm {
    background: #dc2626;
    color: #fff;
}

.spy-ai-end-modal-btn:hover {
    transform: translateY(-1px);
}

/* Product Page AI Consult Button - Modern */
.pp-ai-consult-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(26, 26, 46, 0.3);
}

.pp-ai-consult-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.pp-ai-consult-btn:hover::before {
    left: 100%;
}

.pp-ai-consult-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 26, 46, 0.4);
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
}

.pp-ai-consult-btn:active {
    transform: translateY(0);
}

.pp-ai-consult-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pp-ai-consult-btn .ai-icon {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pp-ai-consult-btn .ai-icon svg {
    width: 14px;
    height: 14px;
}

/* Product Page AI Button - Legacy */
.product-ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    margin-top: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.product-ai-btn:hover {
    background: linear-gradient(135deg, #ff470f 0%, #ff6b3d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 15, 0.3);
}

.product-ai-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   CRITICAL: Universal Device Compatibility
   Ensures AI widget visibility on ALL devices
   ============================================ */

/* Extra small screens (iPhone SE, small Android) */
@media (max-width: 375px) {
    .spy-ai-widget {
        bottom: 80px !important; /* Above mobile bottom nav */
        left: 12px !important;
    }
    
    .spy-ai-btn {
        width: 52px !important;
        height: 52px !important;
    }
    
    .spy-ai-btn-icon {
        width: 32px !important;
        height: 32px !important;
    }
    
    .spy-ai-icon-img {
        width: 22px !important;
        height: 22px !important;
    }
    
    .spy-ai-chat {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 65px !important; /* Above mobile bottom nav */
        border-radius: 16px 16px 0 0 !important;
        height: calc(100vh - 130px) !important;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .spy-ai-widget {
        bottom: 24px !important;
        left: 24px !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .spy-ai-widget {
        position: fixed !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
    }
    
    .spy-ai-btn {
        -webkit-appearance: none !important;
        appearance: none !important;
    }
}

/* Firefox specific */
@-moz-document url-prefix() {
    .spy-ai-widget {
        position: fixed !important;
    }
}

/* Force visibility override - highest specificity */
/* Only apply to FIRST widget to prevent duplicates */
html body .spy-ai-widget:first-of-type,
html body .spy-ai-widget:first-of-type .spy-ai-btn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

html body .spy-ai-widget:first-of-type .spy-ai-btn {
    display: flex !important;
}

/* Hide any duplicate widgets */
html body .spy-ai-widget:not(:first-of-type) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Ensure widget is not hidden by any parent */
.spy-ai-widget,
.spy-ai-widget * {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

/* Print - hide widget */
@media print {
    .spy-ai-widget {
        display: none !important;
    }
}
