/* ===== ZentexNode Webchat Widget — Tema oscuro/morado (2026-08) ===== */
/* Paleta: bg #07070d/#0c0c17, surface #12121f/#171728, brand #7c4dff→#c084fc */

.hidden { display: none !important; }
.hidden-icon { display: none !important; }

.webchat-closed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.webchat-float-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10000;
}

.webchat-float-bubble {
    background: #171728;
    color: #eef0ff;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    margin-bottom: 12px;
    position: relative;
    animation: floatBubble 2s infinite ease-in-out;
    white-space: nowrap;
}

.webchat-float-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 25px;
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #171728 transparent transparent transparent;
}

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

.webchat-float-btn.tawk-style {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c4dff 0%, #c084fc 100%);
    color: white;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 30px -8px rgba(124, 77, 255, 0.7);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webchat-float-btn.tawk-style:hover {
    transform: scale(1.06);
    box-shadow: 0 14px 40px -8px rgba(124, 77, 255, 0.9);
}

.toggle-icon-open,
.toggle-icon-close {
    transition: opacity 0.2s, transform 0.2s;
}

.webchat-window {
    width: 360px;
    height: 550px;
    background: #0c0c17;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.75);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
    margin-bottom: 15px;
}

.webchat-window.hidden {
    opacity: 0;
    transform: scale(0.5) translateY(50px);
    pointer-events: none;
}

/* --- WebChat Menu Dropdown --- */
.webchat-menu {
    position: absolute;
    top: 60px;
    right: 15px;
    background: rgba(18, 18, 31, 0.97);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 0;
    width: 180px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.webchat-menu.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

.menu-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #a7a9c4;
    transition: all 0.2s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu-item i {
    width: 16px;
    text-align: center;
}

.menu-item.danger {
    color: #fca5a5;
}

.menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* --- Inactivity Overlay --- */
.webchat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 7, 13, 0.92);
    backdrop-filter: blur(8px);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 25px;
    border-radius: 16px;
    transition: all 0.4s ease;
}

.webchat-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.webchat-overlay i {
    font-size: 44px;
    color: #f59e0b;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.4));
}

.webchat-overlay h5 {
    font-size: 19px;
    margin-bottom: 12px;
    color: #fff;
    font-weight: 600;
    margin-top: 0;
}

.webchat-overlay p {
    font-size: 14px;
    color: #a7a9c4;
    margin-bottom: 25px;
    line-height: 1.5;
}

.btn-restart {
    background: linear-gradient(135deg, #7c4dff 0%, #c084fc 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(124, 77, 255, 0.7);
}

.webchat-header {
    background: linear-gradient(135deg, #7c4dff 0%, #c084fc 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.webchat-header button {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: opacity 0.2s;
    outline: none;
}

.webchat-header button:hover {
    opacity: 0.8;
}

.header-titles {
    text-align: center;
    flex: 1;
}

.header-titles h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    margin-right: 4px;
}

.webchat-messages {
    flex: 1;
    background: #07070d;
    padding: 20px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.webchat-intake-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
    gap: 15px;
    animation: fadeIn 0.3s ease;
}

.intake-logo {
    width: 60px;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 14px rgba(124, 77, 255, 0.5));
}

.webchat-intake-screen h5 {
    color: #eef0ff;
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
}

.webchat-intake-screen p {
    color: #a7a9c4;
    font-size: 0.9rem;
    margin: 0;
}

#webchat-name-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #12121f;
    color: #eef0ff;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#webchat-name-input::placeholder { color: #6f6b90; }

#webchat-name-input:focus {
    border-color: rgba(124, 77, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.btn-start-chat {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c4dff 0%, #c084fc 100%);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-start-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(124, 77, 255, 0.7);
}

.webchat-history {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.chat-msg {
    display: flex;
    width: 100%;
    animation: fadeInMsg 0.3s ease forwards;
}

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

.bot-msg { justify-content: flex-start; }

.bot-msg .msg-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.msg-bubble-container { max-width: 78%; }

.bot-msg .msg-author {
    font-size: 0.75rem;
    color: #71738f;
    margin-bottom: 4px;
    margin-left: 2px;
}

.bot-msg .msg-content {
    background: linear-gradient(135deg, #7c4dff 0%, #a855f7 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: 0 4px 14px -6px rgba(124, 77, 255, 0.6);
}

.user-msg { justify-content: flex-end; }

.user-msg .msg-content {
    background: #171728;
    color: #eef0ff;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 85%;
    word-break: break-word;
}

/* Chat Image Styling */
.chat-image-container {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.chat-image {
    max-width: 100%;
    display: block;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.chat-image:hover {
    transform: scale(1.02);
    filter: brightness(0.9);
}

.transcript-container {
    margin-top: 15px;
    padding: 15px;
    background: rgba(124, 77, 255, 0.08);
    border: 1px dashed rgba(124, 77, 255, 0.45);
    border-radius: 10px;
    text-align: center;
}

.transcript-container p {
    color: #cfd0e6 !important;
    margin-bottom: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.transcript-link {
    display: inline-block;
    background: linear-gradient(135deg, #7c4dff 0%, #c084fc 100%);
    color: white !important;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 8px;
    font-size: 0.9rem;
}

.transcript-link:hover { filter: brightness(1.08); }

.webchat-input-area {
    background: #12121f;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none; /* Hidden by default */
    flex-direction: column;
}

.webchat-input-area input {
    width: 100%;
    border: none;
    padding: 5px 0 10px 0;
    font-size: 0.95rem;
    color: #eef0ff;
    outline: none;
    font-family: inherit;
    background: transparent;
}

.webchat-input-area input::placeholder { color: #6f6b90; }

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #8a8caf;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    margin-right: 15px;
}

.icon-btn:hover { color: #eef0ff; }

.icon-btn.send {
    color: #c084fc;
    margin-right: 0;
    margin-left: auto;
}

.icon-btn.send:hover { color: #d8b4fe; }

.webchat-footer {
    text-align: center;
    padding: 8px;
    background: #0c0c17;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.webchat-footer a {
    color: #71738f;
    text-decoration: none;
    font-size: 0.70rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: color 0.2s;
}

.webchat-footer a:hover { color: #c084fc; }

/* Scrollbar for chat */
.webchat-messages::-webkit-scrollbar { width: 6px; }

.webchat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

@media (max-width: 480px) {
    .webchat-closed { bottom: 10px; right: 10px; }
    .webchat-window { width: calc(100vw - 20px); height: 70vh; }
}
