body, html {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-color: #f4f7fa;
    color: #333;
    height: 100%;
}

.app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #2c3e50; /* Dark blue/grey */
    color: #ecf0f1; /* Light grey/white text */
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease; /* For collapsible sidebar animation - JS needed for actual collapse */
}

/* Main content padding adjustment if sidebar is collapsible (example) */
/* .main-content-collapsed { margin-left: 80px; } */

.sidebar-header h2 {
    margin-top: 0;
    text-align: center;
    color: #fff;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #ecf0f1;
    border-radius: 4px;
    margin-bottom: 5px;
}

.sidebar-nav li a .nav-icon { /* Placeholder for icons */
    margin-right: 8px;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background-color: #3498db; /* Blue for active/hover */
    color: #fff;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Allow content to scroll */
}

.header-bar {
    background-color: #fff;
    padding: 15px 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.header-title h1 {
    margin: 0;
    font-size: 1.5em;
    color: #2c3e50;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between control groups */
}

.header-controls .date-range-selector input[type="date"] {
    padding: 6px; /* Slightly more padding */
    margin-left: 3px;
}
.header-controls .date-range-selector span {
    margin: 0 3px;
}

.date-range-selector label {
    margin-right: 5px;
    font-size: 0.9em;
}
.date-range-selector select,
.date-range-selector input[type="date"] {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}
.date-range-selector input[type="date"] {
    width: auto; /* Adjust width as needed */
}


.export-button {
    padding: 8px 15px;
    background-color: #27ae60; /* Green */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

/* .export-button:hover {
    background-color: #229954;
} */

.user-profile {
    font-size: 0.9em;
}

.page-content {
    padding: 25px;
    flex-grow: 1; /* Ensure content area takes available space */
    background-color: #f9fbfd; /* Slightly off-white for content background */
    display: none; /* Hide all by default */
}
.page-content.active-page { 
    display: block; /* Show only active page */
}


/* Basic styling for placeholders - can be removed later */
.page-content p {
    font-size: 1.2em;
    color: #7f8c8d;
}

/* Hiding non-active pages by default */
/* .page-content:not(.active-page) {
    display: none;
} */

/* Dashboard Specific Styles */
.kpi-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Space between KPI cards */
    margin-bottom: 30px;
}

.kpi-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-grow: 1; /* Allow cards to grow and fill space */
    min-width: 200px; /* Minimum width for each card */
    border-left: 5px solid #3498db; /* Accent color */
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.kpi-card h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #555;
}

.kpi-value {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
    color: #2c3e50;
}

.kpi-trend {
    font-size: 0.8em;
    color: #7f8c8d;
}

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive grid */
    gap: 20px;
}

.widget {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}
.widget:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.widget-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-header h5 {
    margin: 0;
    font-size: 1em;
    color: #2c3e50;
}

.widget-export-btn {
    padding: 5px 10px;
    font-size: 0.8em;
    background-color: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    /* cursor: pointer; */
}

/* .widget-export-btn:hover {
    background-color: #e0e6e8;
} */

.widget-content {
    padding: 15px;
    flex-grow: 1; /* Ensure content area takes available space within widget */
}

.widget-content p { /* Styling for placeholder text */
    color: #7f8c8d;
    text-align: center;
    padding: 20px 0;
}

/* Teams & Members Page Specific Styles */
.page-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.page-header h2 {
    margin: 0;
    color: #2c3e50;
}

.controls-bar {
    display: flex;
    gap: 30px; /* More space between selectors */
    margin-bottom: 25px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.team-selector label,
.member-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
}

.team-selector select,
.member-selector select {
    width: 250px; /* Wider select boxes */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
}

.teams-members-content h3 {
    color: #3498db;
    margin-top: 20px;
    margin-bottom: 15px;
}

.teams-members-content .kpi-container { /* Reuse dashboard KPI styles but allow specific overrides if needed */
    margin-top: 10px;
}

