/* ==========================================================================
   Hanioo Frontend - Floating Right-Side Contact Widgets & AI Chatbot
   Production-ready styles for fixed contact dock and modern popup chat.
   ========================================================================== */

/* ---------- Floating Contact Widgets Dock (Bottom-Right Corner) ---------- */
.hanioo-floating-dock {
    position: fixed !important;
    right: 20px !important;
    bottom: 24px !important;
    top: auto !important;
    transform: none !important;
    z-index: 9990 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: haniooFadeSlideUp 0.35s ease both;
}

@keyframes haniooFadeSlideUp {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Base Floating Action Item */
.hanioo-fw-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Back-to-Top Dock Item - Collapsed at page top, smoothly expands on scroll */
.hanioo-fw-item--btt {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.7) translateY(8px);
    pointer-events: none;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0.25s ease;
    overflow: hidden;
}

.hanioo-fw-item--btt.is-visible {
    max-height: 60px;
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    overflow: visible;
}

/* Floating Action Button / Link */
.hanioo-fw-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    text-decoration: none;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(15, 27, 51, 0.2), 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                filter 0.25s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.hanioo-fw-btn:hover {
    transform: scale(1.1) translateX(-3px);
}

.hanioo-fw-btn:active {
    transform: scale(0.96) translateX(-1px);
}

.hanioo-fw-btn:focus-visible {
    outline: 3px solid #f5a524;
    outline-offset: 3px;
}

.hanioo-fw-btn svg {
    display: block;
    transition: transform 0.25s ease;
}

.hanioo-fw-btn:hover svg {
    transform: scale(1.08);
}

/* 1. Back-to-Top Button (Solid Black with Bold White Arrow) */
button#hanioo-back-to-top,
.hanioo-fw-btn--top,
.hanioo-back-to-top,
.hanioo-floating-dock .hanioo-fw-btn--top,
.hanioo-floating-dock button#hanioo-back-to-top {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    border: none !important;
    outline: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

button#hanioo-back-to-top:hover,
.hanioo-fw-btn--top:hover,
.hanioo-back-to-top:hover,
.hanioo-floating-dock .hanioo-fw-btn--top:hover,
.hanioo-floating-dock button#hanioo-back-to-top:hover {
    background: #18181b !important;
    background-color: #18181b !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
}

button#hanioo-back-to-top svg,
.hanioo-fw-btn--top svg,
.hanioo-back-to-top svg {
    fill: #ffffff !important;
    color: #ffffff !important;
}

button#hanioo-back-to-top svg path,
.hanioo-fw-btn--top svg path {
    fill: #ffffff !important;
}

/* 2. AI Chatbot Button (Purple/Blue Gradient with Cute Robot) */
.hanioo-fw-btn--ai {
    background: linear-gradient(135deg, #6055f7 0%, #3b82f6 100%) !important;
    box-shadow: 0 4px 16px rgba(96, 85, 247, 0.38), 0 2px 6px rgba(0, 0, 0, 0.08);
    animation: haniooPulseAi 3s infinite ease-in-out;
}

.hanioo-fw-btn--ai:hover {
    box-shadow: 0 8px 24px rgba(96, 85, 247, 0.55);
}

@keyframes haniooPulseAi {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5), 0 4px 18px rgba(31, 79, 216, 0.35);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0), 0 4px 18px rgba(31, 79, 216, 0.35);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0), 0 4px 18px rgba(31, 79, 216, 0.35);
    }
}

/* Status Indicator Dot for AI */
.hanioo-fw-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 13px;
    height: 13px;
    background-color: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 3. Phone Call Button (Vibrant Blue with White Handset) */
