:root {
    --lv-primary: #7a4b83;
    --lv-primary-dark: #603568;
    --lv-gold: #b07a56;
    --lv-soft-bg: #fffaf5;
    --lv-border: #eadfd4;
    --lv-text: #333333;
    --lv-muted: #777777;
    --lv-whatsapp: #25D366;
}

.lv-chat-toggle {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--lv-whatsapp), var(--lv-primary), var(--lv-gold));
    color: white;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(0,0,0,0.26);
    z-index: 999999;
    animation: lvPulse 1.9s infinite;
}

.lv-chat-icon {
    font-size: 27px;
    display: block;
    line-height: 1;
}

.lv-chat-badge {
    position: absolute;
    right: -2px;
    top: -4px;
    background: #ffef9a;
    color: #5a3566;
    border-radius: 999px;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

@keyframes lvPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.52);
    }
    70% {
        transform: scale(1.04);
        box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.lv-chat-widget {
    position: fixed;
    right: 22px;
    bottom: 94px;
    width: 330px;
    max-width: calc(100vw - 28px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 22px 50px rgba(0,0,0,0.22);
    overflow: hidden;
    display: none;
    z-index: 999998;
}

.lv-chat-widget.active {
    display: flex;
    flex-direction: column;
}

.lv-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--lv-primary), var(--lv-gold));
    color: white;
    padding: 13px 14px;
    position: relative;
}

.lv-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.20);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.lv-header-text h2 {
    margin: 0 28px 3px 0;
    font-size: 16px;
    line-height: 1.2;
}

.lv-header-text p {
    margin: 0;
    font-size: 11.5px;
    opacity: 0.94;
}

.lv-close-btn {
    position: absolute;
    right: 11px;
    top: 8px;
    border: none;
    background: transparent;
    color: white;
    font-size: 25px;
    cursor: pointer;
    line-height: 1;
}

.lv-quick-replies {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 10px 12px;
    background: #fff7ef;
    border-bottom: 1px solid var(--lv-border);
}

.lv-quick-replies button {
    white-space: nowrap;
    border: 1px solid var(--lv-border);
    background: #ffffff;
    color: var(--lv-primary);
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.lv-chat-log {
    height: 300px;
    max-height: min(300px, calc(100vh - 280px));
    overflow-y: auto;
    padding: 13px;
    background: var(--lv-soft-bg);
}

.lv-message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.lv-message-row.user-row {
    justify-content: flex-end;
}

.lv-avatar {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.bot-avatar {
    background: linear-gradient(135deg, var(--lv-primary), var(--lv-gold));
    color: white;
}

.user-avatar {
    background: #eee2f0;
    color: var(--lv-primary);
    order: 2;
}

.lv-message {
    max-width: 78%;
    padding: 10px 12px;
    border-radius: 15px;
    line-height: 1.58;
    font-size: 13.5px;
    word-wrap: break-word;
}

.bot-message {
    background: #ffffff;
    border: 1px solid var(--lv-border);
    color: var(--lv-text);
    border-bottom-left-radius: 5px;
}

.user-message {
    background: var(--lv-primary);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message h1,
.bot-message h2,
.bot-message h3 {
    margin: 10px 0 7px;
    color: var(--lv-primary);
    line-height: 1.35;
}

.bot-message h1 { font-size: 18px; }
.bot-message h2 { font-size: 16px; }
.bot-message h3 { font-size: 15px; }

.bot-message p {
    margin: 7px 0;
}

.bot-message ul,
.bot-message ol {
    margin: 8px 0;
    padding-left: 21px;
}

.bot-message li {
    margin-bottom: 5px;
}

.bot-message strong {
    color: var(--lv-primary);
}

.bot-message hr {
    border: none;
    border-top: 1px solid var(--lv-border);
    margin: 12px 0;
}

.bot-message a {
    color: var(--lv-primary);
    font-weight: bold;
    text-decoration: none;
}

.bot-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 9px 0;
    font-size: 12px;
}

.bot-message th,
.bot-message td {
    border: 1px solid var(--lv-border);
    padding: 6px;
    text-align: left;
}

.lv-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.lv-typing span {
    width: 6px;
    height: 6px;
    background: var(--lv-primary);
    border-radius: 50%;
    opacity: 0.45;
    animation: lvTyping 1.1s infinite;
}

.lv-typing span:nth-child(2) { animation-delay: 0.15s; }
.lv-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes lvTyping {
    0%, 100% { transform: translateY(0); opacity: 0.35; }
    50% { transform: translateY(-4px); opacity: 1; }
}

.lv-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 11px;
    background: white;
    border-top: 1px solid #eeeeee;
}

.lv-chat-input-area input {
    flex: 1;
    border: 1px solid #dddddd;
    border-radius: 12px;
    padding: 11px;
    font-size: 13.5px;
    outline: none;
}

.lv-chat-input-area input:focus {
    border-color: var(--lv-primary);
}

.lv-chat-input-area button {
    border: none;
    border-radius: 12px;
    padding: 11px 13px;
    background: var(--lv-primary);
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.lv-chat-input-area button:hover {
    background: var(--lv-primary-dark);
}

.lv-chat-input-area button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.lv-whatsapp-btn {
    display: block;
    margin: 0 11px 10px;
    text-align: center;
    text-decoration: none;
    background: var(--lv-whatsapp);
    color: white;
    padding: 11px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 13.5px;
}

.lv-note {
    text-align: center;
    font-size: 10.8px;
    color: var(--lv-muted);
    padding: 0 11px 11px;
}

@media (max-width: 600px) {
    .lv-chat-widget {
        right: 10px;
        left: 10px;
        bottom: 86px;
        width: auto;
    }

    .lv-chat-toggle {
        right: 16px;
        bottom: 16px;
        width: 60px;
        height: 60px;
    }

    .lv-chat-log {
        height: 285px;
    }
}


.lv-chat-toggle:focus-visible,
.lv-close-btn:focus-visible,
.lv-chat-input-area input:focus-visible,
.lv-chat-input-area button:focus-visible,
.lv-quick-replies button:focus-visible {
    outline: 3px solid rgba(176,122,86,.35);
    outline-offset: 2px;
}