.table-placeholder {
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0; /* More visible border */
    padding: 20px;
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 20px;
    border-radius: 4px;
    min-height: 100px; /* Ensure it has some height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-placeholder p {
    margin:0;
    font-size: 1em;
    color: #666;
}

.prompt-message {
    text-align: center;
    padding: 40px;
    background-color: #f0f4f8;
    border-radius: 8px;
    margin-top: 20px;
}
.prompt-message p {
    font-size: 1.1em;
    color: #507090;
}

/* Issue Explorer Page Specific Styles */
.issue-explorer-layout {
    display: flex;
    gap: 20px;
    height: calc(100% - 60px); /* Adjust based on page-header height */
}

.filter-panel, .de-left-panel {
    border-right: 1px solid #e0e0e0;
}

.filter-panel {
    width: 300px; /* Fixed width for the filter panel */
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-y: auto; /* Allow scrolling if filters exceed height */
    height: 100%;
    box-sizing: border-box;
}

.filter-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group h5 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.95em;
    color: #34495e;
}

.filter-item {
    margin-bottom: 12px;
}

.filter-item label {
    display: block;
    font-size: 0.85em;
    margin-bottom: 4px;
    color: #555;
}

.filter-item select,
.filter-item input[type="date"],
.filter-item input[type="text"] /* If any text inputs are added */ {
    width: calc(100% - 16px); /* Full width minus padding */
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.9em;
}
.filter-item input[type="date"] {
    width: calc(50% - 24px); /* For date ranges next to each other */
}


.filter-item input[type="checkbox"] {
    margin-right: 5px;
}

.apply-filters-btn {
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    /* cursor: pointer; */
    font-size: 1em;
}

/* .apply-filters-btn:hover {
    background-color: #2980b9;
} */

.results-panel, .report-display-panel, .de-results-panel {
    background-color: #ffffff; /* Clear white for result areas */
}

