/**
 * Ainprokash Donation Tracker - Floating Coffee Button & Micro-Card
 * Lightweight, Ultra-responsive, Zero Dependencies (~3KB)
 */

#ap-floating-coffee-wrap {
    position: fixed;
    z-index: 99990;
    bottom: 85px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hind Siliguri", "Noto Sans Bengali", sans-serif;
    line-height: 1.4;
    box-sizing: border-box;
}

#ap-floating-coffee-wrap *,
#ap-floating-coffee-wrap *:before,
#ap-floating-coffee-wrap *:after {
    box-sizing: inherit;
}

#ap-floating-coffee-wrap.ap-coffee-pos-right {
    right: 20px;
    left: auto;
}

#ap-floating-coffee-wrap.ap-coffee-pos-left {
    left: 20px;
    right: auto;
}

/* Floating Action Trigger Button with Multi-layered Animations */
.ap-coffee-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #FFDD00 0%, #FBBF24 100%);
    color: #26170d;
    border: 2px solid #ffffff;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 22px -3px rgba(245, 158, 11, 0.45), 0 3px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    outline: none;
    z-index: 2;
}

.ap-coffee-btn.ap-animated {
    animation: apCoffeeFloat 3.2s ease-in-out infinite;
    will-change: transform, box-shadow;
}

.ap-coffee-btn:hover {
    animation-play-state: paused;
    transform: translateY(-4px) scale(1.05) !important;
    box-shadow: 0 14px 30px -2px rgba(245, 158, 11, 0.65), 0 6px 14px rgba(0, 0, 0, 0.15) !important;
    background: linear-gradient(135deg, #FFE54C 0%, #F59E0B 100%);
}

.ap-coffee-btn:active {
    transform: translateY(-1px) scale(0.97) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

/* 1. Gentle Floating Levitation Animation */
@keyframes apCoffeeFloat {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 8px 22px -3px rgba(245, 158, 11, 0.45), 0 3px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: translateY(-7px);
        box-shadow: 0 16px 28px -2px rgba(245, 158, 11, 0.6), 0 8px 16px rgba(0, 0, 0, 0.12);
    }
}

/* 2. Contained Gold Light Shimmer Beam Sweep */
.ap-coffee-shimmer-wrap {
    position: absolute;
    inset: 0;
    border-radius: 50px;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.ap-coffee-shimmer-beam {
    position: absolute;
    top: -60%;
    left: -70%;
    width: 45%;
    height: 220%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(26deg);
    animation: apCoffeeShimmer 4.2s ease-in-out infinite;
}

@keyframes apCoffeeShimmer {
    0%, 65% {
        left: -70%;
        opacity: 0;
    }
    70% {
        opacity: 1;
    }
    85% {
        left: 145%;
        opacity: 1;
    }
    100% {
        left: 145%;
        opacity: 0;
    }
}

/* 3. Coffee Cup Icon Container with Playful Tilt/Wiggle */
.ap-coffee-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #ffffff;
    border-radius: 50%;
    color: #78350f;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    animation: apCupWiggle 4.6s ease-in-out infinite;
    transform-origin: center bottom;
    z-index: 2;
}

@keyframes apCupWiggle {
    0%, 76%, 100% {
        transform: rotate(0deg) scale(1);
    }
    80% {
        transform: rotate(-14deg) scale(1.1);
    }
    84% {
        transform: rotate(12deg) scale(1.1);
    }
    88% {
        transform: rotate(-8deg) scale(1.05);
    }
    92% {
        transform: rotate(5deg) scale(1.02);
    }
    96% {
        transform: rotate(0deg) scale(1);
    }
}

.ap-coffee-svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

/* 4. Rising Steam Particles Animation */
.ap-steam-waves {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    pointer-events: none;
    z-index: 3;
}

.ap-steam {
    display: block;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(to top, rgba(120, 53, 15, 0.75), rgba(245, 158, 11, 0));
    opacity: 0;
    animation: apSteamRise 2.2s ease-out infinite;
}

.ap-steam.s1 {
    height: 7px;
    animation-delay: 0s;
}

.ap-steam.s2 {
    height: 10px;
    animation-delay: 0.7s;
}

.ap-steam.s3 {
    height: 8px;
    animation-delay: 1.4s;
}

@keyframes apSteamRise {
    0% {
        transform: translateY(2px) scaleX(0.8);
        opacity: 0;
    }
    30% {
        opacity: 0.85;
    }
    60% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-9px) scaleX(1.4);
        opacity: 0;
    }
}

