/*
 * Portal chat launcher (resources/views/components/chat-embed.blade.php).
 *
 * Served as a plain static file rather than through Vite: the launcher is
 * mounted on both public layouts, and one that loses its positioning because
 * assets were not rebuilt is worse than no launcher at all.
 */

.chat-embed {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.chat-embed [x-cloak] {
    display: none !important;
}

.chat-embed-frame {
    width: min(24rem, calc(100vw - 2.5rem));
    height: min(34rem, calc(100vh - 9rem));
    overflow: hidden;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.chat-embed-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* The full-body figure is the launcher itself: no chrome of its own, and a
   drop-shadow that follows the image's transparent outline so it floats. */
.chat-embed-launcher {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-embed-launcher:hover,
.chat-embed-launcher:focus-visible {
    transform: scale(1.04);
}

.chat-embed-launcher:focus-visible {
    outline: 2px solid #f57f17;
    outline-offset: 4px;
    border-radius: 0.5rem;
}

.chat-embed-avatar {
    display: block;
    width: auto;
    height: 9rem;
    max-height: 28vh;
    object-fit: contain;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.25));
    animation: chat-embed-float 3.5s ease-in-out infinite;
}

@keyframes chat-embed-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Round control shown while the frame is open, carrying the small avatar. */
.chat-embed-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    overflow: hidden;
    background: #f57f17;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.chat-embed-close:focus-visible {
    outline: 2px solid #f57f17;
    outline-offset: 3px;
}

.chat-embed-close img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text pill used when no full avatar has been uploaded. */
.chat-embed-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.15rem;
    border: 0;
    border-radius: 9999px;
    background: #f57f17;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.chat-embed-pill-icon {
    font-size: 1.05rem;
}

@media (prefers-reduced-motion: reduce) {
    .chat-embed-avatar {
        animation: none;
    }

    .chat-embed-launcher {
        transition: none;
    }
}

@media print {
    .chat-embed {
        display: none !important;
    }
}
