/* Custom CSS for sidebar responsiveness fixes */

/* Base layout */
#app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar styles */
#sidebar {
    width: 300px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

#main {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Main content area - ELIMINACIÓN TOTAL DE ESPACIOS */
#main-content {
    flex: 1;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    width: 100%;
}

/* Page heading optimizations - ELIMINACIÓN TOTAL */
.page-heading {
    margin: 0 !important;
    padding: 0.25rem 0.5rem !important;
}

.page-title {
    margin: 0 !important;
    padding: 0 !important;
}

.page-title .row {
    margin: 0 !important;
}

.page-title h3 {
    margin: 0 !important;
    padding: 0 !important;
}

/* Navbar optimizations - COMPACTO */
.navbar-top {
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
}

/* Section spacing - SIN ESPACIOS */
.section {
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
}

/* Footer positioning */
footer {
    margin-top: auto;
    padding: 0.5rem 1rem;
}

/* Mobile styles */
@media screen and (max-width: 1199px) {
    #app {
        position: relative;
    }
    
    #sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        height: 100vh;
        z-index: 1000;
        background: white;
    }
    
    #sidebar.active {
        left: 0;
    }
    
    #main {
        width: 100%;
        margin-left: 0;
    }
    
    #main-content {
        padding: 0.125rem 0.25rem;
    }
    
    .burger-btn {
        display: flex !important;
        cursor: pointer;
        z-index: 1001;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        padding: 0.5rem;
        margin: 0.25rem;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        pointer-events: auto !important;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .burger-btn:hover {
        background-color: rgba(0, 0, 0, 0.05);
        border-radius: 4px;
    }
    
    .burger-btn:active,
    .burger-btn:focus {
        opacity: 0.7;
        outline: 2px solid rgba(0, 123, 255, 0.5);
        outline-offset: 2px;
    }
    
    .burger-btn i {
        pointer-events: none;
        user-select: none;
        -webkit-user-select: none;
    }
}

/* Desktop styles */
@media screen and (min-width: 1200px) {
    #sidebar {
        position: relative;
        left: 0;
    }
    
    #sidebar.active {
        left: 0;
    }
    
    .burger-btn {
        display: none !important;
    }
}

/* Dark theme support */
html[data-bs-theme="dark"] #sidebar {
    background: var(--bs-dark);
}

/* Sidebar wrapper */
.sidebar-wrapper {
    height: 100vh;
    overflow-y: auto;
}

/* Theme toggle positioning fix */
.theme-toggle {
    flex-shrink: 0;
}

/* Remove unnecessary margins and padding */
.container-fluid {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

/* Optimize card spacing */
.card {
    margin-bottom: 0.75rem;
}

/* Optimize table spacing */
.table-responsive {
    margin-bottom: 0;
}

/* Breadcrumb optimization */
.breadcrumb-header {
    margin-bottom: 0;
}

/* Row optimization */
.row {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
}

.row > * {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

/* Remove default body padding if any */
body {
    margin: 0;
    padding: 0;
}

/* Ensure full width utilization */
.col, .col-12, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-lg-8, .col-lg-9, .col-lg-12 {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

/* Additional space optimization */
header {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Remove gaps in main layout */
#main.layout-navbar {
    padding: 0;
    margin: 0;
}

/* Minimize all unnecessary spacing */
.navbar-fixed {
    margin-bottom: 0;
}

/* Optimize dashboard cards */
.dashboard-card {
    margin-bottom: 0.5rem;
}

/* Remove default Bootstrap spacing */
.mb-3 {
    margin-bottom: 0.5rem !important;
}

.mb-4 {
    margin-bottom: 0.75rem !important;
}

/* Compact layout for better space utilization */
.layout-navbar {
    gap: 0;
}

/* OVERRIDE MAZER STYLES AGGRESSIVELY */
#main.layout-navbar.navbar-fixed {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* Force remove all spacing from main content */
#main-content * {
    box-sizing: border-box;
}

/* Override Bootstrap container spacing */
.container, .container-fluid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Force compact header */
header.navbar {
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
}

/* Override any default margins */
* {
    margin: 0;
}

/* Specific overrides for Mazer layout */
.layout-navbar .navbar-top {
    padding: 0.25rem 0.5rem !important;
}

.page-heading .page-title {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Force remove breadcrumb spacing */
.breadcrumb-header {
    margin: 0 !important;
    padding: 0 !important;
}

/* Sidebar collapsible arrow */
.sidebar-collapsible {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-arrow {
    font-size: 1rem;
    margin-left: 0.5rem;
    transition: transform 0.2s;
    display: inline-block;
}
.sidebar-arrow.rotated {
    transform: rotate(90deg);
}
.sidebar-group {
    padding-left: 0;
    margin-bottom: 0.5rem;
    transition: max-height 0.3s, opacity 0.3s;
}
.sidebar-group[style*='none'] {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}
.sidebar-group[style*='block'] {
    max-height: 1000px;
    opacity: 1;
    overflow: visible;
}