/**
 * Floating Action Buttons System - Blog Parceiros iFood
 * 
 * Sistema de botões flutuantes para acesso rápido aos widgets da sidebar
 * Posicionamento: Fixo na lateral direita, 80px do topo
 * Funcionalidade: Toggle de botões secundários + overlay de conteúdo
 */

/* ========================================
   FLOATING BUTTONS CONTAINER
   ======================================== */

.ifp-floating-buttons {
    position: fixed;
    top: 90px;
    right: 0;
    z-index: 1000;
    display: none; /* Oculto por padrão no desktop */
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    pointer-events: none; /* Permite interação apenas com botões */
}

/* ========================================
   BOTÃO PRINCIPAL (TOGGLE)
   ======================================== */

.ifp-floating-btn--toggle {
    width: 30px;
    height: 38px;
    border-radius: 5px 0 0 5px;
    background: rgba(26, 26, 26, 0.80);
    border: none;
    box-shadow: none;
    cursor: pointer;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1001;
    padding: 6.182px 3.18px;
    margin: 0;
}

.ifp-floating-btn--toggle:hover, .ifp-floating-btn--toggle:focus {
    background: rgba(26, 26, 26, 0.95);
    box-shadow: none;
}

.ifp-floating-btn--toggle:active, .ifp-floating-btn--toggle:focus {
    transform: none;
    outline: none;
    border: none;
}

.ifp-floating-btn--toggle .ifp-floating-btn__icon {
    color: white;
    transition: transform 0.3s ease;
}

/* Rotação do ícone + quando expandido */
.ifp-floating-buttons.is-expanded .ifp-floating-btn--toggle .ifp-floating-btn__icon {
    transform: rotate(45deg);
}

/* ========================================
   BOTÕES SECUNDÁRIOS
   ======================================== */

.ifp-floating-buttons__secondary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 7.727px;
    margin-top: 7.727px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.ifp-floating-buttons.is-expanded .ifp-floating-buttons__secondary {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: all;
}

.ifp-floating-btn--secondary {
    width: 30px;
    height: 38px;
    border-radius: 5px 0 0 5px;
    background: var(--ifp-color-primary-bordo, #890019);
    border: none;
    box-shadow: none;
    cursor: pointer;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0 !important;
}

.ifp-floating-btn--secondary:hover {
    background: #6B0014;
    box-shadow: none;
}

.ifp-floating-btn--secondary:active {
    transform: none;
    outline: none;
    border: none;
}

/* Animação escalonada dos botões secundários */
.ifp-floating-buttons.is-expanded .ifp-floating-btn--secondary:nth-child(1) {
    transition-delay: 0.1s;
}

.ifp-floating-buttons.is-expanded .ifp-floating-btn--secondary:nth-child(2) {
    transition-delay: 0.15s;
}

.ifp-floating-buttons.is-expanded .ifp-floating-btn--secondary:nth-child(3) {
    transition-delay: 0.2s;
}

.ifp-floating-buttons.is-expanded .ifp-floating-btn--secondary:nth-child(4) {
    transition-delay: 0.25s;
}

/* ========================================
   BOTÃO DO AUTOR (COM FOTO DE FUNDO)
   ======================================== */

.ifp-floating-btn--secondary[data-widget="author"] {
    padding: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: none;
    background-color: var(--ifp-color-primary-bordo, #890019);  /* Fallback se não houver foto */
}

.ifp-floating-btn--secondary[data-widget="author"]:hover {
    box-shadow: none;
    transform: translateX(-2px);
}

.ifp-floating-btn--secondary[data-widget="author"] .ifp-floating-btn__avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* ========================================
   ÍCONES DOS BOTÕES SECUNDÁRIOS
   ======================================== */

.ifp-floating-btn__secondary-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.2s ease;
    filter: brightness(0) invert(1); /* Torna os ícones brancos */
}

.ifp-floating-btn--secondary:hover .ifp-floating-btn__secondary-icon {
    transform: scale(1.1);
}

/* ========================================
   OVERLAY SYSTEM
   ======================================== */

.ifp-floating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ifp-floating-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.ifp-floating-overlay__content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.ifp-floating-overlay.is-visible .ifp-floating-overlay__content {
    transform: scale(1) translateY(0);
}

.ifp-floating-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #E2E8F0;
    background: #F8F9FA;
}

