/* RDTours chat widget — Caribbean hospitality (aligned with ecosistema-mapa-visual) */
.rdeco-agent-widget {
    --rdeco-ink: #0c1210;
    --rdeco-ink-soft: #2a3330;
    --rdeco-palm: #1c3d36;
    --rdeco-lagoon: #0f5c52;
    --rdeco-lagoon-bright: #14a895;
    --rdeco-sun: #c9a227;
    --rdeco-sun-soft: rgba(201, 162, 39, 0.22);
    --rdeco-mist: #f3f5f0;
    --rdeco-glass: rgba(12, 28, 26, 0.94);
    --rdeco-glass-edge: rgba(255, 255, 255, 0.1);
    --rdeco-shadow: 0 24px 48px -12px rgba(12, 18, 16, 0.45);
    --rdeco-radius: 18px;
    --rdeco-ease: cubic-bezier(0.22, 1, 0.36, 1);
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: "Sora", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--rdeco-mist);
    -webkit-font-smoothing: antialiased;
}

.rdeco-ui-svg {
    display: block;
    flex-shrink: 0;
}

/* Panel cerrado: solo burbuja */
.rdeco-agent-widget.rdeco-widget--panel-closed {
    width: auto;
    max-width: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.rdeco-widget--panel-closed .rdeco-panel {
    display: none;
}

/* —— Launch bubble —— */
.rdeco-launch-wrap {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: min(340px, calc(100vw - 40px));
}

.rdeco-widget--panel-closed .rdeco-launch-wrap {
    display: flex;
}

.rdeco-pos-left .rdeco-launch-wrap {
    align-items: flex-start;
}

.rdeco-pos-center .rdeco-launch-wrap {
    align-items: center;
}

.rdeco-pos-right .rdeco-launch-wrap {
    align-items: flex-end;
}

.rdeco-launch-tag {
    font-family: "Sora", system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.02em;
    color: var(--rdeco-mist);
    background: var(--rdeco-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 14px;
    border-radius: 999px;
    box-shadow: var(--rdeco-shadow);
    border: 1px solid var(--rdeco-glass-edge);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(260px, calc(100vw - 120px));
    cursor: default;
    user-select: none;
}

.rdeco-launch-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.55);
    cursor: pointer;
    padding: 0;
    background: linear-gradient(145deg, var(--rdeco-lagoon-bright) 0%, var(--rdeco-lagoon) 48%, var(--rdeco-palm) 100%);
    box-shadow:
        0 10px 32px rgba(12, 18, 16, 0.4),
        0 0 0 4px rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.12);
    color: var(--rdeco-mist);
    transition: transform 0.35s var(--rdeco-ease), box-shadow 0.35s var(--rdeco-ease);
    flex-shrink: 0;
    animation: rdeco-bubble-idle 3s var(--rdeco-ease) infinite;
}

.rdeco-launch-bubble:hover {
    transform: scale(1.07) translateY(-2px);
    box-shadow:
        0 16px 40px rgba(var(--rdeco-primary-deep-rgb, 15, 92, 82), 0.45),
        0 0 0 5px rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.2);
}

.rdeco-launch-bubble:focus-visible {
    outline: 2px solid var(--rdeco-sun);
    outline-offset: 3px;
}

.rdeco-launch-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.rdeco-launch-icon .rdeco-ui-svg {
    width: 28px;
    height: 28px;
}

.rdeco-launch-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

@keyframes rdeco-bubble-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* —— Panel —— */
.rdeco-panel {
    position: relative;
    background: var(--rdeco-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--rdeco-mist);
    border-radius: var(--rdeco-radius);
    border: 1px solid var(--rdeco-glass-edge);
    box-shadow: var(--rdeco-shadow);
    width: min(420px, calc(100vw - 40px));
    overflow: hidden;
    animation: rdeco-panel-in 0.45s var(--rdeco-ease) both;
}

.rdeco-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    z-index: 0;
}

