/* ============================================
   GIGI AI - Asistente Lunabel
   Paleta: Petroleo #2B5A57 → Petroleo Light #3d7a77
   ============================================ */

/* Botón Flotante */
.gigi-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(43, 90, 87, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: all 0.3s ease;
    overflow: hidden;
}

.gigi-fab img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.gigi-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(43, 90, 87, 0.6);
}

/* Widget */
.gigi-widget {
    position: fixed;
    bottom: min(100px, 15vh);
    right: 24px;
    width: min(420px, calc(100vw - 48px));
    max-height: 85vh;
    height: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    z-index: 99998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.gigi-widget.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.gigi-header {
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gigi-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gigi-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.gigi-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gigi-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.gigi-title span {
    font-size: 12px;
    opacity: 0.9;
}

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

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

.gigi-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Body */
.gigi-body {
    flex: 1;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gigi-chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Messages */
.gigi-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

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

.gigi-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.gigi-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Mensaje Usuario */
.gigi-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: msgIn 0.3s ease;
}

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

.gigi-msg.user {
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.gigi-msg.bot {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typing */
.typing {
    display: flex;
    gap: 4px;
    padding: 14px 16px;
}

.typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Quick Actions */
.gigi-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    max-height: 120px;
    overflow-y: auto;
}

.gigi-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #e8f0ef;
    color: #2B5A57;
    border: 1px solid #2B5A57;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.gigi-action-btn i {
    font-size: 14px;
}

.gigi-action-btn:hover {
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    border-color: transparent;
    transform: scale(1.05);
}

/* Productos Grid */
.gigi-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 8px 0;
}

.gigi-product-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.gigi-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.gigi-product-img {
    width: 100%;
    height: 95px;
    background: #f5f5f5;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gigi-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gigi-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #ccc;
    font-size: 32px;
}

.gigi-product-info {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gigi-product-cat {
    font-size: 9px;
    color: #2B5A57;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gigi-product-name {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gigi-product-price {
    font-size: 15px;
    font-weight: 800;
    color: #1a4a4a;
    margin-top: auto;
}

.gigi-product-stock {
    font-size: 10px;
    color: #28a745;
    font-weight: 500;
}

.gigi-product-stock i {
    margin-right: 3px;
}

.gigi-product-actions {
    display: flex;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.gigi-product-actions button {
    flex: 1;
    padding: 9px 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    color: #6c757d;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.gigi-product-actions .btn-cart:hover {
    color: #28a745;
    background: #e8f5e9;
}

.gigi-product-actions .btn-cart.success {
    color: #28a745;
    background: #e8f5e9;
}

.gigi-product-actions .btn-buy {
    color: #2B5A57 !important;
    font-weight: 600;
}

.gigi-product-actions .btn-buy:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #2B5A57, #3d7a77) !important;
}

.gigi-product-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Category Buttons */
.gigi-category-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.gigi-cat-btn {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gigi-cat-btn i {
    color: #2B5A57;
    font-size: 16px;
}

.gigi-cat-btn:hover {
    background: #e8f0ef;
    border-color: #3d7a77;
    transform: translateX(4px);
}

/* Botones especiales */
.gigi-btn-wsp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #25D366;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.2s;
}

.gigi-btn-wsp:hover {
    background: #128C7E;
    transform: scale(1.02);
}

.gigi-btn-fb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #1877F2;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.2s;
}

.gigi-btn-fb:hover {
    background: #0d65d9;
    transform: scale(1.02);
}

.gigi-btn-ig {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.2s;
}

.gigi-btn-ig:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.gigi-btn-email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #EA4335;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.2s;
}

.gigi-btn-email:hover {
    background: #d33b2c;
    transform: scale(1.02);
}

.gigi-btn-pay {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    margin-top: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(43, 90, 87, 0.4);
}

.gigi-btn-pay:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(43, 90, 87, 0.6);
}

/* Audio Player */
.gigi-audio-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #e8f0ef;
    border-radius: 20px;
    align-self: flex-start;
    margin-top: 4px;
}

.gigi-audio-play {
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.gigi-audio-play:hover {
    transform: scale(1.05);
}

/* Input Area */
.gigi-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    align-items: center;
}

.gigi-input-area input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.gigi-input-area input:focus {
    border-color: #2B5A57;
}

#gigi-voice {
    background: #f5f5f5;
    color: #666;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

#gigi-voice:hover {
    background: #e0e0e0;
}

#gigi-voice.recording {
    background: #dc3545;
    color: #fff;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
}

#gigi-send {
    background: linear-gradient(135deg, #2B5A57, #3d7a77);
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

#gigi-send:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 480px) {
    .gigi-widget {
        width: calc(100vw - 32px);
        max-height: 90vh;
        bottom: 90px;
        right: 16px;
        left: 16px;
        border-radius: 16px;
    }

    .gigi-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .gigi-products-grid {
        grid-template-columns: 1fr;
    }

    .gigi-msg {
        max-width: 90%;
    }

    .gigi-quick-actions {
        padding: 10px 12px;
        gap: 6px;
    }

    .gigi-action-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .gigi-input-area {
        padding: 10px 12px;
        gap: 6px;
    }

    .gigi-input-area input {
        padding: 9px 14px;
        font-size: 14px;
    }

    #gigi-voice,
    #gigi-send {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .gigi-widget {
        width: calc(100vw - 16px);
        right: 8px;
        left: 8px;
        max-height: 92vh;
    }

    .gigi-header {
        padding: 14px 16px;
    }

    .gigi-messages {
        padding: 12px;
    }

    .gigi-input-area {
        padding: 8px 10px;
    }
}

@media (min-width: 768px) {
    .gigi-widget {
        width: 420px;
        max-height: 80vh;
    }
}
