/**
 * ==========================================================================
 * FENAJUD — Responsividade Base
 * ==========================================================================
 *
 * Fundamentos responsivos compartilhados por todos os layouts.
 * Inclui: viewport fixes, touch targets, tipografia mobile, utilitários.
 *
 * NÃO altera nenhum estilo desktop — apenas adiciona regras via @media.
 *
 * @version 1.0.0
 */

/* ==========================================================================
   1. VIEWPORT & TOUCH FIXES (Todos os tamanhos)
   ========================================================================== */

/* Prevenir zoom indesejado em inputs no iOS */
@media screen and (max-width: 1024px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    input[type="datetime-local"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Touch target mínimo WCAG — 44x44px */
@media screen and (max-width: 1024px) {
    button,
    a.btn,
    .btn,
    .nav-link-wrapper,
    .submenu-toggle,
    .selecao-toggle-btn,
    input[type="checkbox"],
    input[type="radio"],
    .page-btn,
    .limit-btn,
    .accordion-header {
        min-height: 44px;
        min-width: 44px;
    }

    /* Links de navegação */
    .nav-link-wrapper {
        padding: 0.75rem 1rem;
    }
}

/* Focus ring visível em todos os interativos */
@media screen and (max-width: 1024px) {
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible,
    [role="button"]:focus-visible,
    [tabindex]:focus-visible {
        outline: 2px solid var(--accent-color, #E31E24);
        outline-offset: 2px;
    }
}


/* ==========================================================================
   2. TIPOGRAFIA RESPONSIVA
   ========================================================================== */

@media screen and (max-width: 768px) {
    h1, .page-title {
        font-size: 1.35rem !important;
    }

    h2 {
        font-size: 1.15rem;
    }

    h3 {
        font-size: 1rem;
    }
}

@media screen and (max-width: 480px) {
    h1, .page-title {
        font-size: 1.15rem !important;
    }

    h2 {
        font-size: 1.05rem;
    }
}


/* ==========================================================================
   3. UTILITÁRIOS RESPONSIVOS
   ========================================================================== */

/* Esconder/mostrar por breakpoint */
@media screen and (max-width: 639px) {
    .hide-xs { display: none !important; }
}
@media screen and (min-width: 640px) and (max-width: 767px) {
    .hide-sm { display: none !important; }
}
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .hide-md { display: none !important; }
}
@media screen and (min-width: 1024px) {
    .hide-lg { display: none !important; }
}
@media screen and (max-width: 1023px) {
    .show-lg-only { display: none !important; }
}
@media screen and (min-width: 1024px) {
    .show-mobile-only { display: none !important; }
}

/* Container fluido em mobile */
@media screen and (max-width: 768px) {
    .container,
    .container-narrow,
    .container-medium {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100% !important;
    }
}


/* ==========================================================================
   4. SCROLLBAR MOBILE (mais fina, menos intrusiva)
   ========================================================================== */

@media screen and (max-width: 1024px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
}


/* ==========================================================================
   5. OVERLAY PARA SIDEBAR/DRAWER MOBILE
   ========================================================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}


/* ==========================================================================
   6. ANIMATIONS — REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ==========================================================================
   7. SAFE AREA INSETS (iPhone X+ notch)
   ========================================================================== */

@supports (padding: env(safe-area-inset-bottom)) {
    @media screen and (max-width: 1024px) {
        body {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}


/* ==========================================================================
   8. PRINT RESET
   ========================================================================== */

@media print {
    .sidebar,
    .sidebar-overlay,
    .menu-toggle,
    .sidebar-close,
    .bottom-nav,
    .btn-logout,
    .user-profile {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}
