/**
 * Ajax Switcher - Frontend Styles
 * 
 * @package AjaxSwitcher
 * @author Dante Testa <https://dantetesta.com.br>
 * @version 5.0.0
 * @since 5.0.0
 */

/* ========================================
   Botão Ajax Switcher
   ======================================== */

.ajax-switcher-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    outline: none;
    position: relative;
}

.ajax-switcher-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.ajax-switcher-btn:focus {
    outline: none;
}

.ajax-switcher-btn:active {
    transform: scale(0.95);
}

/* ========================================
   Ícone do Switcher
   ======================================== */

.ajax-switcher-icon {
    display: block;
    margin: 0;
    padding: 0;
    height: auto;
    max-width: 100%;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ========================================
   Estados do Botão
   ======================================== */

/* Estado de Loading */
.ajax-switcher-btn.ajax-switcher-loading {
    cursor: wait;
    pointer-events: none;
}

.ajax-switcher-btn.ajax-switcher-loading .ajax-switcher-icon {
    opacity: 0.5;
    animation: ajax-switcher-pulse 1.5s ease-in-out infinite;
}

/* Estado de Sucesso */
.ajax-switcher-btn.ajax-switcher-success .ajax-switcher-icon {
    animation: ajax-switcher-success 0.6s ease;
}

/* Estado de Erro */
.ajax-switcher-btn.ajax-switcher-error .ajax-switcher-icon {
    animation: ajax-switcher-shake 0.5s ease;
}

/* ========================================
   Animações
   ======================================== */

@keyframes ajax-switcher-pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes ajax-switcher-success {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes ajax-switcher-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* ========================================
   Mensagem de Erro (para admins)
   ======================================== */

.ajax-switcher-error-message {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 8px;
    background-color: #dc3232;
    color: #fff;
    font-size: 12px;
    border-radius: 3px;
    animation: ajax-switcher-fade-in 0.3s ease;
}

@keyframes ajax-switcher-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Responsividade - Mobile First
   ======================================== */

/* Mobile (padrão) */
.ajax-switcher-btn {
    min-width: 40px;
    min-height: 24px;
}

/* Tablet */
@media screen and (min-width: 768px) {
    .ajax-switcher-btn:hover {
        transform: scale(1.08);
    }
}

/* Desktop */
@media screen and (min-width: 1024px) {
    .ajax-switcher-btn:hover {
        transform: scale(1.1);
    }
}

/* ========================================
   Acessibilidade
   ======================================== */

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .ajax-switcher-btn:focus {
        outline: none;
    }
}

/* Redução de movimento */
@media (prefers-reduced-motion: reduce) {
    .ajax-switcher-btn,
    .ajax-switcher-icon {
        transition: none;
        animation: none;
    }
    
    .ajax-switcher-btn:hover {
        transform: none;
    }
}

/* Modo escuro */
@media (prefers-color-scheme: dark) {
    .ajax-switcher-btn:focus {
        outline: none;
    }
}

/* ========================================
   Print
   ======================================== */

@media print {
    .ajax-switcher-btn {
        display: none;
    }
}

/* ========================================
   Compatibilidade com temas
   ======================================== */

/* Reset de estilos que podem conflitar */
.ajax-switcher-btn img {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Garante que o botão não herde estilos de links */
a.ajax-switcher-btn {
    text-decoration: none !important;
    color: inherit !important;
}

a.ajax-switcher-btn:hover,
a.ajax-switcher-btn:focus,
a.ajax-switcher-btn:active {
    text-decoration: none !important;
    color: inherit !important;
}
