/**
 * 📱 MOBILE RESPONSIVE - Site Público (Frontend)
 * Correções específicas para páginas institucionais e colunista
 * Criado: 03/02/2026
 */

/* ==================================================================
   📄 PÁGINAS INSTITUCIONAIS - Layout Principal
   ================================================================== */
@media (max-width: 768px) {
    /* Container principal mais largo em mobile */
    .container-custom {
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .max-w-5xl,
    .max-w-4xl,
    .max-w-3xl,
    .max-w-2xl {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* Grid de 3 colunas → 1 coluna */
    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    /* Coluna principal (2/3) ocupa 100% */
    .md\:col-span-2 {
        grid-column: span 1 / span 1 !important;
    }
    
    /* Reduzir espaçamento */
    .gap-8 {
        gap: 1.5rem !important;
    }
    
    /* Padding dos cards */
    .p-8 {
        padding: 1.25rem !important;
    }
    
    .p-10 {
        padding: 1.5rem !important;
    }
    
    .p-6 {
        padding: 1rem !important;
    }
    
    /* Títulos responsivos */
    .text-4xl {
        font-size: 1.875rem !important; /* 30px */
        line-height: 2.25rem !important;
    }
    
    .text-3xl {
        font-size: 1.5rem !important; /* 24px */
        line-height: 2rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.75rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.75rem !important;
    }
}

/* ==================================================================
   👤 PÁGINA DO COLUNISTA - Header e Perfil
   ================================================================== */
@media (max-width: 768px) {
    /* Header do colunista */
    .flex.flex-col.md\:flex-row {
        flex-direction: column !important;
        text-align: center !important;
    }
    
    /* Foto do colunista centralizada */
    .flex.flex-col.md\:flex-row img {
        margin: 0 auto 1.5rem !important;
        width: 120px !important;
        height: 120px !important;
    }
    
    /* Texto centralizado */
    .flex.flex-col.md\:flex-row .flex-1 {
        text-align: center !important;
    }
    
    /* Redes sociais centralizadas */
    .flex.gap-3.justify-center.md\:justify-start {
        justify-content: center !important;
    }
    
    /* Grid de artigos */
    .grid.lg\:grid-cols-12 {
        grid-template-columns: 1fr !important;
    }
    
    .lg\:col-span-9,
    .lg\:col-span-3 {
        grid-column: span 1 / span 1 !important;
    }
    
    /* Cards de artigos */
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* ==================================================================
   📝 QUEM SOMOS / ANUNCIE CONOSCO / POLÍTICA
   ================================================================== */
@media (max-width: 768px) {
    /* Prose (texto formatado) responsivo */
    .prose {
        max-width: 100% !important;
        font-size: 0.9375rem !important; /* 15px */
    }
    
    .prose p {
        margin-bottom: 1rem !important;
    }
    
    .prose h2 {
        font-size: 1.5rem !important;
        margin-top: 1.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .prose h3 {
        font-size: 1.25rem !important;
        margin-top: 1.25rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .prose ul,
    .prose ol {
        padding-left: 1.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .prose li {
        margin-bottom: 0.5rem !important;
    }
}

/* ==================================================================
   📞 BOTÕES DE CONTATO E CTAs
   ================================================================== */
@media (max-width: 640px) {
    /* Botão WhatsApp responsivo */
    .bg-gradient-to-r.from-green-500 {
        padding: 1rem !important;
    }
    
    .bg-gradient-to-r.from-green-500 .flex {
        flex-direction: row !important;
        gap: 0.75rem !important;
    }
    
    .bg-gradient-to-r.from-green-500 .w-14 {
        width: 3rem !important;
        height: 3rem !important;
    }
    
    /* Cards de contato */
    .bg-white.rounded-xl.shadow-sm {
        padding: 1rem !important;
    }
    
    .w-10.h-10 {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
}

/* ==================================================================
   🎨 FORMULÁRIO DE CONTATO
   ================================================================== */
@media (max-width: 640px) {
    /* Formulário empilhado */
    form .grid.grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* Inputs maiores para mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        font-size: 16px !important; /* Evita zoom no iOS */
        padding: 0.75rem !important;
    }
    
    /* Botão de envio full-width */
    button[type="submit"] {
        width: 100% !important;
        padding: 1rem !important;
    }
}

/* ==================================================================
   🔗 SIDEBAR E BANNERS
   ================================================================== */
@media (max-width: 1024px) {
    /* Esconder sidebar em telas menores */
    .space-y-6 {
        display: none !important;
    }
    
    /* Conteúdo principal ocupa 100% */
    .lg\:col-span-9 {
        grid-column: span 1 / span 1 !important;
    }
}

/* ==================================================================
   📰 CARDS DE NOTÍCIAS DO COLUNISTA
   ================================================================== */
@media (max-width: 640px) {
    /* Cards empilhados */
    .grid.grid-cols-1.md\:grid-cols-2.gap-6 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Imagem dos cards menor */
    .h-48 {
        height: 12rem !important; /* 192px */
    }
    
    /* Padding dos cards */
    .bg-white.rounded-xl.overflow-hidden .p-4 {
        padding: 0.75rem !important;
    }
    
    /* Título do card menor */
    .font-bold.text-gray-900 {
        font-size: 1rem !important;
        line-height: 1.5rem !important;
    }
}

/* ==================================================================
   🔍 BREADCRUMBS E NAVEGAÇÃO
   ================================================================== */
@media (max-width: 640px) {
    /* Breadcrumbs menores */
    .breadcrumbs {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
    }
    
    /* Esconder separadores em mobile muito pequeno */
    .breadcrumbs span:nth-child(n+5) {
        display: none !important;
    }
}

/* ==================================================================
   📑 PAGINAÇÃO RESPONSIVA
   ================================================================== */
@media (max-width: 640px) {
    .pagination {
        gap: 0.25rem !important;
        justify-content: center !important;
    }
    
    .pagination a,
    .pagination span {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Esconder números intermediários */
    .pagination > *:not(.active):not(:first-child):not(:last-child):not(.prev):not(.next) {
        display: none !important;
    }
}

/* ==================================================================
   🎬 VÍDEOS E MÍDIA RESPONSIVA
   ================================================================== */
@media (max-width: 768px) {
    /* iframes (YouTube, etc) */
    iframe {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
    }
    
    /* Imagens responsivas */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Prevent overflow */
    * {
        max-width: 100%;
    }
}

/* ==================================================================
   🚨 ALERTAS E MENSAGENS
   ================================================================== */
@media (max-width: 640px) {
    .alert,
    .message,
    .notification {
        margin: 0.5rem !important;
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
        border-radius: 0.5rem !important;
    }
    
    .alert svg,
    .message svg {
        width: 16px !important;
        height: 16px !important;
    }
}

/* ==================================================================
   📱 MOBILE SMALL (360px e menor)
   ================================================================== */
@media (max-width: 360px) {
    /* Padding mínimo */
    .container-custom {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .p-8,
    .p-6,
    .p-4 {
        padding: 0.75rem !important;
    }
    
    /* Textos menores */
    .text-4xl {
        font-size: 1.5rem !important;
    }
    
    .text-3xl {
        font-size: 1.25rem !important;
    }
    
    .text-2xl {
        font-size: 1.125rem !important;
    }
    
    /* Botões menores */
    button,
    .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Ícones menores */
    svg {
        width: 16px !important;
        height: 16px !important;
    }
}

/* ==================================================================
   🖱️ TOUCH IMPROVEMENTS
   ================================================================== */
@media (hover: none) and (pointer: coarse) {
    /* Área de toque mínima (44x44px - guidelines Apple/Google) */
    a,
    button,
    input[type="checkbox"],
    input[type="radio"],
    .clickable {
        min-height: 44px !important;
        min-width: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Remover hover effects */
    .hover\:shadow-lg:hover,
    .hover\:scale-105:hover,
    .hover\:underline:hover {
        transform: none !important;
        box-shadow: none !important;
        text-decoration: none !important;
    }
    
    /* Feedback tátil */
    button:active,
    a:active {
        opacity: 0.7 !important;
        transform: scale(0.98) !important;
    }
}

/* ==================================================================
   🌐 LANDSCAPE MODE (Mobile horizontal)
   ================================================================== */
@media (max-width: 896px) and (orientation: landscape) {
    /* Reduzir altura de headers */
    header,
    .page-header {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* Cards mais compactos */
    .card {
        padding: 0.75rem !important;
    }
    
    /* Imagens menores */
    .h-48 {
        height: 8rem !important;
    }
}

/* ==================================================================
   ♿ ACESSIBILIDADE
   ================================================================== */
@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;
    }
}

/* Contraste aumentado para leitura */
@media (prefers-contrast: high) {
    .text-gray-700 {
        color: #1a1a1a !important;
    }
    
    .text-gray-600 {
        color: #2d2d2d !important;
    }
    
    .border-gray-200 {
        border-color: #666 !important;
    }
}

/* ==================================================================
   🔧 FIX ESPECÍFICOS
   ================================================================== */
@media (max-width: 640px) {
    /* Prevenir scroll horizontal */
    body {
        overflow-x: hidden !important;
    }
    
    /* Prevenir zoom em inputs (iOS) */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* Fix para tabelas que transbordam */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Safe area (iPhone X+) */
    body {
        padding-left: env(safe-area-inset-left) !important;
        padding-right: env(safe-area-inset-right) !important;
    }
}
