/* Búho anfitrión — popup abajo a la derecha */

.h-bot-wrap {
    display: none !important;
}

.h-status-row {
    justify-content: flex-start;
}

body:has(.td-buho) .td-scroll-top {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.td-buho {
    --td-buho-size: 68px;
    position: fixed;
    z-index: 99995;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

.td-buho__backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(13, 27, 42, 0.22);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    pointer-events: auto;
}

.td-buho__backdrop[hidden] {
    display: none !important;
}

.td-buho__panel {
    display: none;
    width: min(292px, calc(100vw - 24px));
    padding: 12px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px) saturate(1.1);
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    border: 1px solid rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px -12px rgba(13, 27, 42, 0.28);
    pointer-events: auto;
}

.td-buho__panel[hidden] {
    display: none !important;
}

.td-buho--open .td-buho__panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(70vh, calc(100vh - 180px));
    animation: td-buho-panel-in 0.2s ease-out;
}

.td-buho__acts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    min-height: 0;
    padding-right: 2px;
}

.td-buho__head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 2px 2px 4px;
}

.td-buho__head-face {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #0d1b2a;
    box-shadow: 0 0 0 2px rgba(255, 138, 0, 0.45);
}

.td-buho__head-face img {
    display: block;
    width: 122%;
    height: 122%;
    margin: -11%;
    object-fit: cover;
}

.td-buho__head-txt {
    min-width: 0;
    flex: 1 1 auto;
}

.td-buho__kicker {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.td-buho__title {
    margin: 2px 0 0;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--td-brand-navy, #0d1b2a);
}

.td-buho__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    margin: -2px -2px 0 0;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.td-buho__close:focus-visible,
.td-buho__face:focus-visible,
.td-buho__bubble-x:focus-visible {
    outline: 2px solid var(--td-brand-orange, #ff8a00);
    outline-offset: 2px;
}

.td-buho__act {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 14px;
    text-decoration: none !important;
    color: var(--td-brand-navy, #0d1b2a);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(226, 232, 240, 0.95);
}

.td-buho__act:hover {
    border-color: rgba(255, 138, 0, 0.45);
    background: #fff;
}

.td-buho__act-ico {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
    background: #0d1b2a;
}

.td-buho__act--farm .td-buho__act-ico { background: linear-gradient(160deg, #0f766e, #2dd4bf); }
.td-buho__act--bus .td-buho__act-ico { background: linear-gradient(160deg, #1d4ed8, #60a5fa); }
.td-buho__act--com .td-buho__act-ico { background: linear-gradient(160deg, #7c3aed, #c084fc); }
.td-buho__act--clima .td-buho__act-ico { background: linear-gradient(160deg, #c2410c, #ff8a00); }
.td-buho__act--sos .td-buho__act-ico { background: linear-gradient(160deg, #b91c1c, #f87171); }
.td-buho__act--wa .td-buho__act-ico { background: linear-gradient(160deg, #128c7e, #25d366); }

.td-buho__act-txt {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.td-buho__act-txt strong {
    font-size: 0.875rem;
    font-weight: 800;
    line-height: 1.2;
}

.td-buho__act-txt small {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-buho__act-go {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 1.05rem;
}

.td-buho__dock {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    pointer-events: none;
}

.td-buho__bubble {
    position: absolute;
    right: calc(var(--td-buho-size) + 10px);
    bottom: 10px;
    width: max-content;
    max-width: min(64vw, 14.5rem);
    padding: 9px 32px 9px 12px;
    border-radius: 16px 16px 4px 16px;
    background: #fff;
    color: var(--td-brand-navy, #0d1b2a);
    border: 1px solid rgba(255, 138, 0, 0.5);
    box-shadow: 0 10px 24px rgba(13, 27, 42, 0.16);
    font-size: 0.8125rem;
    font-weight: 800;
    line-height: 1.3;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(8px) scale(0.96);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.td-buho__bubble[hidden] {
    display: none;
}

.td-buho--offer .td-buho__bubble:not([hidden]) {
    opacity: 1;
    transform: none;
}

.td-buho__bubble p {
    margin: 0;
}

.td-buho__bubble-x {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.td-buho__bubble::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: 14px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-right: 1px solid rgba(255, 138, 0, 0.5);
    border-top: 1px solid rgba(255, 138, 0, 0.5);
    transform: rotate(45deg);
}

.td-buho__face {
    pointer-events: auto;
    width: var(--td-buho-size);
    height: var(--td-buho-size);
    padding: 0;
    border: 2px solid var(--td-brand-orange, #ff8a00);
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    opacity: 1;
    background: #0d1b2a;
    box-shadow:
        0 4px 12px rgba(13, 27, 42, 0.22),
        0 0 0 3px rgba(255, 138, 0, 0.14);
    -webkit-tap-highlight-color: transparent;
}

.td-buho--offer .td-buho__face {
    animation: td-buho-pulse 2.4s ease-in-out infinite;
}

.td-buho--open .td-buho__face {
    animation: none;
    box-shadow:
        0 4px 14px rgba(13, 27, 42, 0.28),
        0 0 0 3px rgba(255, 138, 0, 0.35);
}

.td-buho__face img {
    display: block;
    width: 122%;
    height: 122%;
    margin: -11%;
    object-fit: cover;
}

.td-buho__face:active {
    transform: scale(0.96);
}

@keyframes td-buho-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.86);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes td-buho-panel-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes td-buho-pulse {
    0%, 100% {
        box-shadow:
            0 4px 12px rgba(13, 27, 42, 0.22),
            0 0 0 3px rgba(255, 138, 0, 0.14);
    }
    50% {
        box-shadow:
            0 6px 16px rgba(13, 27, 42, 0.26),
            0 0 0 8px rgba(255, 138, 0, 0);
    }
}

html[data-theme="dark"] .td-buho__panel {
    background: rgba(20, 28, 46, 0.94);
    border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .td-buho__title {
    color: #f8fafc;
}

html[data-theme="dark"] .td-buho__kicker {
    color: #94a3b8;
}

html[data-theme="dark"] .td-buho__close {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

html[data-theme="dark"] .td-buho__act {
    color: #f1f5f9;
    background: rgba(51, 65, 85, 0.72);
    border-color: rgba(71, 85, 105, 0.9);
}

html[data-theme="dark"] .td-buho__act-txt small {
    color: #94a3b8;
}

html[data-theme="dark"] .td-buho__bubble {
    background: #1e293b;
    color: #f8fafc;
    border-color: rgba(255, 138, 0, 0.45);
}

html[data-theme="dark"] .td-buho__bubble::after {
    background: #1e293b;
}

@media (min-width: 768px) {
    .td-buho {
        right: 22px;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    body:has(.td-buho) .td-scroll-top {
        bottom: calc(100px + env(safe-area-inset-bottom, 0px));
        right: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .td-buho__face,
    .td-buho--offer .td-buho__face,
    .td-buho--open .td-buho__panel:not([hidden]),
    .td-buho__bubble {
        animation: none;
        transition: none;
    }
}
