/* ====================================================
   EcoSun Solar Chat - Frontend CSS
   ==================================================== */

#ecosun-chat-wrapper {
    position: fixed;
    z-index: 999999;
    font-family: 'Segoe UI', 'Open Sans', Arial, sans-serif;
}

/* Posicionamiento */
#ecosun-chat-wrapper.ecosun-pos-bottom-right {
    bottom: 24px;
    right: 24px;
}
#ecosun-chat-wrapper.ecosun-pos-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* ---- BOTÓN FLOTANTE ---- */
#ecosun-chat-toggle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #F5A623, #E8760A);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245, 166, 35, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    padding: 0;
}
#ecosun-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(245, 166, 35, 0.6);
}

/* Pulso animado */
#ecosun-chat-toggle::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(245, 166, 35, 0.3);
    animation: ecosun-pulse 2s infinite;
}


#ecosun-chat-toggle img {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
        display: block;
    margin: auto;
}




@keyframes ecosun-pulse {
    0%   { transform: scale(1);   opacity: 1; }
    70%  { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* ---- VENTANA DEL CHAT ---- */
#ecosun-chat-box {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ecosun-slideUp 0.25s ease-out;
}
.ecosun-pos-bottom-left #ecosun-chat-box {
    right: auto;
    left: 0;
}
@keyframes ecosun-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- HEADER ---- */
#ecosun-chat-header {
    background: linear-gradient(135deg, #F5A623, #E8760A);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ecosun-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ecosun-avatar {
    font-size: 22px;
    background: rgba(255,255,255,0.2);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#ecosun-chat-header strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
}
#ecosun-chat-header small {
    font-size: 11px;
    opacity: 0.85;
}
#ecosun-chat-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#ecosun-chat-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ---- MENSAJES ---- */
#ecosun-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}
#ecosun-chat-messages::-webkit-scrollbar { width: 4px; }
#ecosun-chat-messages::-webkit-scrollbar-track { background: transparent; }
#ecosun-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Burbujas */
.ecosun-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    animation: ecosun-fadeIn 0.2s ease;
    word-break: break-word;
}
@keyframes ecosun-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ecosun-bubble.bot {
    background: #fff;
    color: #333;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.ecosun-bubble.user {
    background: linear-gradient(135deg, #F5A623, #E8760A);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.ecosun-bubble.bot strong {
    display: block;
    font-size: 11px;
    color: #F5A623;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Typing indicator */
.ecosun-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.ecosun-typing span {
    width: 7px;
    height: 7px;
    background: #F5A623;
    border-radius: 50%;
    animation: ecosun-bounce 1.2s infinite;
}
.ecosun-typing span:nth-child(2) { animation-delay: 0.2s; }
.ecosun-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ecosun-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* ---- FOOTER / INPUT ---- */
#ecosun-chat-footer {
    padding: 10px 14px 8px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
#ecosun-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 6px 8px;
    transition: border-color 0.2s;
}
#ecosun-chat-input-wrap:focus-within {
    border-color: #F5A623;
}
#ecosun-chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 13.5px;
    font-family: inherit;
    line-height: 1.5;
    max-height: 100px;
    background: transparent;
    color: #333;
}
#ecosun-chat-input::placeholder { color: #aaa; }
#ecosun-chat-send {
    background: linear-gradient(135deg, #2E7D32, #43A047);
    border: none;
    border-radius: 8px;
    color: #fff;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}
#ecosun-chat-send:hover  { opacity: 0.9; }
#ecosun-chat-send:active { transform: scale(0.95); }
#ecosun-chat-send:disabled { opacity: 0.4; cursor: default; }

#ecosun-chat-powered {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    margin-top: 5px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 420px) {
    #ecosun-chat-box {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 68px;
    }
    .ecosun-pos-bottom-left #ecosun-chat-box {
        left: -8px;
        right: auto;
    }
}
