/* AI Amazon Affiliate Popup Styles v2.0 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    --popup-primary: #FF9500;
    --popup-secondary: #FF6B35;
    --popup-dark: #1a1a2e;
    --popup-light: #f8f9fa;
    --popup-text: #2d3436;
    --popup-border: #e0e0e0;
    --popup-shadow: rgba(0, 0, 0, 0.15);
    --popup-accent: #00D9FF;
    --sale-red: #FF3B30;
}

.ai-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-popup-container {
    position: relative;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    border: 2px solid var(--popup-accent);
}

@keyframes slideUp {
    from {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.ai-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--popup-dark);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-popup-close:hover {
    background: var(--popup-secondary);
    transform: rotate(90deg) scale(1.1);
}

.ai-popup-content {
    display: flex;
    flex-direction: column;
    height: 650px;
    max-height: 85vh;
}

.ai-chat-header {
    background: linear-gradient(135deg, var(--popup-primary) 0%, var(--popup-secondary) 100%);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 3px solid var(--popup-accent);
}

.ai-avatar {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ai-header-text h3 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-header-text p {
    margin: 4px 0 0 0;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

/* Initial Products Display */
.initial-products-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

.products-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--popup-border);
    border-top: 4px solid var(--popup-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.products-loading p {
    margin-top: 16px;
    font-family: 'Outfit', sans-serif;
    color: var(--popup-text);
}

/* Sale Category Display */
.sale-category-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 400px;
    animation: fadeInUp 0.6s ease-out;
}

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

.sale-badge-large {
    background: linear-gradient(135deg, var(--sale-red) 0%, #FF1744 100%);
    color: white;
    padding: 16px 32px;
    border-radius: 50px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
    margin-bottom: 32px;
    animation: pulseSale 2s ease-in-out infinite;
}

@keyframes pulseSale {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 32px rgba(255, 59, 48, 0.6);
    }
}

.fire-emoji {
    font-size: 24px;
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.view-sales-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--popup-primary) 0%, var(--popup-secondary) 100%);
    color: white;
    padding: 18px 40px;
    border-radius: 16px;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.4);
    margin-bottom: 24px;
}

.view-sales-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 149, 0, 0.6);
    background: linear-gradient(135deg, #FFB340 0%, #FF7B50 100%);
}

.view-sales-btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* Pet Joke Styling */
.pet-joke-container {
    margin: 24px 0;
    width: 100%;
}

.joke-loading {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: #999;
    text-align: center;
    font-style: italic;
    padding: 20px;
}

.pet-joke {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE6CC 100%);
    padding: 20px 24px;
    border-radius: 16px;
    border: 2px solid var(--popup-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--popup-dark);
    text-align: center;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.2);
    animation: jokeSlideIn 0.5s ease-out;
}

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

/* Options Container */
.options-container {
    margin-top: 32px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-link {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    padding: 16px 20px;
    border-radius: 16px;
    text-decoration: none;
    border: 2px solid var(--popup-accent);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.option-link:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.3);
    border-color: var(--popup-primary);
}

.option-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--popup-accent) 0%, #00A8CC 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.option-text {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--popup-dark);
}

.pet-joke-chat {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE6CC 100%);
    padding: 16px 20px;
    border-radius: 16px;
    border: 2px solid var(--popup-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--popup-dark);
    text-align: center;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.2);
    margin: 16px 0;
    animation: jokeSlideIn 0.5s ease-out;
}

.product-grid {
    display: grid;
    gap: 16px;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    animation: productSlideIn 0.4s ease-out;
    position: relative;
}

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

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: var(--popup-accent);
}

.product-card.on-sale::before {
    content: '🔥 ON SALE NOW';
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--sale-red);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
}

.product-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-card img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-info {
    padding: 16px;
}

.product-name {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--popup-dark);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.product-price-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.product-price {
    font-family: 'Space Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--popup-primary);
}

.product-original-price {
    font-family: 'Space Mono', monospace;
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
}

.product-link-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--popup-primary) 0%, var(--popup-secondary) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.product-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.5);
    background: linear-gradient(135deg, #FFB340 0%, #FF7B50 100%);
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    gap: 16px;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: var(--popup-primary);
    border-radius: 4px;
}

.ai-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
    margin-bottom: 16px;
}

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

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

.ai-message-user {
    align-self: flex-end;
}

.message-content {
    padding: 14px 18px;
    border-radius: 18px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-message-bot .message-content {
    background: white;
    color: var(--popup-text);
    border: 2px solid var(--popup-accent);
    border-bottom-left-radius: 4px;
}

.ai-message-user .message-content {
    background: linear-gradient(135deg, var(--popup-primary) 0%, var(--popup-secondary) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 14px 18px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 2px solid var(--popup-accent);
    width: fit-content;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--popup-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input Container */
.ai-chat-input-container {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: white;
    border-top: 2px solid var(--popup-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.ai-chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--popup-border);
    border-radius: 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: var(--popup-light);
}

.ai-chat-input:focus {
    border-color: var(--popup-accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.1);
}

.ai-send-button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--popup-primary) 0%, var(--popup-secondary) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.ai-send-button:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.ai-send-button:active {
    transform: scale(0.95) rotate(0deg);
}

.ai-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .ai-popup-container {
        width: 95%;
        max-width: none;
        border-radius: 20px;
    }
    
    .ai-popup-content {
        height: 550px;
    }
    
    .product-image-container {
        height: 160px;
    }
    
    .ai-chat-header {
        padding: 20px 16px;
    }
    
    .initial-products-container,
    .ai-chat-messages {
        padding: 16px;
    }
    
    .ai-chat-input-container {
        padding: 16px;
    }
}
