/* ===== ESTILOS ESPECÍFICOS DO INDEX PRINCIPAL ===== */

/* Contador discreto na navegação */
.stats-counter-nav {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: var(--radius-md);
    opacity: 0;
    transform: translateY(-10px);
    animation: slideUp 0.4s ease-out 0.3s both;
}

.counter-number-small {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--brand-primary);
    line-height: 1;
}

.counter-label-small {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--neutral-500);
    text-transform: lowercase;
}

/* Responsividade do contador na nav */
@media (max-width: 768px) {
    .stats-counter-nav {
        padding: var(--space-1) var(--space-2);
    }

    .counter-number-small {
        font-size: var(--text-xs);
    }

    .counter-label-small {
        font-size: 10px;
    }
}

@media (max-width: 640px) {
    .nav-content {
        flex-direction: column;
        gap: var(--space-2);
    }

    .stats-counter-nav {
        order: -1;
        align-self: flex-end;
    }
}

/* Hero Section Moderna */
.hero {
    background: var(--gradient-hero);
    position: relative;
    overflow: hidden;
    padding: var(--space-16) 0 var(--space-20);
    min-height: 60vh;
    display: flex;
    align-items: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
    animation: slideUp 0.8s ease-out;
}

.hero-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    object-fit: contain;
    padding: var(--space-2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-glass);
    transition: all var(--transition-base);
}

.hero-logo:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.hero-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-extrabold);
    color: var(--neutral-900);
    margin-bottom: var(--space-4);
    line-height: var(--leading-tight);
    animation: slideUp 0.8s ease-out 0.2s both;
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: var(--neutral-600);
    margin-bottom: var(--space-8);
    line-height: var(--leading-relaxed);
    animation: slideUp 0.8s ease-out 0.4s both;
}

.hero-description {
    font-size: var(--text-lg);
    color: var(--neutral-500);
    max-width: 600px;
    margin: 0 auto var(--space-12);
    line-height: var(--leading-relaxed);
    animation: slideUp 0.8s ease-out 0.6s both;
}

/* Navegação Moderna */
.nav-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--neutral-200);
    padding: var(--space-4) 0;
    transition: all var(--transition-base);
}

@media (prefers-color-scheme: dark) {
    .nav-header {
        background: rgba(15, 23, 42, 0.8);
        border-bottom-color: var(--neutral-700);
    }
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    object-fit: contain;
    padding: var(--space-1);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.nav-title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--brand-primary);
    margin: 0;
}

.nav-actions {
    display: flex;
    gap: var(--space-2);
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    text-decoration: none;
    border: 1px solid var(--neutral-200);
    background: var(--surface);
    color: var(--brand-primary);
    transition: all var(--transition-base);
}

.btn-nav:hover {
    background: var(--neutral-50);
    border-color: var(--brand-accent);
    transform: translateY(-1px);
}

.btn-nav.hidden {
    display: none;
}

/* Classe utilitária para esconder elementos */
.hidden {
    display: none !important;
}

/* Grid de Aplicações Moderno */
.apps-section {
    padding: var(--space-16) 0;
    background: var(--bg-primary);
    /* Otimização para animações suaves */
    transform: translateZ(0);
    /* Initial state hidden for animation */
    display: none;
    opacity: 0;
}

/* Forçar Hero a esconder se houver problema, JS reativará se funcionar */
/* mas na verdade, queremos que o site funcione. Se o JS falhar, o hero não deve bloquear */
/* Vamos deixar o CSS padrão como visível para apps e oculto para hero, e o JS faz o contrário */
/* POREM, o CSS original não tem #hero ou #chooser com display:none. Isso é feito no JS. */

.section-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    margin-bottom: var(--space-4);
}

.section-description {
    font-size: var(--text-lg);
    color: var(--neutral-600);
    max-width: 600px;
    margin: 0 auto;
    line-height: var(--leading-relaxed);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-12);
    /* Otimização para performance de animações */
    transform: translateZ(0);
}

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--neutral-200);
    cursor: pointer;
    text-align: left;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
    will-change: transform;
    /* Prevenir scroll automático no foco */
    scroll-margin: 0;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.app-card:hover::before {
    transform: scaleX(1);
}

.app-card:hover {
    transform: translateY(-8px);
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-xl);
}

.app-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
    /* Desabilitar scroll automático no foco */
    scroll-behavior: auto;
}

.app-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xl);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-brand);
    animation: float 3s ease-in-out infinite;
    margin-bottom: var(--space-2);
}

.app-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

.app-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    margin-bottom: var(--space-2);
}

.app-description {
    font-size: var(--text-base);
    color: var(--neutral-600);
    line-height: var(--leading-relaxed);
    flex-grow: 1;
}

.app-badge {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    letter-spacing: 0.05em;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    text-transform: uppercase;
}

/* Card Seguro - Módulo com Autenticação */
.app-card-secure {
    border: 2px solid rgba(239, 68, 68, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(254, 242, 242, 0.95));
    position: relative;
}

.app-card-secure::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.app-card-secure:hover {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 20px 40px rgba(239, 68, 68, 0.15);
}

.app-card-secure .app-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* Card Logado - Estado quando usuário já está autenticado */
.app-card-logged {
    border: 2px solid rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 253, 244, 0.95));
}

.app-card-logged::before {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.app-card-logged:hover {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 20px 40px rgba(34, 197, 94, 0.15);
}

.app-card-logged .app-icon {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.secure-badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    font-size: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-full);
    padding: var(--space-1);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.secure-badge.logged {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Seção de Ajuda */
.help-section {
    background: var(--bg-secondary);
    padding: var(--space-12) 0;
    text-align: center;
}

.help-content {
    max-width: 600px;
    margin: 0 auto;
}

.help-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    margin-bottom: var(--space-4);
}

.help-text {
    font-size: var(--text-base);
    color: var(--neutral-600);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-6);
}

.keyboard-shortcuts {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.shortcut {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--neutral-700);
}

.shortcut-key {
    font-family: var(--font-mono);
    font-weight: var(--font-bold);
    background: var(--neutral-100);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
}

/* Responsividade */
@media (max-width: 768px) {
    .hero {
        padding: var(--space-12) 0 var(--space-16);
        min-height: 50vh;
    }

    .hero-title {
        font-size: var(--text-3xl);
    }

    .hero-subtitle {
        font-size: var(--text-lg);
    }

    .hero-logos {
        gap: var(--space-4);
    }

    .hero-logo {
        width: 60px;
        height: 60px;
    }

    .apps-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .nav-content {
        flex-direction: column;
        gap: var(--space-3);
    }

    .keyboard-shortcuts {
        flex-direction: column;
        align-items: center;
    }
}

/* Otimizações para dispositivos com performance limitada */
@media (prefers-reduced-motion: reduce) {
    .app-card {
        animation: none;
        transition: none;
    }

    .app-card:hover {
        transform: none;
    }

    .app-icon {
        animation: none;
    }
}

/* Desabilitar smooth scroll durante interações com cards */
.apps-section {
    scroll-behavior: auto !important;
}

.apps-section * {
    scroll-behavior: auto !important;
}

@media (max-width: 640px) {
    .hero-title {
        font-size: var(--text-2xl);
    }

    .section-title {
        font-size: var(--text-2xl);
    }

    .app-card {
        padding: var(--space-6);
    }

    .app-icon {
        width: 60px;
        height: 60px;
    }

    .app-icon svg {
        width: 30px;
        height: 30px;
    }
}