/* ────────────────────────────────────────────────────────────────────
   Hafidzku CTA Suite — Floating Widget CSS (v1.1)
   ────────────────────────────────────────────────────────────────────
   Scoping strategy:
   - All selectors prefixed with .hk-float-*
   - All values driven by CSS custom properties (--hk-*)
   - z-index 2147483646 (max - 1) to win against most themes
   - !important on critical layout props to defeat aggressive theme CSS
   - No transitions on layout (only opacity/transform) → no CLS
   Theme compat: GeneratePress, Kadence, LandingPress, Astra, Elementor, GP Premium, Hello.
   ──────────────────────────────────────────────────────────────────── */

.hk-float {
    position: fixed !important;
    z-index: 2147483646 !important;
    display: flex !important;
    align-items: center;
    gap: var(--hk-gap, 8px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    pointer-events: auto;
    /* Prevent theme from messing with us */
    transform: none;
    transition: opacity 0.3s ease;
}
.hk-float * { box-sizing: border-box; }
.hk-float[hidden] { display: none !important; }

/* Direction: icon side */
.hk-float--right { flex-direction: row-reverse; }
.hk-float--left  { flex-direction: row; }

/* Override direction explicitly when label position is set */
.hk-float--label-right.hk-float--right,
.hk-float--label-right.hk-float--left  { flex-direction: row-reverse; }
.hk-float--label-left.hk-float--right,
.hk-float--label-left.hk-float--left   { flex-direction: row; }
.hk-float--label-none .hk-float__label { display: none !important; }

/* Device visibility */
@media (max-width: 768px) {
    .hk-float--desktop-only { display: none !important; }
}
@media (min-width: 769px) {
    .hk-float--mobile-only  { display: none !important; }
}

/* ─── Icon ──────────────────────────────────────────────────── */
.hk-float__icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: var(--hk-icon-size, 60px) !important;
    height: var(--hk-icon-size, 60px) !important;
    min-width: var(--hk-icon-size, 60px);
    min-height: var(--hk-icon-size, 60px);
    border-radius: var(--hk-icon-radius, 50%) !important;
    background: var(--hk-icon-bg, #25D366) !important;
    color: var(--hk-icon-color, #fff) !important;
    cursor: pointer;
    text-decoration: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0;
    line-height: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    /* Reset theme button styles */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: none;
}
.hk-float__icon:hover {
    transform: scale(1.08);
}
.hk-float__icon:focus-visible {
    outline: 3px solid rgba(37,211,102,0.4);
    outline-offset: 2px;
}
.hk-float__svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit;
}

/* Mobile icon size */
@media (max-width: 768px) {
    .hk-float__icon {
        width: var(--hk-icon-size-mobile, 60px) !important;
        height: var(--hk-icon-size-mobile, 60px) !important;
        min-width: var(--hk-icon-size-mobile, 60px);
        min-height: var(--hk-icon-size-mobile, 60px);
    }
}

/* Shadows */
.hk-float--shadow-none .hk-float__icon   { box-shadow: none; }
.hk-float--shadow-small .hk-float__icon  { box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.hk-float--shadow-medium .hk-float__icon { box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.hk-float--shadow-large .hk-float__icon  { box-shadow: 0 8px 24px rgba(0,0,0,0.35); }

/* Animations */
.hk-float--pulse .hk-float__icon  { animation: hk-pulse 2s ease-in-out infinite; }
.hk-float--bounce .hk-float__icon { animation: hk-bounce 2.4s ease-in-out infinite; }
.hk-float--shake .hk-float__icon  { animation: hk-shake 3s ease-in-out infinite; }
@keyframes hk-pulse  {
    0%, 100% { box-shadow: 0 4px 12px rgba(37,211,102,0.4); }
    50%      { box-shadow: 0 4px 24px rgba(37,211,102,0.8); }
}
@keyframes hk-bounce {
    0%, 100% { transform: translateY(0); }
    25%      { transform: translateY(-6px); }
    50%      { transform: translateY(0); }
    75%      { transform: translateY(-3px); }
}
@keyframes hk-shake  {
    0%, 90%, 100% { transform: rotate(0); }
    92% { transform: rotate(8deg); }
    94% { transform: rotate(-8deg); }
    96% { transform: rotate(6deg); }
    98% { transform: rotate(-4deg); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hk-float--pulse .hk-float__icon,
    .hk-float--bounce .hk-float__icon,
    .hk-float--shake .hk-float__icon { animation: none !important; }
}

/* ─── Label ─────────────────────────────────────────────────── */
.hk-float__label {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: var(--hk-label-pad, 8px 14px) !important;
    background: var(--hk-label-bg, #25D366) !important;
    color: var(--hk-label-color, #fff) !important;
    border-radius: var(--hk-label-radius, 8px) !important;
    font-size: var(--hk-label-fs, 13px) !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    line-height: 1;
    margin: 0 !important;
}

/* Close button inside label */
.hk-float__close {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none !important;
    background: rgba(255,255,255,0.25) !important;
    color: inherit !important;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 0 0 4px !important;
    transition: background 0.15s;
    appearance: none;
    -webkit-appearance: none;
}
.hk-float__close:hover {
    background: rgba(255,255,255,0.45) !important;
}

/* Hide label on small mobile if icon ≥ 56px (avoid cramping) */
@media (max-width: 380px) {
    .hk-float__label { display: none !important; }
}

/* ─── Multi-agent popup ─────────────────────────────────────── */
.hk-float__popup {
    position: absolute;
    bottom: calc(100% + 12px);
    width: 300px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: hk-popup-in 0.22s ease;
}
.hk-float--right .hk-float__popup { right: 0; }
.hk-float--left  .hk-float__popup { left: 0; }

@keyframes hk-popup-in {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.hk-float__popup[hidden] { display: none !important; }

.hk-float__popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #25D366;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}
.hk-float__popup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    appearance: none;
}

/* Agent item */
.hk-float__agent {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 16px !important;
    text-decoration: none !important;
    color: #333 !important;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}
.hk-float__agent:last-child { border-bottom: none; }
.hk-float__agent:hover { background: #f8f8f8; }

.hk-float__agent-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    line-height: 0;
}
.hk-float__agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hk-float__agent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.hk-float__agent-info strong {
    font-size: 14px;
    color: #222;
    font-weight: 700;
}
.hk-float__agent-info small {
    font-size: 11px;
    color: #888;
    text-transform: none;
}

/* ─── Theme compat overrides ──────────────────────────────────
   Some themes/page builders force their own button/link styles.
   These overrides ensure our widget always renders cleanly. */
.hk-float__icon::before,
.hk-float__icon::after { content: none !important; }

/* Elementor sometimes wraps with absolute positioned overlays */
.hk-float { isolation: isolate; }

/* Astra/GeneratePress text-decoration on links */
.hk-float a, .hk-float a:hover, .hk-float a:focus { text-decoration: none !important; }
