/* ========================================================================
   HSC Aksesuar — Floating Action Hub (Cell Division Structure)
   Live Support (Top) + Theme Switcher & WhatsApp (Bottom)
   ======================================================================== */

.floating-hub {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    width: 130px;
    padding: 2px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.82);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.9) translateY(12px);
    transition: opacity 0.35s ease,
                transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.floating-hub.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.floating-hub:hover {
    border-color: rgba(13, 125, 220, 0.4);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(13, 125, 220, 0.25);
}

/* Light Theme */
[data-theme="light"] .floating-hub {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(12, 31, 47, 0.14);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .floating-hub:hover {
    border-color: rgba(13, 125, 220, 0.35);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(13, 125, 220, 0.15);
}

/* RTL positioning */
[dir="rtl"] .floating-hub {
    right: auto;
    left: 24px;
}

/* Cookie consent offset */
#cookie-consent-banner.cookie-consent-visible ~ .floating-hub {
    bottom: 90px;
}

/* When WhatsApp is disabled, make hub more compact */
.floating-hub.no-whatsapp {
    width: 100px;
}

/* ── Top Button: Live Support / Chat ────────────────────────────── */
.hub-btn-support {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    width: 100% !important;
    height: 38px !important;
    padding: 0 10px !important;
    border: none !important;
    border-radius: 14px 14px 4px 4px !important;
    background: transparent !important;
    color: #fff !important;
    cursor: pointer !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease !important;
}

.hub-btn-support:hover {
    background: rgba(13, 125, 220, 0.2) !important;
    color: #38bdf8 !important;
    transform: translateY(-1px) !important;
}

.hub-btn-support:active {
    transform: scale(0.96) !important;
}

[data-theme="light"] .hub-btn-support {
    color: var(--color-text, #0b1f33) !important;
}

[data-theme="light"] .hub-btn-support:hover {
    background: rgba(13, 125, 220, 0.12) !important;
    color: var(--color-primary, #0d7ddc) !important;
}

.hub-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hub-btn-label {
    line-height: 1;
}

/* ── Dividers ────────────────────────────────────────────────────── */
.hub-divider-h {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin: 2px 0;
    transition: background 0.3s ease;
}

[data-theme="light"] .hub-divider-h {
    background: rgba(12, 31, 47, 0.1);
}

.hub-divider-v {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
    transition: background 0.3s ease;
}

[data-theme="light"] .hub-divider-v {
    background: rgba(12, 31, 47, 0.1);
}

/* ── Bottom Row: Theme & WhatsApp ───────────────────────────────── */
.hub-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    gap: 2px;
}

/* Common bottom button styles */
.hub-btn-theme,
.hub-btn-whatsapp {
    flex: 1;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 6px !important;
    background: transparent !important;
    cursor: pointer !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: background 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease !important;
}

/* Theme Button */
.hub-btn-theme {
    color: #fff !important;
}

.hub-btn-theme:hover {
    background: rgba(13, 125, 220, 0.16) !important;
    color: #38bdf8 !important;
    transform: scale(1.08) !important;
}

.hub-btn-theme:active {
    transform: scale(0.92) !important;
}

[data-theme="light"] .hub-btn-theme {
    color: var(--color-text, #0b1f33) !important;
}

[data-theme="light"] .hub-btn-theme:hover {
    background: rgba(13, 125, 220, 0.12) !important;
    color: var(--color-primary, #0d7ddc) !important;
}

/* Theme SVGs */
.hub-btn-theme svg {
    position: absolute;
    width: 18px;
    height: 18px;
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hub-icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.hub-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .hub-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .hub-icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* WhatsApp Button */
.hub-btn-whatsapp {
    color: #25D366 !important;
}

.hub-btn-whatsapp:hover {
    background: rgba(37, 211, 102, 0.18) !important;
    color: #2bf075 !important;
    transform: scale(1.1) !important;
}

.hub-btn-whatsapp:active {
    transform: scale(0.92) !important;
}

.hub-wa-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 6px rgba(37, 211, 102, 0.4));
    transition: filter 0.2s ease;
}

.hub-btn-whatsapp:hover .hub-wa-icon-wrap {
    filter: drop-shadow(0 3px 10px rgba(37, 211, 102, 0.65));
}

/* ── WhatsApp Popover Menu ───────────────────────────────────────── */
.whatsapp-popover {
    position: fixed;
    bottom: 110px;
    right: 24px;
    z-index: 9992;
    width: 320px;
    max-width: calc(100vw - 48px);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.94);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 4px 14px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(16px);
    transform-origin: bottom right;
    transition: opacity 0.3s ease,
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0.3s;
    overflow: hidden;
}

.whatsapp-popover.is-open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

[data-theme="light"] .whatsapp-popover {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(12, 31, 47, 0.12);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
}

[dir="rtl"] .whatsapp-popover {
    right: auto;
    left: 24px;
    transform-origin: bottom left;
}

#cookie-consent-banner.cookie-consent-visible ~ .whatsapp-popover {
    bottom: 175px;
}

/* Popover Header */
.wa-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.22) 0%, rgba(18, 140, 126, 0.28) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .wa-popover-header {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15) 0%, rgba(18, 140, 126, 0.18) 100%);
    border-bottom-color: rgba(12, 31, 47, 0.08);
}

.wa-popover-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.wa-header-icon svg {
    width: 20px;
    height: 20px;
}

.wa-popover-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

[data-theme="light"] .wa-popover-title {
    color: #0b1f33;
}

.wa-popover-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: #34d399;
    font-weight: 600;
}

.wa-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: wa-pulse 1.8s infinite;
}

@keyframes wa-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.wa-popover-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.wa-popover-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

[data-theme="light"] .wa-popover-close {
    background: rgba(0, 0, 0, 0.06);
    color: #64748b;
}

[data-theme="light"] .wa-popover-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

/* Popover Body / Contact List */
.wa-popover-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.wa-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.wa-contact-item:hover {
    background: rgba(37, 211, 102, 0.12);
    border-color: rgba(37, 211, 102, 0.3);
    transform: translateX(3px);
}

[dir="rtl"] .wa-contact-item:hover {
    transform: translateX(-3px);
}

[data-theme="light"] .wa-contact-item {
    background: rgba(12, 31, 47, 0.03);
    border-color: rgba(12, 31, 47, 0.06);
}

[data-theme="light"] .wa-contact-item:hover {
    background: rgba(37, 211, 102, 0.1);
    border-color: rgba(37, 211, 102, 0.25);
}

.wa-contact-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.2);
    color: #25D366;
    flex-shrink: 0;
}

.wa-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #0f172a;
}

[data-theme="light"] .wa-online-dot {
    border-color: #fff;
}

.wa-contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wa-contact-dept {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .wa-contact-dept {
    color: #0b1f33;
}

.wa-contact-phone {
    font-size: 0.76rem;
    color: #94a3b8;
    font-family: monospace;
    letter-spacing: 0.02em;
}

[data-theme="light"] .wa-contact-phone {
    color: #64748b;
}

.wa-contact-arrow {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.2s, transform 0.2s;
}

.wa-contact-item:hover .wa-contact-arrow {
    color: #25D366;
    transform: translateX(2px);
}

[dir="rtl"] .wa-contact-item:hover .wa-contact-arrow {
    transform: translateX(-2px);
}

[data-theme="light"] .wa-contact-arrow {
    color: #94a3b8;
}
