/**
 * Guia Bicuiras - Modern Button System
 * Sistema de botões seguindo princípios de Material Design 3 + iOS HIG
 * Mobile-First, Acessível, Intuitivo
 */

/* ========================================
   SISTEMA DE BOTÕES - FUNDAMENTOS
======================================== */

:root {
    /* Tamanhos mínimos de toque (WCAG 2.5.5) */
    --btn-min-touch-target: 44px;
    --btn-min-touch-target-large: 48px;
    
    /* Espaçamentos */
    --btn-padding-sm: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    --btn-padding-md: clamp(0.75rem, 2.5vw, 1rem) clamp(1.5rem, 4vw, 2rem);
    --btn-padding-lg: clamp(1rem, 3vw, 1.5rem) clamp(2rem, 5vw, 3rem);
    
    /* Transições suaves */
    --btn-transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    --btn-transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   BOTÃO BASE - Mobile-First
======================================== */

.btn-modern {
    /* Layout flexbox */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    
    /* Dimensões responsivas */
    min-height: var(--btn-min-touch-target);
    padding: var(--btn-padding-md);
    
    /* Tipografia */
    font-family: var(--font-heading);
    font-size: clamp(0.875rem, 2.2vw, 1rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-decoration: none;
    text-align: center;
    
    /* Visual */
    border-radius: clamp(8px, 2vw, 12px);
    border: 2px solid transparent;
    
    /* Comportamento */
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    
    /* Transição */
    transition: var(--btn-transition);
    
    /* Performance */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    
    /* Estados */
    position: relative;
    overflow: hidden;
}

.btn-modern:disabled,
.btn-modern[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tablet/Desktop */
@media (min-width: 768px) {
    .btn-modern {
        min-height: var(--btn-min-touch-target-large);
        font-size: clamp(0.95rem, 1.8vw, 1.125rem);
        padding: var(--btn-padding-lg);
    }
}

/* ========================================
   VARIANTES DE BOTÕES
======================================== */

/* PRIMARY - Ação principal (CTA) */
.btn-primary {
    color: var(--brutalist-white);
    background: linear-gradient(135deg, var(--brutalist-orange) 0%, var(--brutalist-orange-light) 100%);
    border-color: transparent;
    box-shadow: 
        0 4px 12px rgba(30, 136, 229, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 24px rgba(30, 136, 229, 0.35),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 
        0 2px 8px rgba(30, 136, 229, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* SECONDARY - Ação secundária */
.btn-secondary {
    color: var(--brutalist-orange);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--brutalist-orange);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn-secondary:hover {
    color: var(--brutalist-white);
    background: var(--brutalist-orange);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 16px rgba(30, 136, 229, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* GHOST - Transparente com borda */
.btn-ghost {
    color: var(--brutalist-white);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.btn-ghost:active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(0);
}

/* OUTLINED - Apenas borda (para fundos claros) */
.btn-outlined {
    color: var(--brutalist-orange);
    background: transparent;
    border-color: var(--brutalist-orange);
}

.btn-outlined:hover {
    color: var(--brutalist-white);
    background: var(--brutalist-orange);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.2);
}

/* TEXT - Apenas texto (sem fundo) */
.btn-text {
    color: var(--brutalist-orange);
    background: transparent;
    border: none;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    font-weight: 600;
}

.btn-text:hover {
    background: rgba(30, 136, 229, 0.08);
    transform: none;
}

.btn-text:active {
    background: rgba(30, 136, 229, 0.15);
}

/* ========================================
   TAMANHOS DE BOTÕES
======================================== */

.btn-sm {
    min-height: 36px;
    padding: var(--btn-padding-sm);
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    border-radius: clamp(6px, 1.5vw, 8px);
}

.btn-md {
    /* Padrão definido em .btn-modern */
}

.btn-lg {
    min-height: var(--btn-min-touch-target-large);
    padding: clamp(1.25rem, 3.5vw, 1.75rem) clamp(2.5rem, 6vw, 4rem);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    border-radius: clamp(10px, 2.5vw, 14px);
}

.btn-xl {
    min-height: 56px;
    padding: clamp(1.5rem, 4vw, 2rem) clamp(3rem, 7vw, 5rem);
    font-size: clamp(1.125rem, 2.8vw, 1.5rem);
    border-radius: clamp(12px, 3vw, 16px);
}

/* ========================================
   BOTÕES COM ÍCONES
======================================== */

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 0.75rem);
}

.btn-icon i,
.btn-icon svg {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    flex-shrink: 0;
}

/* Ícone à esquerda */
.btn-icon-left i:first-child,
.btn-icon-left svg:first-child {
    margin-right: clamp(0.25rem, 1vw, 0.5rem);
}

/* Ícone à direita */
.btn-icon-right i:last-child,
.btn-icon-right svg:last-child {
    margin-left: clamp(0.25rem, 1vw, 0.5rem);
}

/* Botão apenas ícone (circular) */
.btn-icon-only {
    width: var(--btn-min-touch-target);
    height: var(--btn-min-touch-target);
    padding: 0;
    border-radius: 50%;
}

@media (min-width: 768px) {
    .btn-icon-only {
        width: var(--btn-min-touch-target-large);
        height: var(--btn-min-touch-target-large);
    }
}

/* ========================================
   BOTÃO FULL-WIDTH (Mobile)
======================================== */

.btn-block {
    display: flex;
    width: 100%;
}

/* Desktop: volta ao inline */
@media (min-width: 768px) {
    .btn-block-mobile {
        display: inline-flex;
        width: auto;
    }
}

/* ========================================
   GRUPOS DE BOTÕES
======================================== */

.btn-group {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 2vw, 1rem);
    width: 100%;
}

/* Tablet/Desktop: horizontal */
@media (min-width: 768px) {
    .btn-group {
        flex-direction: row;
        flex-wrap: wrap;
        width: auto;
    }
    
    .btn-group .btn-modern {
        flex: 0 1 auto;
    }
}

/* Grupo centralizado */
.btn-group-center {
    justify-content: center;
    align-items: center;
}

/* Grupo com espaçamento entre elementos */
.btn-group-space-between {
    justify-content: space-between;
}

/* ========================================
   MICRO-INTERAÇÕES - RIPPLE EFFECT
======================================== */

.btn-ripple-effect {
    position: relative;
    overflow: hidden;
}

.btn-ripple-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;
    opacity: 0;
}

.btn-ripple-effect:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: width 0s, height 0s, opacity 0.3s;
}

/* ========================================
   LOADING STATE
======================================== */

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   ESTADOS DE FOCO - ACESSIBILIDADE
======================================== */

.btn-modern:focus-visible {
    outline: 3px solid var(--brutalist-orange);
    outline-offset: 3px;
}

.btn-ghost:focus-visible,
.btn-text:focus-visible {
    outline-color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   ANIMAÇÕES DE ENTRADA
======================================== */

.btn-animate-in {
    animation: btnFadeInUp 0.6s cubic-bezier(0.19, 1, 0.22, 1) backwards;
}

@keyframes btnFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   BOTÕES FLUTUANTES (FAB)
======================================== */

.btn-fab {
    position: fixed;
    bottom: clamp(1rem, 4vw, 2rem);
    right: clamp(1rem, 4vw, 2rem);
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.btn-fab:hover {
    transform: scale(1.1);
    box-shadow: 
        0 8px 28px rgba(0, 0, 0, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
    .btn-fab {
        width: 64px;
        height: 64px;
    }
}

/* ========================================
   RESPONSIVIDADE - LANDSCAPE MOBILE
======================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .btn-modern {
        min-height: 36px;
        padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
        font-size: clamp(0.75rem, 2vw, 0.875rem);
    }
    
    .btn-lg {
        min-height: 40px;
        padding: clamp(0.75rem, 2.5vw, 1rem) clamp(1.5rem, 4vw, 2rem);
    }
}

/* ========================================
   DARK MODE SUPPORT
======================================== */

@media (prefers-color-scheme: dark) {
    .btn-secondary {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(12px);
    }
    
    .btn-outlined {
        border-color: rgba(255, 255, 255, 0.5);
        color: rgba(255, 255, 255, 0.95);
    }
}

