/* ─── Kibo Mascot — Web pública ─── */
/* Mobile-first: base = mobile, scale up for desktop */

/* Base container */
.kmw {
    position: fixed;
    bottom: 4px;
    right: 14px;
    z-index: 9990;
    font-family: 'Outfit', system-ui, sans-serif;
    max-width: calc(100vw - 28px);
}

/* Hidden by default */
.kmw:not(.kmw--visible) {
    opacity: 0;
    pointer-events: none;
}

.kmw--visible {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

/* ── Main wrapper (avatar + bubble) ── */
.kmw-main {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-direction: row-reverse;
}

/* ── Avatar — forma original, asomándose desde el borde inferior ── */
.kmw-avatar {
    width: 54px;
    height: auto;
    max-height: 68px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ── Bubble ── */
.kmw-bubble {
    position: relative;
    background: #FFFFFF;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-left: 3px solid #5471E8;
    padding: 8px 26px 8px 10px;
    max-width: 158px;
    margin-bottom: 12px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.kmw-bubble--hiding {
    opacity: 0;
    transform: translateY(8px);
}

.kmw-text {
    font-size: 12px;
    color: #262626;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Close button ── */
.kmw-close {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 15px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.kmw-close:hover,
.kmw-close:active {
    color: #374151;
    background: rgba(0, 0, 0, 0.06);
}

/* ── Collapsed icon button — asomándose desde abajo ── */
.kmw-icon-btn {
    display: block;
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    overflow: visible;
    transition: transform 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.kmw-icon-btn:hover,
.kmw-icon-btn:active {
    transform: scale(1.08);
}

.kmw-icon-btn img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

/* ── Animation: open state ── */
.kmw--open .kmw-main {
    animation: kmwSlideIn 0.4s ease-out;
}

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

/* ── Closing: avatar fades out before swap ── */
.kmw-avatar--fading {
    opacity: 0;
    transform: translateY(8px);
}

/* ── Desktop (>768px) ── */
@media (min-width: 769px) {
    .kmw {
        right: 36px;
        bottom: 8px;
    }

    .kmw-avatar {
        width: 64px;
        max-height: 80px;
    }

    .kmw-bubble {
        max-width: 300px;
        border-radius: 12px;
        padding: 12px 36px 12px 14px;
        margin-bottom: 28px;
    }

    .kmw-text {
        font-size: 14px;
        line-height: 1.45;
        -webkit-line-clamp: unset;
    }

    .kmw-close {
        top: 4px;
        right: 4px;
        width: 32px;
        height: 32px;
        font-size: 18px;
        line-height: 32px;
    }

    .kmw-icon-btn {
        width: 72px;
        height: 72px;
    }
}

/* ─── Hero Kibo mascot ─── */
/* Base + responsive styles are in index.php inline <style> to avoid FOUC */
/* This file only handles section mascots + floating widget */

/* ── Mascot section appearances ── */
.section-kibo {
    position: absolute;
    width: 100px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 3px 12px rgba(84, 113, 232, 0.12));
    opacity: 0;
    transition: none;
    pointer-events: none;
    z-index: 2;
}

.section-kibo.kibo-visible {
    animation: sectionKiboAppear 0.8s ease-out forwards;
}

@keyframes sectionKiboAppear {
    0%   { opacity: 0; transform: translateY(30px) scale(0.7) rotate(-8deg); }
    50%  { opacity: 1; transform: translateY(-5px) scale(1.05) rotate(2deg); }
    70%  { transform: translateY(2px) scale(0.98) rotate(-1deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

/* Posiciones de mascota en secciones */
.section-kibo.kibo-right {
    right: -10px;
    bottom: 20px;
}

.section-kibo.kibo-left {
    left: -10px;
    bottom: 20px;
}

/* ── Mobile: section mascots smaller ── */
@media (max-width: 768px) {
    .section-kibo {
        width: 60px;
    }
    .section-kibo.kibo-right {
        right: 4px;
    }
    .section-kibo.kibo-left {
        left: 4px;
    }
}

@media (max-width: 480px) {
    .section-kibo {
        width: 48px;
    }
}

/* ── Pantallas grandes ── */
@media (min-width: 1200px) {
    .section-kibo {
        width: 120px;
    }
}