.hanioo-fw-btn--phone {
    background: #1d70f5 !important;
    box-shadow: 0 4px 16px rgba(29, 112, 245, 0.38), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.hanioo-fw-btn--phone:hover {
    background: #155ecc !important;
    box-shadow: 0 8px 24px rgba(29, 112, 245, 0.55);
}

/* 4. WhatsApp Button (Green with White Handset and Subtle Pulse Halo) */
.hanioo-fw-btn--whatsapp {
    background: #22c55e !important;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.28), 0 4px 16px rgba(15, 27, 51, 0.2);
    animation: haniooPulseWaRing 3s infinite ease-in-out;
}

.hanioo-fw-btn--whatsapp:hover {
    background: #16a34a !important;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.38), 0 8px 24px rgba(22, 163, 74, 0.45);
}

@keyframes haniooPulseWaRing {
    0% {
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 0 4px 16px rgba(15, 27, 51, 0.2);
    }
    50% {
        box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.15), 0 4px 16px rgba(15, 27, 51, 0.2);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 0 4px 16px rgba(15, 27, 51, 0.2);
    }
}

/* Tooltip Labels on Hover */
.hanioo-fw-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background-color: #0b1630;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    padding: 7px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(11, 22, 48, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease,
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0.2s;
    z-index: 9991;
}

.hanioo-fw-tooltip::after {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent transparent #0b1630;
}

.hanioo-fw-item:hover .hanioo-fw-tooltip,
.hanioo-fw-btn:focus-visible + .hanioo-fw-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}


/* ==========================================================================
   Modern AI Chatbot Popup Window
   ========================================================================== */
.hanioo-chat-popup {
    position: fixed;
    right: 24px;
    bottom: 28px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 60px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(15, 27, 51, 0.22), 0 2px 10px rgba(15, 27, 51, 0.08);
    border: 1px solid rgba(221, 227, 238, 0.9);
    z-index: 9995;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    transform-origin: bottom right;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                visibility 0.25s;
    will-change: transform, opacity;
}

.hanioo-chat-popup[hidden] {
    display: none !important;
}

.hanioo-chat-popup:not(.is-open) {
    transform: scale(0.85) translateY(24px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.hanioo-chat-popup.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Chat Header */
.hanioo-chat-header {
    background: linear-gradient(135deg, #0b1630 0%, #172c57 55%, #1f4fd8 100%);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.hanioo-chat-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hanioo-chat-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.hanioo-chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hanioo-chat-avatar svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.hanioo-chat-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background-color: #10b981;
    border: 2px solid #0b1630;
    border-radius: 50%;
}

.hanioo-chat-header-meta h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.hanioo-chat-status {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: #93c5fd;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hanioo-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hanioo-chat-btn-icon {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.hanioo-chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.hanioo-chat-btn-icon:active {
    transform: scale(0.95);
}

.hanioo-chat-btn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Quick Topic Chips Bar */
.hanioo-chat-chips-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.hanioo-chat-chips-bar::-webkit-scrollbar {
    display: none;
}

.hanioo-chat-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    color: #334155;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.hanioo-chat-chip:hover {
    background: #eef2ff;
    border-color: #6366f1;
    color: #1f4fd8;
    transform: translateY(-1px);
}

.hanioo-chat-chip:active {
    transform: translateY(0);
}

/* Messages Area */
.hanioo-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #ffffff;
    scroll-behavior: smooth;
}

/* Individual Message Layout */
.hanioo-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: haniooMsgIn 0.25s ease both;
}

@keyframes haniooMsgIn {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hanioo-chat-msg--bot {
    align-self: flex-start;
}

.hanioo-chat-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.hanioo-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f4fd8 0%, #8b5cf6 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.hanioo-chat-msg-avatar svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.hanioo-chat-msg-content {
    display: flex;
    flex-direction: column;
}

