/* ===================================================
   SERVICETIHOSTING - WIDGET AGENTE AUTOMÁTICO & 
   Soporte : +56 9  6129
=================================================== */

:root {
    --bot-primary: #0ea5e9;
    --bot-primary-dark: #0284c7;
    --bot-wa-green: #25D366;
    --bot-wa-dark: #128C7E;
    --bot-bg: #ffffff;
    --bot-text: #0f172a;
    --bot-muted: #64748b;
    --bot-border: #e2e8f0;
    --bot-user-bg: #0ea5e9;
    --bot-bubble-bg: #f8fafc;
    --bot-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

/* Floating Container */
.sti-support-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* Teaser Bubble (Invitation) */
.sti-teaser-bubble {
    background: #ffffff;
    border: 1px solid var(--bot-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    padding: 12px 16px;
    max-width: 280px;
    cursor: pointer;
    position: relative;
    animation: stiFloat 3s ease-in-out infinite alternate;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
}

.sti-teaser-bubble:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
}

.sti-teaser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.sti-teaser-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--bot-text);
}

.sti-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--bot-wa-green);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    animation: stiPulse 1.8s infinite;
}

.sti-teaser-close {
    background: none;
    border: none;
    color: var(--bot-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.sti-teaser-close:hover {
    color: #ef4444;
}

.sti-teaser-body {
    font-size: 0.82rem;
    color: var(--bot-text);
    line-height: 1.35;
    margin-bottom: 6px;
}

.sti-teaser-phone {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--bot-wa-dark);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Floating Launcher Buttons */
.sti-launcher-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sti-btn-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0ea5e9 0%, #25D366 100%);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4), 0 4px 12px rgba(14, 165, 233, 0.3);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.sti-btn-fab:hover {
    transform: scale(1.08) rotate(4deg);
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.55), 0 6px 16px rgba(14, 165, 233, 0.4);
}

.sti-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Chat Window Modal */
.sti-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: var(--bot-shadow);
    border: 1px solid var(--bot-border);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000000;
    animation: stiSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sti-chat-window.open {
    display: flex;
}

/* Chat Header */
.sti-chat-header {
    background: linear-gradient(135deg, #0b0f19 0%, #1e293b 100%);
    color: #ffffff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--bot-wa-green);
    position: relative;
}

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

.sti-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #25D366);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 22px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sti-avatar-status {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: var(--bot-wa-green);
    border: 2px solid #0b0f19;
    border-radius: 50%;
}

.sti-header-text h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sti-header-text p {
    margin: 2px 0 0;
    font-size: 0.74rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sti-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sti-btn-header-wa {
    background: rgba(37, 211, 102, 0.2);
    border: 1px solid rgba(37, 211, 102, 0.4);
    color: #25D366;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: all 0.2s;
}

.sti-btn-header-wa:hover {
    background: #25D366;
    color: #ffffff;
    transform: translateY(-1px);
}

.sti-btn-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sti-btn-close:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}

/* Chat Body (Messages) */
.sti-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.sti-chat-body::-webkit-scrollbar {
    width: 6px;
}
.sti-chat-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.sti-chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Message Bubbles */
.sti-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: stiFadeIn 0.25s ease-out;
}

.sti-msg.bot {
    align-self: flex-start;
}

.sti-msg.user {
    align-self: flex-end;
}

.sti-msg-bubble {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.45;
    word-break: break-word;
}

.sti-msg.bot .sti-msg-bubble {
    background: #ffffff;
    color: var(--bot-text);
    border: 1px solid var(--bot-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.sti-msg.user .sti-msg-bubble {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 10px rgba(14, 165, 233, 0.3);
}

.sti-msg-time {
    font-size: 0.68rem;
    color: var(--bot-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.sti-msg.user .sti-msg-time {
    text-align: right;
}

/* Quick Action Options Grid inside Chat */
.sti-options-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--bot-muted);
    margin: 8px 0 6px;
    letter-spacing: 0.5px;
}

.sti-options-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.sti-opt-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.sti-opt-btn:hover {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0284c7;
    transform: translateX(3px);
}

.sti-opt-btn i {
    font-size: 0.95rem;
    color: #0ea5e9;
}

/*  Derivation Highlight Card */
.sti-derivation-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #86efac;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sti-derivation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #166534;
}

.sti-derivation-text {
    font-size: 0.78rem;
    color: #15803d;
    line-height: 1.35;
    margin: 0;
}

.sti-btn--direct {
    background: #25D366;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
    transition: all 0.2s ease;
}

.sti-btn--direct:hover {
    background: #1eb855;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.45);
    color: #ffffff;
}

.sti-btn-link-action {
    background: #e0f2fe;
    color: #0284c7;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    margin-top: 4px;
    transition: all 0.2s;
}

.sti-btn-link-action:hover {
    background: #0284c7;
    color: #ffffff;
}

/* Typing indicator */
.sti-typing-bubble {
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--bot-border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.sti-typing-bubble span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: stiTyping 1.2s infinite ease-in-out both;
}

.sti-typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.sti-typing-bubble span:nth-child(2) { animation-delay: -0.16s; }

/* Chat Footer Input */
.sti-chat-footer {
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid var(--bot-border);
}

.sti-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sti-input-field {
    flex: 1;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--bot-text);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.sti-input-field:focus {
    border-color: var(--bot-primary);
    background: #ffffff;
}

.sti-btn-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: var(--bot-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sti-btn-send:hover {
    background: var(--bot-primary-dark);
    transform: scale(1.05);
}

.sti-footer-notice {
    margin-top: 6px;
    font-size: 0.68rem;
    color: var(--bot-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sti-footer-notice a {
    color: var(--bot-wa-dark);
    font-weight: 700;
    text-decoration: none;
}

.sti-footer-notice a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes stiPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 7px rgba(37, 211, 102, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@keyframes stiFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-5px); }
}

@keyframes stiSlideUp {
    0% { opacity: 0; transform: translateY(20px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes stiFadeIn {
    0% { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes stiTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 480px) {
    .sti-chat-window {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
    }
    .sti-support-widget {
        bottom: 16px;
        right: 16px;
    }
}