.ifp-floating-overlay__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ifp-color-primary, #EB0033);
    margin: 0;
    font-family: "Tipo iFood Titulos", "TipoiFoodVariable", sans-serif;
}

.ifp-floating-overlay__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #E2E8F0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #4A5568;
    padding: 0 !important;
}

.ifp-floating-overlay__close:hover {
    background: var(--ifp-color-primary, #EB0033);
    color: white;
    transform: scale(1.05);
}

.ifp-floating-overlay__close:focus {
    background: var(--ifp-color-primary, #EB0033);
    color: white;
    transform: scale(1.05);
}

.ifp-floating-overlay__body {
    padding: 24px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Scrollbar customizada para overlay */
.ifp-floating-overlay__body::-webkit-scrollbar {
    width: 6px;
}

.ifp-floating-overlay__body::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 3px;
}

.ifp-floating-overlay__body::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 3px;
}

.ifp-floating-overlay__body::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

/* ========================================
   CONTEÚDO DOS WIDGETS NO OVERLAY  
   ======================================== */

.ifp-floating-overlay .ifp-author-box-layout,
.ifp-floating-overlay .ifp-newsletter-widget,
.ifp-floating-overlay .ifp-journey-widget,
.ifp-floating-overlay .ifp-continue-lendo-widget {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.ifp-floating-overlay .ifp-newsletter-widget {
    background: linear-gradient(135deg, #EB0033 0%, #C53030 100%) !important;
    border-radius: 12px !important;
    padding: 20px !important;
    color: white;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.ifp-floating-btn:focus,
.ifp-floating-btn--toggle:focus,
.ifp-floating-btn--secondary:focus {
    box-shadow: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .ifp-floating-buttons {
        display: flex; /* Mostra no tablet */
        right: 0;
        top: 90px;
    }
    
    .ifp-floating-overlay__content {
        max-width: 95vw;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .ifp-floating-buttons {
        display: flex; /* Mostra no mobile */
        right: 0;
        top: 90px;
    }
    
    .ifp-floating-btn--toggle {
        width: 28px;
        height: 36px;
        padding: 5px 2.5px;
    }
    
    .ifp-floating-btn--secondary {
        width: 28px;
        height: 36px;
    }
    
    .ifp-floating-btn__secondary-icon {
        width: 16px;
        height: 16px;
    }
    
    .ifp-floating-overlay {
        padding: 16px;
    }
    
    .ifp-floating-overlay__content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .ifp-floating-overlay__header {
        padding: 16px 20px;
    }
    
    .ifp-floating-overlay__title {
        font-size: 16px;
    }
    
    .ifp-floating-overlay__body {
        padding: 20px;
        max-height: calc(95vh - 70px);
    }
}

/* Mobile pequeno */
@media (max-width: 480px) {
    .ifp-floating-buttons {
        display: flex; /* Mostra no mobile pequeno */
        right: 0;
        top: 112px;
    }
    
    .ifp-floating-btn--toggle {
        width: 26px;
        height: 34px;
        padding: 4px 2px;
    }
    
    .ifp-floating-btn--secondary {
        width: 26px;
        height: 34px;
    }
    
    .ifp-floating-btn__secondary-icon {
        width: 14px;
        height: 14px;
    }
}

/* ========================================
   ANIMAÇÕES E EFEITOS
   ======================================== */

/* Animação de pulso removida para evitar sombras */

@keyframes overlayEnter {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

@keyframes contentEnter {
    from {
        transform: scale(0.8) translateY(40px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.ifp-floating-overlay.is-visible {
    animation: overlayEnter 0.3s ease;
}

.ifp-floating-overlay.is-visible .ifp-floating-overlay__content {
    animation: contentEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   ESTADOS ESPECIAIS
   ======================================== */

/* Estado quando overlay está aberto */
body.floating-overlay-open {
    overflow: hidden;
}

/* Prevenção de scroll durante animações */
.ifp-floating-overlay.is-animating {
    pointer-events: none;
}

.ifp-floating-overlay.is-animating .ifp-floating-overlay__content {
    pointer-events: all;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .ifp-floating-buttons,
    .ifp-floating-overlay {
        display: none !important;
    }
}