/* ============================================
   COMPONENTS.CSS — Preloader, WhatsApp Float,
   Scroll-to-Top, Misc Utilities
   ============================================ */

/* === PRELOADER === */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 102, 0, 0.15);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

.preloader-text {
    color: var(--gray-400);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === FLOATING WHATSAPP === */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: var(--z-float);
    display: flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
}

.whatsapp-float i {
    width: 56px;
    height: 56px;
    background: #25d366;
    color: var(--secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all var(--transition-base);
    position: relative;
    z-index: 2;
}

.whatsapp-float:hover i {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.5);
}

.chat-bubble {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
    transform-origin: right center;
    background: var(--secondary);
    color: var(--gray-700);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    line-height: 1.4;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    animation: bubbleTapPulse 2.5s ease-in-out infinite;
}

.chat-bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--secondary);
    box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.05);
}

@keyframes bubbleTapPulse {
    0%, 60%, 100% {
        opacity: 1;
        transform: translateY(-50%) translateX(0) scale(1);
    }
    72% {
        opacity: 0.95;
        transform: translateY(-50%) translateX(2px) scale(0.95);
    }
    84% {
        opacity: 1;
        transform: translateY(-50%) translateX(-2px) scale(1.03);
    }
}

/* === SCROLL TO TOP === */
.scroll-top {
    position: fixed;
    bottom: 100px;
    right: 34px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: var(--secondary);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: var(--z-float);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-base);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    background: var(--accent);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-accent);
}

/* === NAV OVERLAY (Mobile) === */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-header) - 10);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all var(--transition-base);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 18px;
        right: 14px;
    }

    .whatsapp-float i {
        width: 46px;
        height: 46px;
        font-size: 24px;
    }

    /* Chat bubble visible on all mobile screens - compact proportional version */
    .chat-bubble {
        display: block;
        position: absolute;
        right: 54px;
        font-size: 0.7rem;
        padding: 6px 10px;
        line-height: 1.3;
        width: max-content;
        max-width: 175px;
        white-space: normal;
    }

    .scroll-top {
        bottom: 76px;
        right: 17px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* === Ensure no white gap at bottom === */
body > *:last-child {
    margin-bottom: 0 !important;
}
