/* Container - Scaled to 352px wide (+10%) */
.sofly-hub-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 352px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    pointer-events: none;
}

.sofly-hub-container * {
    box-sizing: border-box;
    pointer-events: auto;
}

/* Subtle Floating Close Button - Scaled to 31px */
.sofly-subtle-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    width: 31px !important;
    height: 31px !important;
    min-width: 31px !important;
    max-width: 31px !important;
    min-height: 31px !important;
    max-height: 31px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    background: var(--sofly-primary, #ff5e62) !important;
    color: #ffffff !important;
    border: none !important;
    outline: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-align: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    opacity: 0.41 !important;
    z-index: 100 !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
    flex-shrink: 0 !important;
}

.sofly-subtle-close:hover {
    opacity: 1 !important;
    transform: scale(1.1) !important;
}

/* Media Card (352px x 528px Portrait) */
.sofly-media-card {
    position: relative !important;
    background: #000000 !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38) !important;
    height: 528px !important;
    width: 352px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.sofly-media-card.minimized {
    display: none !important;
}

/* Media Stage - Full Viewport Bleed */
.sofly-media-stage {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 22px !important;
    background: #000000 !important;
}

/* Vimeo Scaler (Width 100%, Height 133%) */
.sofly-vimeo-wrapper {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.sofly-vimeo-wrapper iframe {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 100% !important;
    height: 133% !important;
    transform: translate(-50%, -50%) !important;
    border: none !important;
    display: block !important;
}

/* Slideshow Portrait Images */
.sofly-slide-img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    will-change: transform, opacity;
}

.sofly-slide-img.active {
    opacity: 1;
}

/* --- Ken Burns Pan & Zoom Variations --- */
.sofly-slide-img.kb-zoom-in {
    animation: soflyKenBurnsZoomIn var(--kb-duration, 10s) ease-out forwards;
}

.sofly-slide-img.kb-zoom-out {
    animation: soflyKenBurnsZoomOut var(--kb-duration, 10s) ease-out forwards;
}

.sofly-slide-img.kb-pan-left {
    animation: soflyKenBurnsPanLeft var(--kb-duration, 10s) ease-out forwards;
}

.sofly-slide-img.kb-pan-right {
    animation: soflyKenBurnsPanRight var(--kb-duration, 10s) ease-out forwards;
}

@keyframes soflyKenBurnsZoomIn {
    0% {
        transform: scale(1.0) translate(0, 0);
    }
    100% {
        transform: scale(1.15) translate(-1.5%, -2%);
    }
}

@keyframes soflyKenBurnsZoomOut {
    0% {
        transform: scale(1.18) translate(1%, 2%);
    }
    100% {
        transform: scale(1.02) translate(0, 0);
    }
}

@keyframes soflyKenBurnsPanLeft {
    0% {
        transform: scale(1.12) translate(3%, 0);
    }
    100% {
        transform: scale(1.12) translate(-3%, 0);
    }
}

@keyframes soflyKenBurnsPanRight {
    0% {
        transform: scale(1.12) translate(-3%, 0);
    }
    100% {
        transform: scale(1.12) translate(3%, 0);
    }
}

/* Conditional Hover Call to Action Overlay */
.sofly-cta-overlay {
    position: absolute !important;
    bottom: 24px !important;
    left: 0 !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 90 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    pointer-events: none;
    box-sizing: border-box !important;
}

.sofly-media-card:hover .sofly-cta-overlay {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Scaled & High-Visibility White Text CTA Button */
.sofly-cta-button,
.sofly-cta-button:visited,
.sofly-cta-button:active,
.sofly-cta-button:focus {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    min-width: 130px !important;
    padding: 10px 24px !important;
    background: var(--sofly-primary, #ff5e62) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
    white-space: nowrap !important;
    border-radius: 50px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease !important;
    cursor: pointer !important;
}

.sofly-cta-button:hover {
    transform: scale(1.06) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Minimized Re-open Pill */
.sofly-media-reopen {
    align-self: flex-end;
    background: rgba(18, 18, 22, 0.85);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 22px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.2s ease;
}

.sofly-media-reopen:hover {
    transform: translateY(-2px);
}

/* AI Chat Window (352px x 528px) */
.sofly-chat-window {
    position: relative !important;
    width: 352px !important;
    height: 528px !important;
    background: #ffffff !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.3) !important;
    display: none;
    margin: 0 !important;
    padding: 0 !important;
}

.sofly-chat-window.open {
    display: block !important;
}

.sofly-chat-body {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sofly-chat-body iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Trigger Pill & Bubble */
.sofly-chat-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 11px;
    cursor: pointer;
    position: relative;
    z-index: 999999;
}

.sofly-chat-pill {
    background: #ffffff;
    color: #1a1a1a;
    padding: 9px 18px;
    border-radius: 32px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.sofly-chat-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

/* Scaled Avatar Bubble (46px) */
.sofly-avatar-bubble {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    border-radius: 50% !important;
    background: var(--sofly-secondary, #1e3c72);
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    flex-shrink: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sofly-avatar-img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #ffffff;
    display: block;
}

.sofly-fallback-avatar {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--sofly-primary, #ff5e62), var(--sofly-secondary, #1e3c72));
    border: 2px solid #ffffff;
}

.sofly-online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #00d26a;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
}

/* Subtle Customizable Branding Credit */
.sofly-branding-credit {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.65) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    opacity: 0.55;
    transition: opacity 0.2s ease;
    align-self: flex-end;
    margin-right: 8px;
    pointer-events: auto;
}

.sofly-branding-credit:hover {
    opacity: 1;
}

.sofly-branding-credit a {
    color: #ffffff !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
}

/* Responsive Mobile Layout (<= 768px): Minimized by default, clean touch targets */
@media screen and (max-width: 768px) {
    .sofly-hub-container {
        bottom: 16px;
        right: 16px;
        width: auto;
        max-width: calc(100vw - 32px);
    }

    /* Full responsive dimensions when user expands media or chat on mobile */
    .sofly-media-card,
    .sofly-chat-window {
        width: min(352px, calc(100vw - 32px)) !important;
        height: min(528px, calc(100vh - 120px)) !important;
        max-width: 100%;
    }

    .sofly-chat-pill {
        font-size: 13px;
        padding: 8px 14px;
        max-width: 220px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
