/* ========================================
   BotGT Chat - Modern Design System
   ======================================== */

:root {
    --botgt-primary: #059669;
    --botgt-primary-light: rgba(5, 150, 105, 0.1);
    --botgt-primary-dark: #047857;
    --botgt-secondary: #0d9488;
    --botgt-gradient: linear-gradient(135deg, #059669 0%, #0d9488 100%);
    --botgt-bg: #f8fafc;
    --botgt-card: #ffffff;
    --botgt-border: #e2e8f0;
    --botgt-text: #1e293b;
    --botgt-text-muted: #64748b;
    --botgt-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --botgt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --botgt-radius: 16px;
    --botgt-radius-sm: 12px;
}

/* Main Container */
.botgt-chat {
    border: 1px solid var(--botgt-border);
    border-radius: var(--botgt-radius);
    background: var(--botgt-card);
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: var(--botgt-shadow-lg);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.botgt-chat-frontend {
    height: 560px;
}

/* Header */
.botgt-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--botgt-gradient);
    color: white;
    border-bottom: 1px solid var(--botgt-border);
}

.botgt-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.botgt-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    position: relative;
}

.botgt-avatar svg {
    width: 24px;
    height: 24px;
}

.botgt-avatar-bot {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

.botgt-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.botgt-chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.botgt-chat-title {
    font-weight: 700;
    font-size: 16px;
}

.botgt-chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

.botgt-chat-header-actions {
    display: flex;
    gap: 8px;
}

.botgt-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.botgt-btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.botgt-btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Messages Area */
.botgt-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    scroll-behavior: smooth;
}

.botgt-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.botgt-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.botgt-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Welcome Screen */
.botgt-chat-welcome {
    text-align: center;
    padding: 40px 20px;
}

.botgt-welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--botgt-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.3);
}

.botgt-welcome-icon svg {
    width: 40px;
    height: 40px;
}

.botgt-chat-welcome h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--botgt-text);
    margin: 0 0 12px;
}

.botgt-chat-welcome p {
    color: var(--botgt-text-muted);
    max-width: 400px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

.botgt-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.botgt-quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--botgt-border);
    border-radius: 24px;
    background: white;
    color: var(--botgt-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.botgt-quick-btn:hover {
    border-color: var(--botgt-primary);
    background: var(--botgt-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--botgt-shadow);
}

.quick-icon {
    font-size: 16px;
}

/* Message Bubbles */
.botgt-chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: messageIn 0.3s ease;
}

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

.botgt-chat-message .botgt-avatar {
    width: 36px;
    height: 36px;
    background: var(--botgt-primary-light);
    color: var(--botgt-primary);
}

.botgt-chat-message .botgt-avatar svg {
    width: 18px;
    height: 18px;
}

.botgt-chat-message-user {
    flex-direction: row-reverse;
}

.botgt-chat-message-user .botgt-avatar {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
}

.botgt-message-bubble {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.botgt-chat-message-content {
    padding: 12px 16px;
    border-radius: var(--botgt-radius-sm);
    background: white;
    color: var(--botgt-text);
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--botgt-border);
}

.botgt-chat-message-user .botgt-chat-message-content {
    background: var(--botgt-gradient);
    color: white;
    border: none;
}

.botgt-message-time {
    font-size: 11px;
    color: var(--botgt-text-muted);
    padding: 0 4px;
}

.botgt-chat-message-user .botgt-message-time {
    text-align: right;
}

/* Typing Indicator */
.botgt-typing-dots {
    display: flex;
    gap: 4px;
    padding: 16px;
}

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

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

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

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

/* Footer & Form */
.botgt-chat-footer {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--botgt-border);
}

.botgt-chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.botgt-input-container {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--botgt-bg);
    border: 2px solid var(--botgt-border);
    border-radius: 28px;
    padding: 4px 4px 4px 20px;
    transition: all 0.2s ease;
}

.botgt-input-container:focus-within {
    border-color: var(--botgt-primary);
    box-shadow: 0 0 0 3px var(--botgt-primary-light);
}

.botgt-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 15px;
    color: var(--botgt-text);
    outline: none;
    font-family: inherit;
}

.botgt-chat-input::placeholder {
    color: var(--botgt-text-muted);
}

.botgt-chat-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--botgt-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.botgt-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.botgt-chat-send:active {
    transform: scale(0.95);
}

.botgt-chat-send svg {
    width: 20px;
    height: 20px;
}

.botgt-chat-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--botgt-text-muted);
}

/* Product Cards in Chat */
.botgt-chat .ai-product-card {
    border: 1px solid var(--botgt-border);
    border-radius: var(--botgt-radius-sm);
    padding: 16px;
    margin: 12px 0;
    background: white;
    transition: all 0.2s ease;
}

.botgt-chat .ai-product-card:hover {
    border-color: var(--botgt-primary);
    box-shadow: var(--botgt-shadow);
}

.botgt-chat .ai-product-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--botgt-text);
}

.botgt-chat .ai-product-price {
    font-weight: 700;
    font-size: 18px;
    color: var(--botgt-primary);
    margin-bottom: 8px;
}

.botgt-chat .ai-product-stock {
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.botgt-chat .ai-product-stock::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.botgt-chat .ai-product-stock.in-stock { color: #15803d; }
.botgt-chat .ai-product-stock.in-stock::before { background: #22c55e; }
.botgt-chat .ai-product-stock.low-stock { color: #b45309; }
.botgt-chat .ai-product-stock.low-stock::before { background: #f59e0b; }
.botgt-chat .ai-product-stock.out-of-stock { color: #b91c1c; }
.botgt-chat .ai-product-stock.out-of-stock::before { background: #ef4444; }

.botgt-chat .ai-product-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.botgt-chat .ai-product-actions .ai-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--botgt-border);
    background: var(--botgt-bg);
    text-decoration: none;
    color: var(--botgt-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.botgt-chat .ai-product-actions .ai-btn:hover {
    background: var(--botgt-primary-light);
    border-color: var(--botgt-primary);
}

.botgt-chat .ai-product-actions .ai-btn-primary {
    background: var(--botgt-gradient);
    color: white;
    border: none;
}

.botgt-chat .ai-product-actions .ai-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .botgt-chat {
        height: 500px;
        border-radius: var(--botgt-radius-sm);
    }
    
    .botgt-chat-frontend {
        height: 480px;
    }
    
    .botgt-chat-header {
        padding: 12px 16px;
    }
    
    .botgt-avatar {
        width: 38px;
        height: 38px;
    }
    
    .botgt-chat-title {
        font-size: 15px;
    }
    
    .botgt-chat-messages {
        padding: 16px;
    }
    
    .botgt-message-bubble {
        max-width: 85%;
    }
    
    .botgt-quick-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .botgt-chat-footer {
        padding: 12px 16px;
    }
    
    .botgt-input-container {
        padding: 2px 2px 2px 16px;
    }
    
    .botgt-chat-input {
        padding: 10px 0;
        font-size: 14px;
    }
    
    .botgt-chat-send {
        width: 42px;
        height: 42px;
    }
}

/* ========================================
   Fix Welcome Screen SVG Sizing
   ======================================== */

.botgt-chat-welcome .botgt-welcome-icon svg {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px;
    max-height: 40px;
}

.botgt-chat-header .botgt-avatar svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px;
    max-height: 24px;
}

/* Ensure proper containment */
.botgt-welcome-icon {
    overflow: hidden;
}

.botgt-avatar svg {
    flex-shrink: 0;
}

/* Spanish locale adjustments */
.botgt-quick-btn span:last-child {
    white-space: nowrap;
}