.hanioo-chat-bubble {
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.hanioo-chat-msg--bot .hanioo-chat-bubble {
    background-color: #f1f5f9;
    color: #1e293b;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hanioo-chat-msg--user .hanioo-chat-bubble {
    background: linear-gradient(135deg, #1f4fd8 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 2px 6px rgba(31, 79, 216, 0.25);
}

.hanioo-chat-bubble p {
    margin: 0 0 8px;
}

.hanioo-chat-bubble p:last-child {
    margin-bottom: 0;
}

.hanioo-chat-bubble ul {
    margin: 4px 0 6px 18px;
    padding: 0;
    list-style: disc;
}

.hanioo-chat-bubble li {
    margin-bottom: 3px;
}

.hanioo-chat-bubble a {
    color: #1f4fd8;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hanioo-chat-msg--user .hanioo-chat-bubble a {
    color: #ffffff;
}

.hanioo-chat-time {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 3px;
    padding: 0 4px;
}

.hanioo-chat-msg--user .hanioo-chat-time {
    text-align: right;
}

/* Typing Indicator */
.hanioo-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background-color: #f1f5f9;
    border-radius: 16px 16px 16px 4px;
    width: fit-content;
}

.hanioo-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #64748b;
    border-radius: 50%;
    animation: haniooTypingBounce 1.4s infinite ease-in-out both;
}

.hanioo-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.hanioo-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.hanioo-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes haniooTypingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Chat Input Bar */
.hanioo-chat-input-bar {
    padding: 10px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hanioo-chat-input {
    flex: 1;
    height: 42px;
    border: 1.5px solid #dde3ee;
    border-radius: 21px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 13.5px;
    color: #0f1b33;
    outline: none;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hanioo-chat-input:focus {
    border-color: #1f4fd8;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(31, 79, 216, 0.12);
}

.hanioo-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f4fd8 0%, #2563eb 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(31, 79, 216, 0.3);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.hanioo-chat-send-btn:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, #163aa3 0%, #1d4ed8 100%);
}

.hanioo-chat-send-btn:active {
    transform: scale(0.95);
}

.hanioo-chat-send-btn svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
    margin-left: 2px;
}

/* Chat Footer Note */
.hanioo-chat-footer {
    padding: 6px 12px 9px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    flex-shrink: 0;
}

.hanioo-chat-footer a {
    color: #1f4fd8;
    font-weight: 600;
    text-decoration: none;
}

.hanioo-chat-footer a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
    .hanioo-floating-dock {
        right: 16px;
        bottom: 20px;
        top: auto !important;
        transform: none !important;
        gap: 12px;
    }
    
    .hanioo-fw-btn {
        width: 50px;
        height: 50px;
    }

    .hanioo-fw-btn svg {
        width: 22px;
        height: 22px;
    }

    .hanioo-chat-popup {
        right: 16px;
        bottom: 20px;
        width: 360px;
        height: 520px;
    }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .hanioo-floating-dock {
        right: 14px;
        bottom: 18px;
        top: auto !important;
        transform: none !important;
        gap: 10px;
    }

    .hanioo-fw-btn {
        width: 44px;
        height: 44px;
    }

    .hanioo-fw-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Disable hover tooltips on mobile touch devices to prevent screen obstruction */
    .hanioo-fw-tooltip {
        display: none !important;
    }

    /* Full-width responsive bottom-sheet on mobile devices */
    .hanioo-chat-popup {
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 84vh !important;
        max-height: 84vh !important;
        border-radius: 22px 22px 0 0 !important;
        box-shadow: 0 -8px 30px rgba(11, 22, 48, 0.25) !important;
        border-bottom: none !important;
    }

    .hanioo-chat-header {
        padding: 12px 14px;
        border-radius: 22px 22px 0 0;
    }

    .hanioo-chat-btn-icon {
        width: 36px;
        height: 36px;
    }

    .hanioo-chat-body {
        padding: 12px 10px;
    }

    .hanioo-chat-msg {
        max-width: 92%;
    }

    .hanioo-chat-input-bar {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    }
}

/* Ultra-Compact Mobile (<= 360px) */
@media (max-width: 360px) {
    .hanioo-floating-dock {
        right: 10px;
        bottom: 14px;
        gap: 8px;
    }

    .hanioo-fw-btn {
        width: 40px;
        height: 40px;
    }

    .hanioo-fw-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    .hanioo-floating-dock,
    .hanioo-fw-btn,
    .hanioo-chat-popup,
    .hanioo-chat-msg,
    .hanioo-fw-item--btt {
        animation: none !important;
        transition: none !important;
    }
    .hanioo-typing-dot {
        animation-duration: 2s !important;
    }
}

