/* === Global Layout === */
html, body {
    height: 100%;
    margin: 0;
    overflow-y: auto;
}

body.sidebar-collapsed .main-content {
    left: 0 !important;
}

body.sidebar-collapsed #chatbot-launcher {
    display: none !important;
}

body.sidebar-collapsed #chatbot-wrapper {
    display: none !important;
}

body:not(.sidebar-collapsed) .widget-trash {
    opacity: 0;
    pointer-events: none;
    transform: translateX(50px) scale(0.95);
}

/* Position it on the left when collapsed */
body.sidebar-collapsed #toggleSidebar {
    left: 210px;
    top: 68px;
    background: none;
    border: none;
    box-shadow: none;
    color: white;
}

/* Position it on the right edge of sidebar when open */
body:not(.sidebar-collapsed) #toggleSidebar {
    left: 10px; /* inside the sidebar width (250px - button width) */
}

.chart-filter-bar {
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 10px 16px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fafafa;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

/* Group filter fields on the left */
.chart-filter-bar .filter-fields-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: flex-start;
}

/* Each field gets a label and select stacked */
.chart-filter-bar .filter-field {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;            /* Do NOT grow or shrink */
    width: auto;
    min-width: 240px;
    max-width: none;           /* Let it expand beyond 240px */
    position: relative;
}

.chart-filter-bar .filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}

/* Select input itself */
.chart-filter-bar .chart-filter-select {
    display: inline-block;
    min-width: 240px;
    max-width: none;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.88rem;
    background-color: #fff;
    color: #333;
    white-space: nowrap;
}

/* Icon-only button group to the right */
.chart-filter-bar .filter-button-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.chart-filter-bar .chart-filter-icon {
    all: unset;
    border-radius: 4px;
    padding: 6px;
    font-size: 1rem;
    color: lightgray;
    cursor: pointer;
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chart-filter-bar .chart-filter-icon:hover {
    background-color: #eee;
    color: #777777;
}

.chart-no-data-message {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #888;
}

/* === Fade-out Animation for Deleted Widgets === */
.fade-out {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.grid-stack {
    min-height: calc(100vh - 100px); /* dynamic and responsive */
}

/* === Main Content Area === */
.main-content {
    position: absolute;
    top: 58px; /* Adjust if your navbar height differs */
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    overflow: auto;
    transition: left 0.3s ease;
}

/* === Sidebar Container === */
#sidebar-container {
    position: fixed;
    top: 58px; /* Same as navbar height */
    left: 0;
    bottom: 0;
    width: 250px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease,
        width 0.3s ease;
}

#sidebar-container,
#thumbnail-sidebar {
    background-color: #343a40 !important;
    color: white;
}

#sidebar-container.collapsed {
    transform: translateX(-100%);
    width: 0 !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 0;
}

/* === Sidebar Inner Panel === */
#thumbnail-sidebar {
    flex-grow: 1;
    background-color: #f8f9fa;
    height: 100%;
    pointer-events: auto;
    overflow-y: auto;
    padding: 10px;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease,
        padding 0.3s ease;
}

#thumbnail-sidebar.collapsed {
    transform: translateX(-100%);
    opacity: 0;
    padding: 0 !important;
    overflow: hidden;
}

/* === Hamburger Toggle Button === */
#toggleSidebar {
    position: fixed;
    top: 62px; /* Slightly below navbar */
    left: 10px;
    z-index: 1100;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease;
}

#toggleSidebar i.fa-times {
    font-size: 1.2rem; /* Adjust as needed */
}

.tooltip.plotly-tooltip .tooltip-inner {
    background-color: rgba(105, 105, 134);
    color: #ffffff;
    font-size: 0.76rem;
    padding: 6px 9px;
    border-radius: 2px;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.tooltip.plotly-tooltip.bs-tooltip-top .arrow::before {
    border-width: 0.4rem 0.4rem 0;
    border-top-color: rgba(110, 110, 140);
}

.tooltip.plotly-tooltip.bs-tooltip-bottom .arrow::before {
    border-width: 0 0.4rem 0.4rem;
    border-bottom-color: rgba(110, 110, 140);
}

.tooltip.plotly-tooltip.bs-tooltip-left .arrow::before {
    border-width: 0.4rem 0 0.4rem 0.4rem;
    border-left-color: rgba(110, 110, 140);
}

.tooltip.plotly-tooltip.bs-tooltip-right .arrow::before {
    border-width: 0.4rem 0.4rem 0.4rem 0;
    border-right-color: rgba(110, 110, 140);
}

.widget-name {
    font-weight: 300;
    font-size: 0.98rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 8px;
}

/* === Widget Thumbnails === */
#widget-thumbnails .card {
    background-color: transparent;
    border: none;
    color: white;
    cursor: grab;
    transition: background 0.2s;
}

#widget-thumbnails .card:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* === Trash Can (Bottom Right Corner) === */
.widget-trash {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #dc3545;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    display: flex;
    align-items: center;
    opacity: 0.9;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease,
        background 0.3s ease;
}

.widget-trash.drag-over {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

