/**
 * PROTWINS - Sistema de Responsividade Mobile
 * Adiciona suporte completo para dispositivos móveis em todo o sistema
 */

/* ========== MENU MOBILE FLUTUANTE ========== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.4);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(30, 58, 138, 0.6);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Overlay escuro de fundo */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Menu lateral deslizante */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background: white;
    z-index: 9999;
    padding: 0;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    right: 0;
}

/* Cabeçalho do menu */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    border-bottom: 3px solid #1d4ed8;
}

.mobile-menu-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Seções do menu */
.mobile-menu-section {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

/* Botões do menu mobile */
.mobile-menu-btn-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-btn-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: #1e293b;
    font-weight: 500;
}

.mobile-menu-btn-item:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: translateX(5px);
}

.mobile-menu-btn-item i {
    width: 24px;
    font-size: 18px;
    color: #3b82f6;
}

/* Badge de contador */
.mobile-menu-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

/* ========== RESPONSIVIDADE GERAL ========== */
@media (max-width: 768px) {
    /* Mostrar botão mobile */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Ajustes gerais de body */
    body {
        padding-bottom: 100px; /* Espaço para botão flutuante */
    }

    /* Header responsivo */
    header {
        padding: 10px 15px !important;
        flex-wrap: wrap;
    }

    header h1 {
        font-size: 16px !important;
        padding: 8px 12px !important;
    }

    /* Esconder navegação desktop */
    header nav,
    header .desktop-nav,
    header .header-actions {
        display: none !important;
    }

    /* Containers */
    .container,
    .main-container {
        padding: 15px !important;
        max-width: 100% !important;
    }

    /* Cards e panels */
    .card,
    .panel,
    .box {
        padding: 15px !important;
        border-radius: 8px !important;
        margin-bottom: 15px !important;
    }

    /* Títulos */
    h1 { font-size: 24px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }
    h4 { font-size: 16px !important; }
    h5 { font-size: 14px !important; }
    h6 { font-size: 12px !important; }

    /* Botões */
    .btn,
    button:not(.mobile-menu-close):not(.mobile-menu-btn) {
        padding: 12px 20px !important;
        font-size: 14px !important;
        width: 100%;
        margin-bottom: 8px;
    }

    .btn-sm {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    /* Formulários */
    input,
    select,
    textarea {
        font-size: 16px !important; /* Previne zoom no iOS */
        padding: 12px !important;
        width: 100% !important;
    }

    .form-group {
        margin-bottom: 15px !important;
    }

    label {
        font-size: 14px !important;
        margin-bottom: 6px !important;
        display: block;
    }

    /* Tabelas */
    table {
        font-size: 12px !important;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    /* Modais */
    .modal-content,
    .modal-body {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .modal-header {
        padding: 15px 20px !important;
    }

    .modal-title {
        font-size: 18px !important;
    }

    /* Grids */
    .grid,
    [class*="grid-"],
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Flex containers */
    .flex-row {
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* Tabs */
    .tabs,
    .tab-nav {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .tab {
        font-size: 13px !important;
        padding: 10px 15px !important;
    }

    /* Imagens */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Tooltips e popovers - desabilitar em mobile */
    [data-tooltip],
    .tooltip {
        pointer-events: none;
    }

    /* Sidebar - transformar em overlay */
    .sidebar,
    aside {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100%;
        width: 85%;
        max-width: 350px;
        z-index: 9000;
        transition: left 0.3s ease;
        background: white;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    }

    .sidebar.active,
    aside.active {
        left: 0;
    }

    /* Floating action buttons - ajustar posição */
    .fab,
    .floating-btn {
        bottom: 90px !important; /* Acima do botão do menu */
    }

    /* Scrollbar mais visível em mobile */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(59, 130, 246, 0.5);
        border-radius: 4px;
    }

    /* Toast notifications */
    .toast,
    .notification {
        width: calc(100% - 30px) !important;
        left: 15px !important;
        right: 15px !important;
    }

    /* Badges */
    .badge {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    /* Status indicators */
    .status-indicator {
        font-size: 12px !important;
    }

    /* Breadcrumbs */
    .breadcrumb {
        font-size: 12px !important;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Action buttons group */
    .action-buttons,
    .btn-group {
        flex-direction: column !important;
        width: 100%;
    }

    .action-buttons > *,
    .btn-group > * {
        width: 100% !important;
        margin: 4px 0 !important;
    }

    /* Spinners e loaders */
    .spinner,
    .loader {
        transform: scale(0.8);
    }

    /* Ocultar elementos não essenciais em mobile */
    .desktop-only,
    .hide-mobile {
        display: none !important;
    }

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

    /* Padding e margens reduzidas */
    .p-4, .p-5, .p-6 { padding: 15px !important; }
    .m-4, .m-5, .m-6 { margin: 15px !important; }
    .gap-4, .gap-5 { gap: 10px !important; }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ========== MODO PAISAGEM (LANDSCAPE) ========== */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-menu {
        width: 50%;
        max-width: 350px;
    }

    .modal-content {
        max-height: 80vh !important;
    }
}

/* ========== TABLETS ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 20px !important;
    }

    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== TOUCH IMPROVEMENTS ========== */
@media (hover: none) and (pointer: coarse) {
    /* Melhorar áreas de toque */
    button,
    a,
    input[type="checkbox"],
    input[type="radio"],
    .clickable {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    /* Remover hover effects em touch devices */
    *:hover {
        transition: none !important;
    }
}

/* ========== PRINT ========== */
@media print {
    .mobile-menu-btn,
    .mobile-menu,
    .mobile-menu-overlay,
    .no-print {
        display: none !important;
    }
}