.rdeco-panel > * {
    position: relative;
    z-index: 1;
}

@keyframes rdeco-panel-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rdeco-agent-widget.rdeco-pos-left {
    left: 20px;
    right: auto;
}

.rdeco-agent-widget.rdeco-pos-center {
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

.rdeco-agent-widget.rdeco-pos-right {
    right: 20px;
    left: auto;
}

.rdeco-agent-title {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--rdeco-mist);
}

.rdeco-agent-sub {
    font-size: 12px;
    font-weight: 300;
    opacity: 0.82;
    margin-top: 4px;
    line-height: 1.4;
}

.rdeco-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 100%);
    border-bottom: 1px solid var(--rdeco-glass-edge);
}

.rdeco-head-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rdeco-mini-btn {
    border: 1px solid var(--rdeco-glass-edge);
    background: rgba(255, 255, 255, 0.06);
    color: var(--rdeco-mist);
    border-radius: 10px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--rdeco-ease);
}

.rdeco-mini-btn .rdeco-ui-svg {
    width: 18px;
    height: 18px;
}

.rdeco-mini-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.35);
}

.rdeco-mini-btn:focus-visible {
    outline: 2px solid var(--rdeco-sun);
    outline-offset: 2px;
}

.rdeco-mini-btn.rdeco-danger {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.12);
}

.rdeco-body {
    display: block;
    padding: 14px 16px 16px;
}

.rdeco-body.is-collapsed {
    display: none;
}

/* Owner bar */
.rdeco-owner-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--rdeco-glass-edge);
}

.rdeco-owner-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.35);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.rdeco-owner-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rdeco-owner-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--rdeco-sun);
    opacity: 0.95;
}

.rdeco-owner-name {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

/* Messages */
.rdeco-messages {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--rdeco-glass-edge);
    border-radius: 14px;
    padding: 12px;
    min-height: 168px;
    max-height: 260px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.4) transparent;
}

.rdeco-messages::-webkit-scrollbar {
    width: 6px;
}

.rdeco-messages::-webkit-scrollbar-thumb {
    background: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.35);
    border-radius: 999px;
}

.rdeco-msg {
    display: flex;
    margin: 10px 0;
    animation: rdeco-msg-in 0.35s var(--rdeco-ease) both;
}

@keyframes rdeco-msg-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rdeco-msg .bub {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid var(--rdeco-glass-edge);
}

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

.rdeco-msg.user .bub {
    background: linear-gradient(135deg, rgba(var(--rdeco-primary-rgb, 20, 168, 149), 0.35) 0%, rgba(var(--rdeco-primary-deep-rgb, 15, 92, 82), 0.45) 100%);
    border-color: rgba(var(--rdeco-primary-rgb, 20, 168, 149), 0.35);
    border-bottom-right-radius: 4px;
}

.rdeco-msg.bot .bub {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    background: rgba(255, 255, 255, 0.07);
    border-bottom-left-radius: 4px;
}

.rdeco-msg.bot .bub .rdeco-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    max-width: 100%;
    box-sizing: border-box;
    padding: 11px 16px;
    border-radius: 12px;
    font-family: "Sora", system-ui, sans-serif;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    text-decoration: none !important;
    color: var(--rdeco-mist) !important;
    background: linear-gradient(135deg, var(--rdeco-lagoon-bright), var(--rdeco-palm));
    border: 1px solid rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.35);
    box-shadow: 0 4px 14px rgba(12, 18, 16, 0.25);
    transition: transform 0.25s var(--rdeco-ease), filter 0.2s ease, box-shadow 0.25s ease;
}

.rdeco-msg.bot .bub .rdeco-chat-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(var(--rdeco-primary-deep-rgb, 15, 92, 82), 0.35);
    text-decoration: none !important;
}

.rdeco-msg.sys .bub {
    background: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.12);
    border-color: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.28);
    font-size: 12px;
}

