/* Override global theme spacing */
.site-content {
    padding-top: 10px !important;
    padding-bottom: 20px !important;
    margin-top: 0 !important;
}

.dashboard-container {
    padding: 10px 20px; /* Reduced top padding */
    background-color: #f5f5f5;
}

.dashboard-header {
    margin-bottom: 0px; /* Removed margin to stick to top */
    background: white;
    padding: 10px 15px; 
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Independent Scrolling Wrapper */
#custom-dashboard-wrapper {
    height: calc(100vh - 160px); /* Adjust based on header/footer */
    overflow: hidden;
    position: relative;
    padding-bottom: 0 !important;
}

/* Scrollable Chart Area */
#charts-container {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* Scrollable Sidebar */
.col-custom-20 {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* Custom Scrollbar Styling */
#charts-container::-webkit-scrollbar,
.col-custom-20::-webkit-scrollbar {
    width: 6px;
}

#charts-container::-webkit-scrollbar-track,
.col-custom-20::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 3px;
}

#charts-container::-webkit-scrollbar-thumb,
.col-custom-20::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 3px;
}

#charts-container::-webkit-scrollbar-thumb:hover,
.col-custom-20::-webkit-scrollbar-thumb:hover {
    background: #999; 
}

.dashboard-header h2 {
    margin-top: 5px;
    margin-bottom: 5px;
}

.dashboard-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Softer shadow */
    margin-bottom: 20px;
    background: #fafafa; /* Softer, not pure white */
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.dashboard-card .panel-heading {
    background-color: #e4e4e4; /* Customized header color */
    border-bottom: 1px solid #ddd;
    padding: 8px 15px; /* Compact padding */
}

/* Force override of Bootstrap's H3 size */
.dashboard-card .panel-heading .panel-title,
.dashboard-card .panel-heading h3 {
    font-size: 16px !important; 
    font-weight: bold;
    color: #555;
    margin: 0;
}

.dashboard-card .panel-body {
    padding: 15px;
    height: 350px; /* Altura fija para gráficas */
    position: relative;
}

/* Layout Custom Columns (80/20 split) */
@media (min-width: 992px) {
    #custom-dashboard-wrapper .col-custom-80 {
        width: 80% !important;
        float: left !important;
        position: relative;
        min-height: 1px;
        padding-right: 15px;
        padding-left: 15px;
    }
    #custom-dashboard-wrapper .col-custom-20 {
        width: 20% !important;
        float: left !important;
        position: relative;
        min-height: 1px;
        padding-right: 15px;
        padding-left: 15px;
    }


    /* Helper to force full width */
    #custom-dashboard-wrapper .col-md-12 {
        width: 100% !important;
        float: left !important;
    }
}

/* 
   Dynamic Full-Height Layout Strategy 
   Handled by JavaScript (sidebar.js) due to Bootstrap legacy conflicts.
*/

/* Independent Scrolling Wrapper */
#custom-dashboard-wrapper {
    width: 100%;
    margin-bottom: 0px;
    padding-bottom: 0px;
}

.dashboard-header {
    margin-bottom: 10px;
}

/* Scrollable Chart Area */
#charts-container {
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* Scrollable Sidebar */
.col-custom-20 {
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

.dashboard-content-row {
    flex: 1; /* Takes remaining height */
    min-height: 0; /* Crucial for nested scroll */
    overflow: hidden;
    display: flex; /* Ensure columns behave */
    flex-wrap: wrap; /* Standard bootstrap behavior preserved if needed, but we want 100% height cols */
    margin-left: 0; /* Fix bootstrap row margins */
    margin-right: 0;
}

/* Scrollable Chart Area */
#charts-container {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* Scrollable Sidebar */
.col-custom-20 {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}
/* Independent Scrolling Wrapper with Flexbox */
#custom-dashboard-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px); /* Fixed height relative to viewport */
    overflow: hidden; /* Prevent wrapper scroll */
    padding-bottom: 0 !important;
}

.dashboard-header {
    flex: 0 0 auto; /* Header takes natural height */
    margin-bottom: 10px;
}

