/**
 * Estilos CSS para el widget de chat
 */

/* Variables */
:root {
    --scc-primary-color: #1e8e0e; /* Un verde más elegante */
    --scc-hover-color: #2eaf1e; /* Verde más claro para hover */
    --scc-text-color: #333333;
    --scc-bg-color: #FFFFFF;
    --scc-light-bg: #F5F5F5;
    --scc-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    --scc-border-radius: 16px;
    --scc-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Contenedor principal */
#scc-chat-widget {
    font-family: var(--scc-font-family);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    color: var(--scc-text-color);
    line-height: 1.5;
    font-size: 14px;
}

/* Botón de chat mejorado */
#scc-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--scc-primary-color) 0%, #156e08 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    z-index: 9998;
}

#scc-chat-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

#scc-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background: linear-gradient(135deg, var(--scc-hover-color) 0%, var(--scc-primary-color) 100%);
}

#scc-chat-button:hover:before {
    opacity: 1;
}

#scc-chat-button:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Ventana de chat mejorada */
#scc-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background-color: var(--scc-bg-color);
    border-radius: var(--scc-border-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
}

/* Encabezado mejorado */
#scc-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--scc-primary-color) 0%, #156e08 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

#scc-chat-header span {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.3px;
}

#scc-chat-header:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.2), rgba(255,255,255,0));
}

/* Botón de cierre mejorado */
#scc-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-right: -8px;
}

#scc-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

#scc-chat-close svg {
    width: 16px;
    height: 16px;
}

/* Contenedor de mensajes */
#scc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--scc-light-bg);
}

/* Mensajes */
.scc-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scc-assistant-message {
    flex-direction: row;
}

.scc-message-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--scc-primary-color) 0%, #156e08 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.scc-message-content {
    background-color: white;
    padding: 12px 15px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.scc-user-message {
    flex-direction: row-reverse;
}

.scc-user-message .scc-message-content {
    background: linear-gradient(135deg, var(--scc-primary-color) 0%, #156e08 100%);
    color: white;
    border-radius: 18px;
    border-top-right-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.scc-error-message .scc-message-content {
    background-color: #FFF0F0;
    color: #D32F2F;
}

/* Indicador de escritura */
#scc-typing-indicator {
    padding: 10px 20px;
    display: flex;
    align-items: center;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    margin-right: 4px;
    animation: bounce 1.5s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}

/* Área de entrada mejorada */
#scc-chat-input-container {
    padding: 12px 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    background-color: white;
}

#scc-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 100px;
    padding: 10px 15px;
    border: 1px solid #e6e6e6;
    border-radius: 20px;
    resize: none;
    font-family: var(--scc-font-family);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#scc-chat-input:focus {
    border-color: var(--scc-primary-color);
    box-shadow: 0 1px 5px rgba(30, 142, 14, 0.2);
}

/* Botón de envío mejorado */
#scc-chat-send {
    margin-left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--scc-primary-color) 0%, #156e08 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#scc-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, var(--scc-hover-color) 0%, var(--scc-primary-color) 100%);
}

/* Branding mejorado */
#scc-chat-branding {
    padding: 8px 0;
    text-align: center;
    font-size: 11px;
    color: #999;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

#scc-chat-branding a {
    color: var(--scc-primary-color);
    font-weight: 500;
    text-decoration: none;
}

#scc-chat-branding a:hover {
    text-decoration: underline;
}

/* Estilos para código */
.scc-message-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.scc-message-content code {
    font-family: monospace;
    font-size: 13px;
}

/* Estilos para enlaces */
.scc-message-content a {
    color: #2979FF;
    text-decoration: none;
}

.scc-user-message .scc-message-content a {
    color: #FFFFFF;
    text-decoration: underline;
}

.scc-message-content a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    #scc-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 80px;
        right: 20px;
    }
}

/* Scrollbar personalizado */
#scc-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#scc-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

#scc-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

#scc-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}