/* 5. Heartbeat Badge Animation */
.ap-heart-badge {
    position: absolute;
    top: -3px;
    right: -4px;
    font-size: 10px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
    animation: apHeartBeat 1.8s ease-in-out infinite;
    transform-origin: center center;
    z-index: 4;
}

@keyframes apHeartBeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* Button Text Label Container & Minimize Button */
.ap-coffee-label-wrap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 200px;
    opacity: 1;
    transform: translateX(0);
    transition: max-width 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
                opacity 0.25s ease,
                transform 0.35s ease,
                margin 0.35s ease;
    white-space: nowrap;
    overflow: hidden;
    z-index: 2;
}

.ap-coffee-label {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #26170d;
    white-space: nowrap;
}

/* Minimize 'x' Icon Button */
.ap-coffee-minimize-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: rgba(62, 39, 35, 0.12);
    color: #5d2508;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    margin-left: 2px;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
}

.ap-coffee-minimize-btn:hover {
    background: rgba(62, 39, 35, 0.28);
    color: #26170d;
    transform: scale(1.22);
}

.ap-coffee-minimize-btn:active {
    transform: scale(0.92);
}

/* Collapsed State: Displays only the animated coffee cup badge */
.ap-coffee-btn.ap-collapsed {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    padding: 0 !important;
    justify-content: center;
    border-radius: 50% !important;
    gap: 0 !important;
}

.ap-coffee-btn.ap-collapsed .ap-coffee-label-wrap {
    max-width: 0 !important;
    opacity: 0 !important;
    transform: translateX(-10px) scale(0.7) !important;
    margin: 0 !important;
    pointer-events: none !important;
}

.ap-coffee-btn.ap-collapsed .ap-coffee-pulse {
    border-radius: 50% !important;
}

.ap-coffee-btn.ap-collapsed .ap-coffee-shimmer-wrap {
    border-radius: 50% !important;
}

/* 6. Radiant Expanding Aura Pulse Ring */
.ap-coffee-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 54px;
    border: 2px solid rgba(245, 158, 11, 0.7);
    opacity: 0;
    pointer-events: none;
    animation: apCoffeePulseAnim 3.2s infinite ease-out;
    z-index: 0;
}

@keyframes apCoffeePulseAnim {
    0% {
        transform: scale(0.96);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
    }
    60% {
        transform: scale(1.14);
        opacity: 0;
        box-shadow: 0 0 16px 4px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* 7. Click Ripple Effect */
.ap-click-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.65);
    transform: scale(0);
    animation: apRippleAnim 0.55s ease-out forwards;
    pointer-events: none;
    z-index: 3;
}

@keyframes apRippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Teaser Bubble (Tooltips) */
.ap-coffee-teaser {
    position: absolute;
    bottom: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    color: #ffffff;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.4);
    animation: apTeaserFloat 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
}

#ap-floating-coffee-wrap.ap-coffee-pos-right .ap-coffee-teaser {
    right: 0;
}

#ap-floating-coffee-wrap.ap-coffee-pos-left .ap-coffee-teaser {
    left: 0;
}

.ap-coffee-teaser:after {
    content: '';
    position: absolute;
    bottom: -6px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #0f172a;
}

#ap-floating-coffee-wrap.ap-coffee-pos-right .ap-coffee-teaser:after {
    right: 28px;
}

#ap-floating-coffee-wrap.ap-coffee-pos-left .ap-coffee-teaser:after {
    left: 28px;
}