.dashboard-content-row {
    flex: 1; /* Takes remaining height */
    min-height: 0; /* Crucial for nested scroll */
    overflow: hidden;
    display: flex; /* Ensure columns behave */
    flex-wrap: nowrap; /* FORCE Side-by-Side always, never wrap below */
}

/* Scrollable Chart Area */
#charts-container {
    flex: 1; /* Automatically fill remaining space */
    min-width: 0; /* Allow shrinking below content size if needed */
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* Scrollable Sidebar */
.col-custom-20 {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
    /* Force width constraints for narrow screens */
    flex: 0 0 auto; /* Don't grow, don't shrink */
    min-width: 250px;
    width: 20%; /* Base width */
}

@media (max-width: 991px) {
    .col-custom-20 {
        width: 250px; /* Fixed width on smaller screens */
    }
}

/* Sidebar Toggle Button (Hamburger) */
#btn-show-sidebar {
    display: inline-block;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4a5c6e; /* Theme Color */
    color: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 0;
    line-height: 40px; /* Restored line-height for vertical centering of icon */
    text-align: center;
    transition: background-color 0.2s, transform 0.2s;
}

#btn-show-sidebar:hover {
    background-color: #3e4d5c;
    transform: scale(1.05);
}

#btn-show-sidebar i {
    font-size: 16px;
    vertical-align: middle;
}

/* Sidebar Styles - High Specificity */
#custom-dashboard-wrapper .sidebar-panel {
    border: none !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
    background: #fff !important;
}

#custom-dashboard-wrapper .sidebar-panel .panel-heading {
    background-color: #4a5c6e !important;
    color: white !important;
    border-color: #4a5c6e !important;
    padding: 10px 15px !important;
}

#custom-dashboard-wrapper .sidebar-panel .panel-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
    color: #f9f9f9 !important;
}

/* Accordion Styles */
#custom-dashboard-wrapper .sidebar-accordion .panel {
    border: none !important;
    box-shadow: none !important;
    margin-top: 0 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid #eee !important;
}

#custom-dashboard-wrapper .sidebar-accordion .panel-heading {
    background-color: #fff !important;
    padding: 6px 10px !important; /* Compact padding */
    transition: background-color 0.2s;
    min-height: 0 !important; /* Ensure no min-height forces size */
}

#custom-dashboard-wrapper .sidebar-accordion .panel-heading:hover {
    background-color: #f9f9f9 !important;
}

#custom-dashboard-wrapper .sidebar-accordion .panel-title a {
    display: block !important;
    font-size: 12px !important; /* Smaller font */
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    padding: 2px 0 !important;
}

#custom-dashboard-wrapper .sidebar-accordion .panel-title a:hover {
    color: #4a5c6e !important;
}

/* Checkbox Styles */
#custom-dashboard-wrapper .indicator-checkbox-wrapper {
    padding: 6px 10px !important;
    border-radius: 4px;
    transition: background-color 0.1s;
    cursor: pointer;
    margin: 0 !important;
}

#custom-dashboard-wrapper .indicator-checkbox-wrapper:hover {
    background-color: #f0f7ff !important;
}

#custom-dashboard-wrapper .indicator-checkbox-wrapper label {
    font-size: 11px !important;
    color: #555 !important;
    margin-bottom: 0 !important;
    cursor: pointer;
    font-weight: normal !important;
    display: block !important;
    line-height: 1.3 !important;
}

#custom-dashboard-wrapper .indicator-checkbox-wrapper input[type="checkbox"] {
    margin-top: 1px !important;
    margin-right: 5px !important;
    vertical-align: top !important;
}

/* Chart Title Override (Smaller) */
#custom-dashboard-wrapper .dashboard-card .panel-heading .panel-title,
#custom-dashboard-wrapper .dashboard-card .panel-heading h3 {
    font-size: 13px !important;
    color: #444 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

@media print {
    .no-print {
        display: none;
    }
    .dashboard-container {
        background-color: white;
        padding: 0;
    }
    .dashboard-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Tabs Font Size Override */
#TabCriterios .nav-tabs > li > a,
#TabCriterios .TabbedPanelsTab a {
    font-size: 16px !important;
    font-weight: 700 !important;
}