/* Input row */
.rdeco-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.rdeco-input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--rdeco-glass-edge);
    border-radius: 12px;
    padding: 11px 14px;
    color: var(--rdeco-mist);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rdeco-input::placeholder {
    color: rgba(243, 245, 240, 0.45);
}

.rdeco-input:focus {
    border-color: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.5);
    box-shadow: 0 0 0 3px var(--rdeco-sun-soft);
}

.rdeco-send,
.rdeco-voice {
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    transition: transform 0.2s var(--rdeco-ease), filter 0.2s ease, box-shadow 0.2s ease;
}

.rdeco-send {
    padding: 11px 16px;
    background: linear-gradient(180deg, var(--rdeco-send-hi, #2dd46a) 0%, var(--rdeco-send-lo, #16a34a) 100%);
    color: var(--rdeco-send-ink, #052e16);
    box-shadow: 0 4px 14px var(--rdeco-send-glow, rgba(34, 197, 94, 0.35));
}

.rdeco-send:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.rdeco-send:focus-visible {
    outline: 2px solid var(--rdeco-sun);
    outline-offset: 2px;
}

.rdeco-voice {
    padding: 6px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.08);
    color: var(--rdeco-mist);
    border: 1px solid var(--rdeco-glass-edge);
}

.rdeco-voice:hover {
    background: rgba(255, 255, 255, 0.12);
}

.rdeco-voice.is-listening {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.45);
    animation: rdeco-pulse-mic 1.2s ease-in-out infinite;
}

.rdeco-voice.is-speaking {
    border-color: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.55);
    box-shadow: 0 0 0 3px var(--rdeco-sun-soft);
}

.rdeco-voice .rdeco-voice-face {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.rdeco-voice .rdeco-voice-face .rdeco-ui-svg {
    width: 22px;
    height: 22px;
}

@keyframes rdeco-pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* —— Indicador "escribiendo…" (tres puntos animados) —— */
.rdeco-msg .bub.rdeco-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 13px 16px;
    min-width: 54px;
}

.rdeco-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--rdeco-mist);
    opacity: 0.35;
    animation: rdeco-typing-blink 1.2s ease-in-out infinite both;
}

.rdeco-dot:nth-child(2) { animation-delay: 0.15s; }
.rdeco-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes rdeco-typing-blink {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* Contact bar */
.rdeco-contact-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--rdeco-glass-edge);
    justify-content: center;
}

.rdeco-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    border: 1px solid var(--rdeco-glass-edge);
    color: var(--rdeco-mist);
    background: rgba(255, 255, 255, 0.06);
    transition: transform 0.25s var(--rdeco-ease), background 0.2s ease, border-color 0.2s ease;
}

.rdeco-contact-btn:hover {
    transform: translateY(-2px);
    color: var(--rdeco-mist);
    text-decoration: none;
}

.rdeco-contact-btn--wa {
    background: rgba(37, 211, 102, 0.15);
    border-color: rgba(37, 211, 102, 0.4);
}

.rdeco-contact-btn--tel {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.rdeco-contact-btn--mail {
    background: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.12);
    border-color: rgba(var(--rdeco-accent-rgb, 201, 162, 39), 0.38);
}

.rdeco-contact-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
}

.rdeco-contact-ico .rdeco-ui-svg {
    width: 18px;
    height: 18px;
}

.rdeco-contact-txt {
    white-space: nowrap;
}

.rdeco-pay-cta {
    display: inline-block;
    margin-top: 4px;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    background: linear-gradient(180deg, #2dd46a 0%, #16a34a 100%);
    color: #052e16;
    border: 1px solid rgba(34, 197, 94, 0.45);
}

.rdeco-pay-cta:hover {
    filter: brightness(1.06);
    text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
    .rdeco-launch-bubble,
    .rdeco-panel,
    .rdeco-msg,
    .rdeco-dot {
        animation: none;
    }
    .rdeco-launch-bubble:hover,
    .rdeco-contact-btn:hover,
    .rdeco-msg.bot .bub .rdeco-chat-btn:hover {
        transform: none;
    }
}
