/* ===================================
   RESPONSIVE GLOBAL STYLES
   M2E Central - Sistema de Ocorrências
   ================================== */

/* Mobile First Approach */

/* ===================================
   BASE - Mobile (320px+)
   ================================== */

* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
}

/* Container responsivo */
.container {
    width: 100%;
    max-width: 100%;
    padding: 0 15px;
    padding-top: 0.75rem;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .container {
        padding: 0 20px;
        padding-top: 1rem;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 0 30px;
        padding-top: 1.5rem;
        max-width: 1800px;
    }
}

/* ===================================
   HEADER / NAVBAR
   ================================== */

.header {
    padding: 15px !important;
}

.header-container {
    padding: 12px 15px !important;
}

/* Logo M2E responsivo */
.header-logo {
    height: 40px !important;
    width: auto !important;
}

/* Header margin removido - deixar padding-top do container funcionar */

.header-title,
.header h1 {
    font-size: 16px !important;
    line-height: 1.3 !important;
}

.header-subtitle,
.header .subtitle {
    font-size: 11px !important;
    line-height: 1.3 !important;
}

.header-icon {
    width: 40px !important;
    height: 40px !important;
}

/* Header User Info - APENAS para headers (não afeta formulários) */
.header-user-info {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

.header-user-info button,
.header-user-info .badge {
    font-size: 11px !important;
    padding: 6px 10px !important;
    white-space: nowrap !important;
}

#dark-mode-toggle {
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 10px !important;
    font-size: 16px !important;
}

/* Botão voltar */
.back-button {
    font-size: 13px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
}

/* ===================================
   CARDS / GRID
   ================================== */

/* Grid responsivo */
.responsive-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr;
}

.responsive-grid-2 {
    grid-template-columns: 1fr;
}

.responsive-grid-3 {
    grid-template-columns: 1fr;
}

.responsive-grid-4 {
    grid-template-columns: 1fr;
}

/* Cards */
.card {
    padding: 15px !important;
    margin-bottom: 15px;
}

.card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
}

.card-actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
}

.card-actions button {
    width: 100%;
}

/* ===================================
   FORMS
   ================================== */

.form-row {
    flex-direction: column;
    gap: 12px;
}

.form-col {
    width: 100% !important;
    min-width: 100% !important;
}

.form-input,
.form-select,
.form-textarea,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100% !important;
    font-size: 16px !important; /* Previne zoom no iOS */
    padding: 10px 12px !important;
}

/* Campos de data e hora específicos */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    font-size: 14px !important;
    padding: 10px !important;
}

/* Botões em formulários */
.form-buttons {
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.form-buttons button {
    width: 100%;
    padding: 12px 16px !important;
    font-size: 14px !important;
}

/* Cards de formulário (Nova Ocorrência, etc) */
.form-section,
.field-group {
    margin-bottom: 12px !important;
    padding: 12px !important;
}

/* Labels em formulários - APENAS em contextos de formulário */
.form-group > label,
.field-group > label,
form > label {
    font-size: 13px !important;
    margin-bottom: 6px !important;
    display: block;
}

/* Labels de checkboxes e radios - manter inline */
label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}

/* Textareas */
textarea {
    min-height: 80px !important;
    resize: vertical;
}

/* ===================================
   TABELAS
   ================================== */

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px;
    padding: 0 15px;
}

.responsive-table {
    min-width: 100%;
    font-size: 12px !important;
}

.responsive-table th,
.responsive-table td {
    padding: 8px 6px !important;
    white-space: nowrap;
}

/* Tabela empilhada (melhor para mobile) */
@media (max-width: 640px) {
    .stack-table thead {
        display: none;
    }
    
    .stack-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 10px;
        background: white;
    }
    
    .stack-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0 !important;
        border-bottom: 1px solid #f3f4f6;
        white-space: normal !important;
    }
    
    .stack-table tbody td:last-child {
        border-bottom: none;
    }
    
    .stack-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #4b5563;
        margin-right: 10px;
    }
}