.results-panel {
    flex-grow: 1; /* Takes remaining space */
    /* background-color: #fff; */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-y: auto; /* Allow scrolling for results */
    height: 100%;
    box-sizing: border-box;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.results-header h4 {
    margin: 0;
    color: #2c3e50;
}

.view-mode-toggle button {
    padding: 5px 10px;
    /* border: 1px solid #bdc3c7; */
    /* background-color: #ecf0f1; */
    color: #2c3e50;
    /* cursor: pointer; */
    border-radius: 4px;
    margin-left: 5px;
    background-color: #f0f0f0;
    border-color: #ccc;
}

.view-mode-toggle button.active,
.view-mode-toggle button:hover:not(.active) {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
}


.results-content .table-placeholder { /* Reusing from Teams page for now */
    margin-top: 10px;
}

/* Reports Section Specific Styles */
.reports-layout {
    display: flex;
    gap: 20px;
    height: calc(100% - 60px); /* Adjust based on page-header height */
}

.report-list-panel {
    width: 280px; /* Fixed width for the report list panel */
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.report-list-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.report-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.report-list li a {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: #34495e;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.report-list li a:hover,
.report-list li a.active-report-link {
    background-color: #eaf2f8; /* Light blue background */
    color: #2980b9;
    font-weight: bold;
}

.custom-report-placeholder {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #ccc;
}
.custom-report-placeholder h5 {
    margin-bottom:5px;
}
.custom-report-placeholder p {
    font-size: 0.85em; color: #777; margin-bottom:10px;
}


.report-display-panel {
    flex-grow: 1;
    padding: 20px;
    /* background-color: #fff; */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.report-content { display: none; } /* Ensure only active report content is shown */
.report-content.active-report-content { display: block; }
#report-placeholder.active-report-content { display:block; }


.report-content h3 {
    color: #3498db;
    margin-top: 0;
    margin-bottom: 20px;
}
.report-content .widget, .report-content .table-placeholder {
    margin-bottom:15px;
}

.export-report-btn {
    padding: 10px 18px;
    background-color: #27ae60; /* Green */
    color: white;
    border: none;
    border-radius: 4px;
    /* cursor: pointer; */
    font-size: 0.95em;
    margin-top:20px;
}

/* .export-report-btn:hover {
    background-color: #229954;
} */

/* Data Explorer Page Specific Styles */
.data-explorer-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px); /* Example: Adjust if header + page-header height changes */
}

.de-left-panel {
    width: 320px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-y: auto;
    height: 100%; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.de-left-panel h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.de-field-list {
    margin-bottom: 15px;
    max-height: 200px; /* Example max height */
    overflow-y: auto; /* Scroll for many fields */
    border: 1px solid #eee;
    padding: 10px;
}
.de-field-list h5, .de-filter-builder h5 {
    margin-top:0; margin-bottom:8px; font-size:0.9em;
}
.de-field-list label {
    display: block;
    font-size: 0.85em;
    margin-bottom: 3px;
}
.de-field-list input[type="checkbox"] {
    margin-right: 5px;
}

.de-filter-builder .filter-condition {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    align-items: center;
}
.de-filter-builder select,
.de-filter-builder input[type="text"] {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85em;
    flex-grow:1; /* Allow input to grow */
}
.de-filter-builder select:nth-of-type(1) { flex-grow: 2; } /* Field select wider */
.de-filter-builder .remove-filter-btn,
.de-filter-builder .add-filter-btn {
    padding: 5px 8px;
    font-size: 0.8em;
    /* cursor: pointer; */
}
.de-filter-builder .add-filter-btn { margin-top:5px; width:100%; }


.de-run-query-btn {
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    /* cursor: pointer; */
    font-size: 1em;
    margin-top: auto; /* Pushes to bottom */
}
/* .de-run-query-btn:hover { background-color: #2980b9; } */


.de-right-panels {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.de-viz-settings-panel {
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Prevent shrinking if content below is large */
    /* height: auto; */ /* Adjust as needed, or remove for natural flow */
}
.de-viz-settings-panel h4 { margin-top:0; margin-bottom:10px; }
.de-viz-settings-panel label { font-size:0.9em; margin-right:5px;}
.de-viz-settings-panel select { padding:5px; font-size:0.9em; margin-right:10px;}
#de-chart-options { margin-top:10px; padding-top:10px; border-top:1px solid #eee; display: none;} /* Chart options hidden by default */
.de-update-viz-btn { padding: 8px 12px; font-size:0.9em; margin-top:10px;}


.de-results-panel {
    flex-grow: 1; /* Takes remaining vertical space */
    padding: 15px;
    /* background-color: #fff; */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-y: auto; /* Scroll for results content */
    display: flex;
    flex-direction: column;
    min-height: 200px; /* Ensure it's visible even if empty */
}
.de-results-panel h4 { margin-top:0; margin-bottom:10px; }
.de-results-content { flex-grow:1; } /* Ensure content area fills space */
.de-results-content .table-placeholder,
.de-results-content .widget-content { /* Reusing styles */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.de-export-results-btn { padding: 8px 12px; font-size:0.9em; margin-top:10px; align-self:flex-start;}


/* General button styling consistency */
button, .button { /* Assuming a generic .button class might be used */
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
button:hover, .button:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* Ensure Data Explorer results views toggle correctly */
#de-table-results.de-results-content { display: block; } /* Default for table */
#de-chart-results.de-results-content { display: none; } /* Default for chart */

/* Ensure Teams/Members views toggle correctly */
#team-view-content.view-content { display: none; }
#member-view-content.view-content { display: none; }
#teams-members-prompt.prompt-message {display: block; } /* Default prompt */

/* Ensure Issue Explorer views toggle correctly */
#list-view-content.results-content { display: block; } /* Default for list view */
#card-view-content.results-content { display: none; } /* Default for card view */

/* Chart Placeholder Specific Styles */
.widget-content .chart-placeholder {
    /* Ensure the placeholder itself doesn't add extra unwanted space if empty before */
    /* Most styling is already there, this is for minor tweaks */
    padding-bottom: 5px; /* Add a bit of padding at the bottom if labels are close to edge */
}

.chart-placeholder {
    width: 100%;
    height: 180px; /* Default height, can be overridden per widget if needed */
    display: flex;
    align-items: flex-end; /* For bar charts */
    justify-content: space-around;
    padding: 10px;
    box-sizing: border-box;
    position: relative; /* For donut chart hole */
}

.widget-content p.chart-description { /* For text descriptions in chart areas */
    text-align: center;
    font-size: 0.9em;
    color: #555;
    width:100%;
    align-self: center;
}


/* Donut Chart Placeholder */
.donut-chart-placeholder {
    justify-content: center;
    align-items: center;
    flex-direction: column; /* For legend below/above */
    background-image: conic-gradient(#3498db 0% 30%, #f1c40f 30% 75%, #2ecc71 75% 90%, #e74c3c 90% 100%);
    border-radius: 50%;
    width: 150px; /* Fixed size for donut */
    height: 150px;
    margin: auto; /* Center it */
}
.donut-hole {
    position: absolute;
    width: 70px;
    height: 70px;
    background-color: #fff; /* Or widget background */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    color: #555;
}
.donut-chart-placeholder .chart-legend {
    /* Previous 'top: -160px;' might be too much if donut is smaller. */
    /* Let's make it more adaptive or reduce the fixed offset */
    position: static; /* Change from absolute to static to flow naturally */
    margin-top: 15px; /* Add margin after the donut */
    flex-direction: column; /* Stack legend items vertically */
    align-items: flex-start; /* Align items to the start (left) */
}
.chart-legend {
    list-style: none;
    padding: 0;
    /* margin-top: 10px; */ /* Space from donut - handled by .donut-chart-placeholder .chart-legend */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.8em;
    /* position:relative; */ /* To appear above the donut - handled by .donut-chart-placeholder .chart-legend */
    /* top: -160px; */ /* Adjust to clear the donut itself - handled by .donut-chart-placeholder .chart-legend */
    width: 100%;
}
.donut-chart-placeholder .chart-legend li {
    margin: 2px 0; /* Adjust vertical spacing */
    width: 100%; /* Make legend items take full width for better readability */
}
.chart-legend li {
    margin: 0 5px;
    display: flex;
    align-items: center;
}
.legend-color {
    width: 10px;
    height: 10px;
    display: inline-block;
    margin-right: 4px;
    border-radius: 2px;
}

/* Bar Chart Placeholder */
.bar-chart-placeholder {
    gap: 10px; /* Spacing between bar groups */
}
.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    max-width: 50px;
}
.bar {
    width: 100%; /* Full width of its group */
    background-color: #3498db; /* Default bar color */
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease; /* For potential future interaction */
}
.bar-chart-placeholder .bar-label {
    white-space: nowrap; /* Prevent labels from wrapping if too long */
    overflow: hidden;
    text-overflow: ellipsis; /* Show ... if label is too long */
    max-width: 90%; /* Prevent label from being wider than bar group */
}
.bar-label {
    font-size: 0.75em;
    margin-top: 4px;
    color: #333;
    text-align: center;
}

/* Stacked Bar Chart Placeholder */
.stacked-bar-chart-placeholder {
    gap: 10px;
}
.bar-stack {
    display: flex;
    flex-direction: column-reverse; /* Stack from bottom up */
    width: 100%;
    height: 100%; /* Takes full height of .bar-group for stacking */
    border-radius: 3px 3px 0 0;
    overflow: hidden; /* Ensure segments stay within rounded corners */
}
.bar-segment {
    width: 100%;
    transition: height 0.3s ease;
}

/* Line Chart Placeholder */
.line-chart-placeholder {
    align-items: center; /* Center SVG or text */
    justify-content: center;
    flex-direction: column; /* Allow text below SVG */
    height: 100%; /* Take full widget content height */
}
.line-chart-placeholder svg {
    /* SVG already has preserveAspectRatio and viewBox for basic responsiveness */
    max-height: calc(100% - 20px); /* Ensure SVG leaves space for the text below */
    /* max-height:120px; */ /* Cap max height */
}
.line-chart-placeholder p {
    font-size: 0.75em; /* Make text smaller to fit better */
    color: #555;
    margin-top: 2px; /* Reduce space above text */
    margin-bottom: 0;
}


/* General descriptive text within a chart area */
.chart-placeholder .chart-description {
    font-size: 0.8em;
    color: #666;
    text-align: center;
    width: 100%;
    padding: 5px;
    align-self: center; /* Vertically center if flex container */
}

/* Specific adjustment for Data Explorer's chart placeholder text */
#de-chart-results .widget-content .chart-placeholder p.chart-description {
    position: absolute; /* Position it at the bottom of the chart area */
    bottom: 5px;
    left: 0;
    right: 0;
}
#de-chart-results .widget-content .bar-chart-placeholder {
    padding-bottom: 25px; /* Ensure space for the absolute positioned description */
}
