/* ============================================================================
 * ECOGESTOR - Estilos Principais
 * ============================================================================ */

/* Sidebar responsivo */
.sidebar {
    width: 280px;
    min-height: 100vh;
    transition: transform 0.3s ease-in-out;
}

/* Mobile: sidebar oculta por padrão */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-height: 100vh;
        min-height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4rem !important;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Overlay escuro quando sidebar aberta */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    /* Header mobile com logo e menu */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 64px;
        background-color: #ffffff;
        border-bottom: 1px solid #dee2e6;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1030;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    /* Botão hamburguer no header mobile */
    .mobile-menu-btn {
        position: absolute;
        left: 0.6rem;
        width: 44px;
        height: 44px;
        border-radius: 8px;
        box-shadow: none;
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        color: #212529;
    }

    .mobile-menu-btn:hover {
        background-color: #e9ecef;
        color: #212529;
    }

    .mobile-menu-btn:focus {
        color: #212529;
    }

    /* Logo centralizada no header mobile */
    .mobile-logo {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-logo img {
        height: 36px;
        width: auto;
    }

    /* Ajusta sidebar para forçar display block em mobile */
    .sidebar {
        display: block !important;
    }

    /* Remove mt-auto da sidebar no mobile */
    .sidebar>div:last-child {
        margin-top: 2rem !important;
        margin-bottom: 0 !important;
    }

    /* Ajusta conteúdo principal para não ficar atrás do header fixo */
    .container-fluid>.row {
        padding-top: 64px;
    }

    /* Ajustes de tabelas em mobile */
    .table-responsive {
        border-radius: 0.375rem;
        margin: 0 -0.5rem;
    }

    .table> :not(caption)>*>* {
        padding: 0.75rem 0.5rem;
    }
}

/* Desktop: sidebar sempre visível */
@media (min-width: 992px) {
    .mobile-menu-btn {
        display: none !important;
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

/* Ajustes de padding mobile */
@media (max-width: 991.98px) {
    .main-content {
        padding-top: 4rem !important;
    }
}

/* Cards responsivos */
.card {
    border-radius: 0.75rem;
}

@media (max-width: 767.98px) {
    .card-body {
        padding: 1rem;
    }
}

/* Layout centralizado para páginas vazias/login */
.centered-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.centered-content {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
}

/* Logo centralizada */
.logo-centered {
    display: block;
    margin: 0 auto 2rem;
    max-height: 64px;
}

/* Ajustes para conteúdo principal vazio */
.main-content-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    text-align: center;
}

.main-content-empty .logo-display {
    max-width: 200px;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Animações suaves */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
