/* Store owner Dashboard (views/dashboard.html). Every rule is scoped under .dashboard-page. */

.dashboard-page{
    padding: 12px 8px 24px;
    max-width: 1280px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Report actions: one row of outlined buttons, scrolls sideways on narrow screens */
.dashboard-page .dashboard-actions{
    display: flex;
    gap: 8px;
    padding: 0 8px 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.dashboard-page .dashboard-actions::-webkit-scrollbar{
    display: none;
}

.dashboard-page .dashboard-action.md-button{
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0 14px 0 10px;
    min-height: 38px;
    line-height: 38px;
    border: 1px solid rgba(0,0,0,0.14);
    border-radius: 19px;
    background: #ffffff;
    color: rgba(0,0,0,0.78);
    text-transform: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.dashboard-page .dashboard-action.md-button:hover{
    background: #f3f7fd;
    border-color: rgba(30,136,229,0.45);
}

.dashboard-page .dashboard-action .material-icons{
    font-size: 20px;
    color: #1E88E5;
}

/* KPI tiles: 2x2 on phones, 4 across from tablets up */
.dashboard-page .dashboard-kpis{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 8px 4px;
}

.dashboard-page .dashboard-kpi{
    position: relative;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
}

.dashboard-page .dashboard-kpi .material-icons{
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: rgba(30,136,229,0.55);
}

.dashboard-page .dashboard-kpi-label{
    padding-right: 24px;
    font-size: 12px;
    color: rgba(0,0,0,0.58);
    line-height: 1.3;
}

.dashboard-page .dashboard-kpi-value{
    margin-top: 4px;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
    color: rgba(0,0,0,0.87);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-page .dashboard-kpi .dashboard-kpi-text{
    font-size: 16px;
    line-height: 1.5;
}

.dashboard-page .dashboard-kpi-period{
    margin-top: 2px;
    font-size: 11px;
    color: rgba(0,0,0,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cards: one column on phones, two from tablets up */
.dashboard-page .dashboard-grid{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
}

.dashboard-page .dashboard-card{
    margin: 8px;
    min-width: 0;
    border-radius: 12px;
    overflow: hidden;
}

.dashboard-page .dashboard-card-header{
    padding: 14px 16px 4px;
}

.dashboard-page .dashboard-card-header h3{
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: rgba(0,0,0,0.87);
}

.dashboard-page .dashboard-card-header span{
    font-size: 12px;
    color: rgba(0,0,0,0.55);
}

/* Fixed chart heights (maintainAspectRatio:false) so nothing is clipped on phones */
.dashboard-page .dashboard-chart{
    position: relative;
    height: 260px;
    margin: 8px 12px 14px;
}

.dashboard-page .dashboard-chart-tall{
    height: 320px;
}

.dashboard-page .dashboard-empty{
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    background: #fafafa;
    color: rgba(0,0,0,0.5);
    font-size: 14px;
    text-align: center;
}

.dashboard-page .dashboard-empty .material-icons{
    font-size: 32px;
    color: rgba(0,0,0,0.25);
}

/* Income per order type: doughnut with the total in the middle, legend list beside/below it */
.dashboard-page .dashboard-order-types{
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.dashboard-page .dashboard-chart-doughnut{
    height: 220px;
}

.dashboard-page .dashboard-doughnut-total{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.dashboard-page .dashboard-doughnut-total span{
    display: block;
    font-size: 12px;
    color: rgba(0,0,0,0.55);
}

.dashboard-page .dashboard-doughnut-total strong{
    font-size: 18px;
    font-weight: 600;
    color: rgba(0,0,0,0.87);
}

.dashboard-page .dashboard-legend{
    list-style: none;
    margin: 0 16px 14px;
    padding: 0;
}

.dashboard-page .dashboard-legend li{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid rgba(0,0,0,0.06);
    font-size: 14px;
}

.dashboard-page .dashboard-legend li:first-child{
    border-top: none;
}

.dashboard-page .dashboard-legend-dot{
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dashboard-page .dashboard-legend-name{
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(0,0,0,0.78);
}

.dashboard-page .dashboard-legend-amount{
    white-space: nowrap;
    font-weight: 600;
    color: rgba(0,0,0,0.87);
}

.dashboard-page .dashboard-legend-count{
    min-width: 56px;
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
    color: rgba(0,0,0,0.55);
}

/* Publish checklist keeps its own styles, it only follows the card shape */
.dashboard-page .publish-readiness-card{
    grid-column: 1 / -1;
}

@media (min-width: 600px){
    .dashboard-page{
        padding: 16px 16px 32px;
    }

    .dashboard-page .dashboard-kpis{
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }

    .dashboard-page .dashboard-kpi-value{
        font-size: 24px;
    }
}

@media (min-width: 960px){
    .dashboard-page .dashboard-grid{
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-page .dashboard-order-types{
        flex-direction: row;
        align-items: center;
        min-height: 320px;
    }

    .dashboard-page .dashboard-chart-doughnut{
        flex: 0 0 40%;
        height: 260px;
    }

    .dashboard-page .dashboard-legend{
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 4px;
    }

    .dashboard-page .dashboard-legend li{
        display: grid;
        grid-template-columns: 10px minmax(0, 1fr) auto;
        column-gap: 10px;
        row-gap: 2px;
    }

    .dashboard-page .dashboard-legend-count{
        grid-column: 2 / 4;
        min-width: 0;
        text-align: left;
    }
}
