/* Dashboard wrapper */
.dashboard {
    padding: 10px;
    background-color: #f4f6f8;
    overflow-x: hidden;
    min-height: 100vh;
    box-sizing: border-box;
    width: 100%;
}

/* Horizontal scroll on mobile */
.dashboard-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

/* Graph card with embedded effect */
.dashboard-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px #e6e8eb, 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 16px;
    flex: 0 0 90vw;
    scroll-snap-align: start;
    box-sizing: border-box;
    min-height: 400px;
    width: 90vw;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ✅ For Pie/Donut: Make chart fill space cleanly */
.dashboard-card.pie-chart {
    padding: 0;
    aspect-ratio: 1 / 1;
    align-items: center;
    justify-content: center;
    display: flex;
}

/* Tablet layout */
@media (min-width: 768px) and (max-width: 991px) {
    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        overflow-x: hidden;
        align-items: stretch;
    }

    .dashboard-card {
        flex: unset;
        width: 100%;
        scroll-snap-align: unset;
    }
}

/* Desktop layout */
@media (min-width: 992px) {
    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        overflow-x: hidden;
        align-items: stretch;
    }

    .dashboard-card {
        flex: unset;
        width: 100%;
        scroll-snap-align: unset;
    }
}

/* Plotly chart fills parent for all graphs */
.dashboard-card .js-plotly-plot {
    flex: 1 1 auto;
    width: 100% !important;
    height: 100% !important;
    min-height: 300px !important;
    margin: 0 auto !important;
    padding: 10px !important;
    overflow: visible !important;
    border-radius: 8px;
    background-color: #fafafa;
    box-shadow: inset 0 0 0 1px #ddd;
}

/* ✅ Pie-specific tweak to remove extra space */
.dashboard-card.pie-chart .js-plotly-plot {
    padding: 0 !important;
    margin: 0 auto !important;
    background: transparent;
    box-shadow: none;
    border-radius: 50%;
}

/* SVG responsive inside */
.js-plotly-plot svg {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: 8px;
}

/* Improve label text */
.dashboard-card .main-svg text {
    font-size: 12px !important;
    fill: #333;
}

/* Graph title styling */
.graph-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    text-align: left;
    padding-left: 5px;
    border-left: 4px solid #3498db;
}