.ap-teaser-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 2px 4px;
}

.ap-teaser-close:hover {
    color: #ffffff;
}

@keyframes apTeaserFloat {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Micro-Card Popup */
.ap-coffee-card {
    position: absolute;
    bottom: 60px;
    width: 340px;
    max-width: calc(100vw - 36px);
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: none;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99999;
}

#ap-floating-coffee-wrap.ap-coffee-pos-right .ap-coffee-card {
    right: 0;
    left: auto;
    transform-origin: bottom right;
}

#ap-floating-coffee-wrap.ap-coffee-pos-left .ap-coffee-card {
    left: 0;
    right: auto;
    transform-origin: bottom left;
}

.ap-coffee-card.active {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Card Header */
.ap-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 18px 14px;
    background: linear-gradient(180deg, #fefce8 0%, #ffffff 100%);
    border-bottom: 1px solid #fef08a;
}

.ap-card-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ap-coffee-cup-icon {
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3));
}

.ap-badge-meta {
    display: flex;
    flex-direction: column;
}

.ap-card-title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
    color: #78350f;
    line-height: 1.25;
}

.ap-card-sub {
    font-size: 11.5px;
    color: #92400e;
    margin-top: 2px;
}

.ap-card-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    transition: color 0.2s ease, background 0.2s ease;
}

.ap-card-close:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Card Body */
.ap-card-body {
    padding: 16px 18px 14px;
}

.ap-card-quote {
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    background: #f8fafc;
    border-left: 3.5px solid #f59e0b;
    padding: 10px 12px;
    border-radius: 6px;
    margin: 0 0 14px 0;
}

.ap-coffee-tiers-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

/* Quick Pills Grid */
.ap-coffee-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.ap-coffee-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none !important;
    color: #1e293b !important;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ap-coffee-pill:hover {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #b45309 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.ap-coffee-pill.featured {
    background: #fefce8;
    border-color: #fde047;
    color: #854d0e !important;
}

.ap-coffee-pill.featured:hover {
    border-color: #f59e0b;
    background: #fef08a;
}

.ap-pill-ico {
    font-size: 14px;
}

/* Primary CTA Button */
.ap-coffee-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff !important;
    border-radius: 10px;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 6px 18px -2px rgba(5, 150, 105, 0.35);
    transition: all 0.2s ease;
}

.ap-coffee-cta-btn:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px -1px rgba(5, 150, 105, 0.45);
}

.ap-coffee-cta-btn svg {
    transition: transform 0.2s ease;
}

.ap-coffee-cta-btn:hover svg {
    transform: translateX(4px);
}

/* Card Footer */
.ap-card-footer {
    padding: 10px 18px 12px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ap-methods-trust {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
}

.ap-trust-tag.bkash { color: #e2136e; }
.ap-trust-tag.nagad { color: #f7941d; }
.ap-trust-tag.rocket { color: #8c3494; }
.ap-trust-tag.bank { color: #059669; }
.ap-trust-dot { color: #cbd5e1; }

.ap-secure-note {
    font-size: 11px;
    color: #64748b;
}

/* Mobile Breakpoint Optimization */
@media (max-width: 768px) {
    #ap-floating-coffee-wrap {
        bottom: 85px;
    }

    #ap-floating-coffee-wrap.ap-coffee-pos-right {
        right: 14px;
    }

    #ap-floating-coffee-wrap.ap-coffee-pos-left {
        left: 14px;
    }

    .ap-coffee-btn {
        padding: 9px 14px;
    }

    .ap-coffee-label {
        font-size: 13.5px;
    }

    .ap-coffee-card {
        width: calc(100vw - 28px);
        max-width: 320px;
    }
}

/* Accessibility: Respect Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    .ap-coffee-btn.ap-animated,
    .ap-coffee-icon-wrap,
    .ap-coffee-pulse,
    .ap-steam,
    .ap-heart-badge,
    .ap-coffee-shimmer-beam,
    .ap-coffee-teaser {
        animation: none !important;
        transform: none !important;
    }
}