/* ===================================
   MODAIS
   ================================== */

.modal {
    padding: 10px !important;
}

.modal-content {
    width: 95% !important;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 10px auto !important;
    padding: 20px !important;
}

.modal-header {
    flex-direction: column;
    gap: 10px;
}

.modal-body {
    padding: 15px 0 !important;
}

.modal-footer {
    flex-direction: column;
    gap: 10px;
}

.modal-footer button {
    width: 100%;
}

/* ===================================
   FILTROS
   ================================== */

.filter-container {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px !important;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.filter-actions button {
    width: 100%;
    padding: 10px 14px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

/* Títulos de filtros */
.filter-container h3,
.filter-container .text-lg {
    font-size: 15px !important;
    margin-bottom: 10px;
}

/* ===================================
   ESTATÍSTICAS / STATS
   ================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    padding: 15px !important;
}

.stat-value {
    font-size: 24px !important;
}

.stat-label {
    font-size: 11px !important;
}

/* ===================================
   MENU PRINCIPAL
   ================================== */

.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.menu-card,
.card {
    padding: 16px !important;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.menu-card .icon,
.card .icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.menu-card h2,
.card h2 {
    font-size: 16px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.menu-card p,
.card p {
    font-size: 12px;
    line-height: 1.4;
}

/* ===================================
   LOGIN
   ================================== */

.login-container {
    padding: 15px;
    min-height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 100%;
    padding: 25px 20px !important;
}

.login-logo {
    height: 50px !important;
}

.login-title {
    font-size: 22px !important;
}

/* ===================================
   PAGINAÇÃO
   ================================== */

.pagination {
    flex-direction: column;
    gap: 10px;
    align-items: stretch !important;
}

.pagination-info {
    text-align: center;
    font-size: 13px;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.pagination-buttons button {
    flex: 1;
    font-size: 13px;
    padding: 8px 12px !important;
}

/* ===================================
   BADGES / CHIPS
   ================================== */

.badge {
    padding: 4px 8px !important;
    font-size: 11px !important;
}

/* ===================================
   BOTÕES
   ================================== */

.btn {
    padding: 10px 16px !important;
    font-size: 14px !important;
    white-space: nowrap;
}

.btn-group {
    flex-direction: column;
    gap: 8px;
}

.btn-group button {
    width: 100%;
}

/* Botões com ícones */
.btn i {
    font-size: 14px;
}

/* ===================================
   IMAGENS
   ================================== */

.responsive-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.image-preview {
    max-height: 200px;
}

/* ===================================
   TABLET (640px+)
   ================================== */

@media (min-width: 640px) {
    .container {
        padding: 0 20px;
        padding-top: 1.5rem;
    }
    
    /* Header melhorado */
    .header {
        padding: 20px !important;
    }
    
    .header-logo {
        height: 50px !important;
    }
    
    .header-title,
    .header h1 {
        font-size: 20px !important;
    }
    
    .header-subtitle,
    .header .subtitle {
        font-size: 13px !important;
    }
    
    #dark-mode-toggle {
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 12px !important;
    }
    
    /* Cards em grid 2 colunas */
    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .responsive-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .card,
    .menu-card {
        padding: 20px !important;
    }
    
    .card .icon,
    .menu-card .icon {
        font-size: 36px;
    }
    
    .card h2,
    .menu-card h2 {
        font-size: 18px;
    }
    
    .card p,
    .menu-card p {
        font-size: 13px;
    }
    
    /* Card actions em linha */
    .card-header {
        flex-direction: row;
        align-items: center !important;
        gap: 15px;
    }
    
    .card-actions {
        width: auto;
        flex-direction: row;
        gap: 10px;
    }
    
    .card-actions button {
        width: auto;
        padding: 8px 16px !important;
    }
    
    /* Filtros em linha */
    .filter-actions {
        flex-direction: row;
        justify-content: flex-start;
    }
    
    .filter-actions button {
        width: auto;
        flex: 0 1 auto;
    }
    
    /* Paginação em linha */
    .pagination {
        flex-direction: row;
        justify-content: space-between;
        align-items: center !important;
    }
    
    .pagination-info {
        text-align: left;
        font-size: 14px;
    }
    
    .pagination-buttons button {
        padding: 10px 16px !important;
        font-size: 14px;
    }
    
    /* Formulários mais compactos */
    .form-buttons {
        flex-direction: row;
        justify-content: flex-end;
        gap: 12px;
    }
    
    .form-buttons button {
        width: auto;
        min-width: 120px;
    }
}

/* ===================================
   DESKTOP PEQUENO (768px+)
   ================================== */

@media (min-width: 768px) {
    .container {
        padding: 0 30px;
        padding-top: 2rem;
        max-width: 1600px;
    }
    
    /* Header desktop */
    .header {
        padding: 25px !important;
    }
    
    .header-logo {
        height: 60px !important;
    }
    
    .header-title,
    .header h1 {
        font-size: 24px !important;
    }
    
    .header-subtitle,
    .header .subtitle {
        font-size: 14px !important;
    }
    
    /* Menu em 3 colunas */
    .cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .responsive-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .responsive-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .card,
    .menu-card {
        padding: 24px !important;
        min-height: 140px;
    }
    
    .card .icon,
    .menu-card .icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    
    .card h2,
    .menu-card h2 {
        font-size: 19px;
        margin-bottom: 6px;
    }
    
    .card p,
    .menu-card p {
        font-size: 14px;
    }
    
    /* Login desktop */
    .login-card {
        max-width: 450px;
        padding: 40px !important;
    }
    
    /* Modal desktop */
    .modal-content {
        width: 80%;
        max-width: 600px;
        padding: 30px !important;
    }
    
    /* Formulários desktop */
    .form-buttons {
        flex-direction: row;
        justify-content: flex-end;
        gap: 15px;
    }
    
    .form-buttons button {
        width: auto;
        min-width: 140px;
        padding: 12px 20px !important;
    }
    
    .modal-footer {
        flex-direction: row;
        justify-content: flex-end;
        gap: 12px;
    }
    
    .modal-footer button {
        width: auto;
        min-width: 120px;
    }
    
    /* Filtros em grid 2 colunas */
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .filter-container {
        padding: 20px !important;
    }
    
    /* Formulários em 2 colunas quando aplicável */
    .form-row-2col {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* ===================================
   DESKTOP (1024px+)
   ================================== */

@media (min-width: 1024px) {
    .container {
        padding: 0 40px;
        padding-top: 2rem;
    }
    
    /* Menu em 4 colunas */
    .cards {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
    
    .responsive-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .responsive-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
    
    /* Filtros em 4 colunas */
    .filter-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    
    /* Header ainda maior */
    .header-title,
    .header h1 {
        font-size: 26px !important;
    }
    
    .header-subtitle,
    .header .subtitle {
        font-size: 15px !important;
    }
    
    /* Tabelas maiores */
    .responsive-table {
        font-size: 14px !important;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 12px 16px !important;
    }
    
    /* Formulários com mais espaço */
    .form-row-3col {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    /* Stats cards maiores */
    .stat-value {
        font-size: 32px !important;
    }
    
    .stat-label {
        font-size: 13px !important;
    }
}

/* ===================================
   DESKTOP GRANDE (1280px+)
   ================================== */

@media (min-width: 1280px) {
    .container {
        max-width: 1400px;
    }
}

/* ===================================
   DESKTOP EXTRA GRANDE (1536px+)
   ================================== */

@media (min-width: 1536px) {
    .container {
        max-width: 1600px;
    }
}

/* ===================================
   UTILITÁRIOS RESPONSIVOS
   ================================== */

/* Esconder em mobile */
.hidden-mobile {
    display: none !important;
}

/* Esconder em tablet */
@media (min-width: 640px) {
    .hidden-tablet {
        display: none !important;
    }
    
    .hidden-mobile {
        display: block !important;
    }
}

/* Esconder em desktop */
@media (min-width: 1024px) {
    .hidden-desktop {
        display: none !important;
    }
}

/* Mostrar apenas em mobile */
.show-mobile {
    display: block !important;
}

@media (min-width: 640px) {
    .show-mobile {
        display: none !important;
    }
}

/* Texto responsivo */
.text-mobile-sm {
    font-size: 12px !important;
}

.text-mobile-base {
    font-size: 14px !important;
}

@media (min-width: 640px) {
    .text-mobile-sm {
        font-size: 14px !important;
    }
    
    .text-mobile-base {
        font-size: 16px !important;
    }
}

/* Padding responsivo */
.p-mobile {
    padding: 15px !important;
}

@media (min-width: 640px) {
    .p-mobile {
        padding: 20px !important;
    }
}

@media (min-width: 768px) {
    .p-mobile {
        padding: 25px !important;
    }
}

/* Margin responsivo */
.m-mobile {
    margin: 15px !important;
}

@media (min-width: 640px) {
    .m-mobile {
        margin: 20px !important;
    }
}

@media (min-width: 768px) {
    .m-mobile {
        margin: 25px !important;
    }
}

/* ===================================
   ACESSIBILIDADE
   ================================== */

/* Aumentar área de toque em mobile - CORRIGIDO para não quebrar checkboxes */
@media (max-width: 640px) {
    button,
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Checkboxes e radios com tamanho fixo e área clicável controlada */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        flex-shrink: 0;
        cursor: pointer;
    }
}

/* Focus visível */
*:focus {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

/* ===================================
   PERFORMANCE
   ================================== */

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Otimizar animações */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   PRINT
   ================================== */

@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}

/* ===================================
   MELHORIAS ESPECÍFICAS MOBILE
   ================================== */

/* Telas muito pequenas (até 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
        padding-top: 0.5rem;
    }
    
    .header {
        padding: 10px !important;
    }
    
    .header-logo {
        height: 35px !important;
    }
    
    .header-title,
    .header h1 {
        font-size: 14px !important;
    }
    
    .header-subtitle,
    .header .subtitle {
        font-size: 10px !important;
    }
    
    #user-info button,
    #user-info .badge {
        font-size: 10px !important;
        padding: 5px 8px !important;
    }
    
    #dark-mode-toggle {
        min-width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
    
    .card,
    .menu-card {
        padding: 12px !important;
        min-height: 90px;
    }
    
    .card .icon,
    .menu-card .icon {
        font-size: 24px;
    }
    
    .card h2,
    .menu-card h2 {
        font-size: 14px;
    }
    
    .card p,
    .menu-card p {
        font-size: 11px;
    }
    
    .btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* Landscape mobile (altura pequena) */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding-top: 0.5rem !important;
    }
    
    .header {
        padding: 12px !important;
    }
    
    .card,
    .menu-card {
        min-height: 80px !important;
        padding: 12px !important;
    }
    
    .modal-content {
        max-height: 85vh !important;
    }
}

/* ===================================
   DARK MODE RESPONSIVO
   ================================== */

/* Dark mode toggle em mobile */
@media (max-width: 640px) {
    body.dark-mode #dark-mode-toggle {
        background: rgba(255, 255, 255, 0.15) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
    }
    
    body.dark-mode #dark-mode-toggle:hover {
        background: rgba(255, 255, 255, 0.2) !important;
    }
}

/* ===================================
   MELHORIAS DE OVERFLOW E SCROLL
   ================================== */

/* Prevenir overflow horizontal em todos os elementos */
* {
    max-width: 100%;
}

/* Containers específicos com scroll suave */
.overflow-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Tabelas sempre com scroll horizontal em mobile */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    table {
        min-width: 600px;
    }
}

/* ===================================
   AJUSTES ESPECÍFICOS DE MÓDULOS
   ================================== */

/* Nova Ocorrência - Cards de seção */
@media (max-width: 640px) {
    .bg-purple-50,
    .bg-blue-50,
    .bg-yellow-50,
    .bg-green-50,
    .bg-red-50,
    .bg-orange-50,
    .bg-teal-50,
    .bg-cyan-50,
    .bg-indigo-50 {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }
    
    /* Drop zone de imagem */
    .drop-zone {
        padding: 20px 15px !important;
        font-size: 13px !important;
    }
    
    .drop-zone i {
        font-size: 32px !important;
    }
}

/* Histórico / Relatório - Controles */
@media (max-width: 640px) {
    .pagination-buttons {
        flex-wrap: wrap;
    }
    
    .pagination-buttons button {
        min-width: 80px;
        flex: 1 1 auto;
    }
}

/* Configurações - Abas */
@media (max-width: 640px) {
    .aba-btn {
        font-size: 12px !important;
        padding: 10px 12px !important;
    }
}

/* Usuários - Tabela */
@media (max-width: 768px) {
    .usuarios-container {
        padding: 12px !important;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .toolbar button {
        width: 100%;
    }
}

/* Login - Mobile otimizado */
@media (max-width: 640px) {
    .login-container {
        padding: 10px !important;
    }
    
    .login-box {
        padding: 25px 20px !important;
    }
    
    .login-header img {
        height: 60px !important;
    }
    
    .login-header h1 {
        font-size: 22px !important;
    }
    
    .login-header p {
        font-size: 13px !important;
    }
}

/* ===================================
   MELHORIAS DE ACESSIBILIDADE MOBILE
   ================================== */

/* Aumentar área de toque - WCAG 2.1 Level AAA */
@media (max-width: 640px) {
    button:not(.btn-sm),
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 48px !important;
        min-width: 48px !important;
        padding: 12px 16px !important;
    }
    
    /* Links clicáveis */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Checkboxes e radios com tamanho fixo - NÃO aumentar área */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        flex-shrink: 0;
        cursor: pointer;
    }
}

/* ===================================
   CORREÇÕES DE BUGS VISUAIS
   ================================== */

/* Prevenir quebra de layout */
img {
    max-width: 100%;
    height: auto;
}

/* Prevenir zoom em inputs iOS */
@media (max-width: 640px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Correção de espaçamento em cards */
.card > *:last-child,
.menu-card > *:last-child {
    margin-bottom: 0 !important;
}

/* Correção de overflow em badges */
.badge {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===================================
   SAFE AREA (NOTCH) - iOS / Android
   ================================== */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .header,
    .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

/* ===================================
   OTIMIZAÇÕES DE PERFORMANCE
   ================================== */

/* Lazy loading de imagens */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Reduzir animações em mobile para performance */
@media (max-width: 640px) {
    * {
        transition-duration: 0.2s !important;
    }
}

/* ===================================
   CORREÇÕES PARA CARDS DE CONTATOS E AÇÕES
   ================================== */

/* Cards de contatos e ações - checkboxes devem ocupar largura total */
.contatos-container label,
.acoes-container label,
[id*="contatos"] label,
[id*="acoes"] label {
    display: flex !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 12px !important;
}

/* Checkboxes dentro desses cards */
.contatos-container input[type="checkbox"],
.acoes-container input[type="checkbox"],
[id*="contatos"] input[type="checkbox"],
[id*="acoes"] input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ===================================
   CORREÇÕES PARA MODALS
   ================================== */

/* Modal - garantir largura consistente */
.modal {
    width: 100%;
}

.modal-content {
    width: 100% !important;
    max-width: 600px !important;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0 !important;
    overflow: hidden;
}

/* Modal header - mesma largura que o corpo (SEM padding lateral extra) */
.modal-header {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 20px 24px !important;
    margin: 0 !important;
}

/* Modal body e form - adicionar padding interno */
.modal-body,
.modal-content form {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 24px !important;
}

/* Modal footer */
.modal-footer,
.modal-actions {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 0 24px 24px 24px !important;
}
