/* SalesCloud Chatbot Styles */

/* Reset: neutralizar estilos globales de WP/Gutenberg/Woodmart en botones del chatbot */
#scbot-container button,
#scbot-container button:hover,
#scbot-container button:focus {
    background-color: transparent;
    padding: 0;
    margin: 0;
    border: none;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
}

#scbot-container {
    position: fixed;
    bottom: 80px;   /* encima del scroll-to-top de Woodmart (50px + 20px base + 10px margen) */
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Toggle Button */
#scbot-container #scbot-toggle {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: var(--scbot-primary, #2AB9AD) !important;
    background-color: var(--scbot-primary, #2AB9AD) !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#scbot-container #scbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#scbot-toggle svg {
    width: 28px;
    height: 28px;
}

/* Foto del agente en el botón toggle */
#scbot-container #scbot-toggle {
    overflow: hidden !important;
}

.scbot-toggle-avatar {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
}

/* Foto del agente en el header del chat */
.scbot-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* Chat Window */
#scbot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.scbot-closed #scbot-window {
    display: none;
}

.scbot-open #scbot-window {
    display: flex;
    animation: scbot-slide-up 0.3s ease;
}

.scbot-open #scbot-icon-chat {
    display: none;
}

.scbot-open #scbot-icon-close {
    display: block !important;
}

@keyframes scbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
#scbot-header {
    background: var(--scbot-primary, #2AB9AD);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.scbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.scbot-title {
    font-weight: 600;
    font-size: 16px;
}

.scbot-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

#scbot-container #scbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#scbot-container #scbot-close:hover {
    opacity: 1;
}

#scbot-close svg {
    width: 20px;
    height: 20px;
}

/* Messages */
#scbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scbot-message-wrap {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

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

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

.scbot-message {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.scbot-message-user {
    background: var(--scbot-primary, #2AB9AD);
    color: white;
    border-bottom-right-radius: 4px;
}

.scbot-message-bot {
    background: #f0f2f5;
    color: #1c1e21;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
#scbot-typing {
    padding: 0 16px 8px;
}

.scbot-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f2f5;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.scbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #90949c;
    border-radius: 50%;
    animation: scbot-typing 1.4s infinite ease-in-out both;
}

.scbot-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes scbot-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.6;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Form */
#scbot-form {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-top: 1px solid #e4e6eb;
}

#scbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e4e6eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#scbot-input:focus {
    border-color: var(--scbot-primary, #2AB9AD);
}

/* Mic Button */
#scbot-container #scbot-mic {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #e4e6eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #65676b;
    transition: all 0.2s;
}

#scbot-container #scbot-mic:hover {
    background: #f0f2f5;
    color: var(--scbot-primary, #2AB9AD);
}

#scbot-container #scbot-mic.scbot-recording {
    background: #ff4444;
    border-color: #ff4444;
    color: white;
    animation: scbot-pulse 1.2s ease-in-out infinite;
}

#scbot-mic svg {
    width: 20px;
    height: 20px;
}

#scbot-mic.scbot-mic-unsupported {
    display: none;
}

@keyframes scbot-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(255, 68, 68, 0); }
}

#scbot-container #scbot-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--scbot-primary, #2AB9AD);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

#scbot-container #scbot-send:hover {
    background: var(--scbot-primary-dark, #239990);
}

#scbot-container #scbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#scbot-send svg {
    width: 20px;
    height: 20px;
}

/* Speaker button on bot messages */
#scbot-container .scbot-speak-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #90949c;
    padding: 0;
    margin-top: 4px;
    transition: color 0.2s, background 0.2s;
}

#scbot-container .scbot-speak-btn:hover {
    color: var(--scbot-primary, #2AB9AD);
    background: rgba(0, 0, 0, 0.05);
}

#scbot-container .scbot-speak-btn.scbot-speaking {
    color: var(--scbot-primary, #2AB9AD);
}

.scbot-speak-btn svg {
    width: 16px;
    height: 16px;
}

/* Footer */
#scbot-footer {
    padding: 8px;
    text-align: center;
    font-size: 11px;
    color: #90949c;
    background: #f8f9fa;
}

#scbot-footer a {
    color: var(--scbot-primary, #2AB9AD);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 480px) {
    #scbot-container {
        bottom: 10px;
        right: 10px;
    }

    #scbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
        border-radius: 12px;
    }

    #scbot-toggle {
        width: 54px;
        height: 54px;
    }
}
