/* Mobile Floating Filter Button - Hidden on desktop by default */

.mobile-floating-filter-button {
    display: none !important;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #2563eb;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 45;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    justify-content: center;
}

/* Show on mobile only */
@media (max-width: 768px) {
    .mobile-floating-filter-button {
        display: flex !important;
    }

    /* Initially hidden */
    .mobile-floating-filter-button.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateY(100px);
    }
}

.mobile-floating-filter-button:hover {
    background: #1d4ed8;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.mobile-floating-filter-button:active {
    transform: scale(0.95);
}

.mobile-floating-filter-button__icon {
    color: #ffffff;
    flex-shrink: 0;
}

.mobile-floating-filter-button__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


/* Adjust position when keyboard is visible (iOS) */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.6), 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(37, 99, 235, 0.2);
    }
}

.mobile-floating-filter-button.has-active-filters {
    animation: pulse 2s infinite;
}

/* Ripple effect on click */
.mobile-floating-filter-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.mobile-floating-filter-button:active::before {
    width: 100%;
    height: 100%;
}

/* Accessibility */
.mobile-floating-filter-button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 4px;
}

/* Adjust position when keyboard is visible (iOS) */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) and (max-height: 500px) {
        .mobile-floating-filter-button {
            bottom: 12px;
            right: 12px;
            width: 48px;
            height: 48px;
        }
        
        .mobile-floating-filter-button__icon {
            width: 20px;
            height: 20px;
        }
    }
}

/* Small mobile adjustments */
@media (max-width: 375px) {
    .mobile-floating-filter-button {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }
}

/* Extra small mobile */
@media (max-width: 320px) {
    .mobile-floating-filter-button {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
    
    .mobile-floating-filter-button__icon {
        width: 20px;
        height: 20px;
    }
    
    .mobile-floating-filter-button__badge {
        min-width: 20px;
        height: 20px;
        font-size: 11px;
    }
}

/* Prevent button from overlapping with content */
@media (max-width: 768px) {
    .articles-layout__main {
        padding-bottom: 100px; /* Space for floating button */
    }
}

/* Dark mode support */
@media (max-width: 768px) {
    [data-theme="dark"] .mobile-floating-filter-button {
        background: #3b82f6;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    [data-theme="dark"] .mobile-floating-filter-button:hover {
        background: #2563eb;
        box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5), 0 3px 6px rgba(0, 0, 0, 0.4);
    }
    
    [data-theme="dark"] .mobile-floating-filter-button__badge {
        background: #f87171;
        border-color: #1f2937;
    }
}

/* Smooth entrance animation */
@keyframes floatIn {
    from {
        transform: translateY(100px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.mobile-floating-filter-button {
    animation: floatIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.3s backwards;
}

/* Interaction states */
.mobile-floating-filter-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mobile-floating-filter-button {
        border: 2px solid #ffffff;
    }
    
    .mobile-floating-filter-button__badge {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mobile-floating-filter-button {
        animation: none;
        transition: none;
    }
    
    .mobile-floating-filter-button.has-active-filters {
        animation: none;
    }
    
    .mobile-floating-filter-button::before {
        transition: none;
    }
}
