/**
 * ============================================================================
 * GIGI IA - ESTILOS DEL CHAT
 * ============================================================================
 * Estilos para el widget de chat de Gigi IA
 * ============================================================================
 */

/* Variables CSS */
:root {
    --gigi-negro: #2B2B2B;
    --gigi-crema: #F5E6E0;
    --gigi-rosa: #E8A1B2;
    --gigi-rosa-oscuro: #D48A9A;
    --gigi-blanco: #FFFFFF;
    --gigi-gris-claro: #F5F5F5;
    --gigi-gris: #E0E0E0;
    --gigi-gris-oscuro: #9E9E9E;
    
    --gigi-gradient-header: linear-gradient(135deg, #2B2B2B 0%, #1A1A1A 100%);
    --gigi-gradient-rosa: linear-gradient(135deg, #E8A1B2 0%, #D48A9A 100%);
    
    --gigi-sombra: 0 4px 20px rgba(0, 0, 0, 0.15);
    --gigi-sombra-hover: 0 8px 30px rgba(0, 0, 0, 0.2);
    --gigi-radio: 16px;
    --gigi-radio-sm: 8px;
}

/* Chat Button */
.gigi-chat-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    z-index: 1;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    background: transparent;
    mix-blend-mode: multiply;
}

.gigi-chat-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: var(--gigi-gradient-rosa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--gigi-sombra);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 999998;
    border: none;
    padding: 0;
    overflow: hidden;
    animation: gigiPulse 2s ease-in-out infinite;
}

.gigi-chat-button:hover {
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 8px 35px rgba(232, 161, 178, 0.5);
    animation: gigiWiggle 0.5s ease-in-out;
}

@keyframes gigiPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(232, 161, 178, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 30px rgba(232, 161, 178, 0.7);
        transform: scale(1.05);
    }
}

@keyframes gigiWiggle {
    0%, 100% { transform: scale(1.15) rotate(-5deg); }
    25% { transform: scale(1.15) rotate(5deg); }
    50% { transform: scale(1.15) rotate(-5deg); }
    75% { transform: scale(1.15) rotate(5deg); }
}

.gigi-chat-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: gigiShine 3s ease-in-out infinite;
    opacity: 0;
}

.gigi-chat-button:hover::before {
    opacity: 1;
    animation-duration: 1s;
}

@keyframes gigiShine {
    0% {
        transform: rotate(0deg) translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: rotate(360deg) translateX(100%);
        opacity: 0;
    }
}

.gigi-chat-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    z-index: 1;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    background: transparent;
}

.gigi-chat-button:hover .gigi-chat-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(232, 161, 178, 0.6));
}

.gigi-chat-button-hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Chat Window */
.gigi-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 360px;
    max-width: calc(100vw - 60px);
    height: 550px;
    max-height: calc(100vh - 180px);
    background: var(--gigi-blanco);
    border-radius: var(--gigi-radio);
    box-shadow: var(--gigi-sombra);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999997;

    /* Estado inicial (oculto) */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.gigi-chat-window.gigi-chat-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.gigi-chat-header {
    background: var(--gigi-gradient-header);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    min-height: 70px;
}

.gigi-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow: hidden;
}

.gigi-avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gigi-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    border: 2px solid var(--gigi-crema);
    background: var(--gigi-blanco);
    padding: 4px;
    mix-blend-mode: normal;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 15px rgba(232, 161, 178, 0.6));
}

.gigi-avatar-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 11px;
    height: 11px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid var(--gigi-negro);
    z-index: 10;
}

.gigi-header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.gigi-chat-title {
    color: var(--gigi-blanco);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.gigi-chat-subtitle {
    color: var(--gigi-gris-claro);
    font-size: 0.8rem;
    margin: 3px 0 0 0;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.gigi-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin-left: auto;
}

.gigi-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
}

.gigi-close-btn svg {
    color: var(--gigi-blanco);
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

/* Messages Container */
.gigi-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--gigi-gris-claro);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

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

.gigi-chat-messages::-webkit-scrollbar-thumb {
    background: var(--gigi-gris);
    border-radius: 3px;
}

.gigi-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gigi-gris-oscuro);
}

/* Messages */
.gigi-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: gigiMessageSlide 0.3s ease;
}

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

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

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

.gigi-message-content {
    padding: 12px 16px;
    border-radius: var(--gigi-radio);
    font-size: 0.95rem;
    line-height: 1.5;
}

.gigi-message-user .gigi-message-content {
    background: var(--gigi-gradient-rosa);
    color: var(--gigi-blanco);
    border-bottom-right-radius: 4px;
}

.gigi-message-bot .gigi-message-content {
    background: var(--gigi-blanco);
    color: var(--gigi-negro);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gigi-message-content p {
    margin: 0;
    word-wrap: break-word;
}

.gigi-message-html {
    line-height: 1.6;
}

.gigi-message-html img {
    max-width: 150px;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gigi-message-html br {
    line-height: 1.5;
}

/* Botón Agregar al Carrito */
.gigi-add-cart-btn {
    background: linear-gradient(135deg, #E8A1B2 0%, #D48A9A 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin: 8px 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(232, 161, 178, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    pointer-events: auto;
}

.gigi-add-cart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(232, 161, 178, 0.5);
    background: linear-gradient(135deg, #D48A9A 0%, #C07585 100%);
}

.gigi-add-cart-btn:active {
    transform: scale(0.98);
}

/* Contenedor de producto en el chat */
.gigi-product-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
}

.gigi-product-image {
    max-width: 150px;
    border-radius: 8px;
    margin: 5px 0;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gigi-message-time {
    font-size: 0.75rem;
    color: var(--gigi-gris-oscuro);
    margin-top: 5px;
    padding: 0 5px;
}

/* Typing Indicator */
.gigi-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

.gigi-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gigi-gris-oscuro);
    border-radius: 50%;
    animation: gigiTyping 1.4s infinite;
}

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

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

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

/* Input Area */
.gigi-chat-input-area {
    padding: 15px 20px;
    background: var(--gigi-blanco);
    border-top: 1px solid var(--gigi-gris);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.gigi-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gigi-gris);
    border-radius: 25px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.gigi-chat-input:focus {
    border-color: var(--gigi-rosa);
    box-shadow: 0 0 0 3px rgba(232, 161, 178, 0.2);
}

.gigi-chat-input::placeholder {
    color: var(--gigi-gris-oscuro);
}

.gigi-send-btn {
    width: 45px;
    height: 45px;
    background: var(--gigi-gradient-rosa);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.gigi-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(232, 161, 178, 0.4);
}

.gigi-send-btn:active {
    transform: scale(0.95);
}

.gigi-send-btn svg {
    color: var(--gigi-blanco);
}

.gigi-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 480px) {
    .gigi-chat-button {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
    }

    .gigi-chat-icon {
        width: 28px;
        height: 28px;
    }

    .gigi-chat-button-text {
        display: none;
    }

    .gigi-chat-window {
        bottom: 90px;
        right: 15px;
        left: 15px;
        width: auto;
        max-width: none;
        height: calc(100vh - 150px);
        min-height: 400px;
        max-height: none;
    }

    .gigi-chat-header {
        padding: 14px 15px;
    }

    .gigi-avatar-container {
        width: 42px;
        height: 42px;
    }

    .gigi-chat-title {
        font-size: 1rem;
    }

    .gigi-chat-subtitle {
        font-size: 0.75rem;
    }

    .gigi-chat-messages {
        padding: 15px;
    }

    .gigi-chat-input-area {
        padding: 12px 15px;
    }
}
