﻿
/* =========================================
   DASHBOARD PAGE
========================================= */

.dashboard-page {
    padding: 24px 26px 35px;
    background: #f4f7fc;
    min-height: 100%;
    color: #172b55;
    font-family: inherit;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

    .dashboard-header h2 {
        margin: 0 0 5px;
        color: #192d59;
        font-size: 25px;
        font-weight: 700;
    }

    .dashboard-header p {
        margin: 0;
        color: #71809b;
        font-size: 13px;
    }

.dashboard-date-filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .dashboard-filter-group label {
        font-size: 12px;
        font-weight: 600;
        color: #536582;
    }

    .dashboard-filter-group input {
        height: 39px;
        min-width: 145px;
        padding: 0 10px;
        border: 1px solid #dce4f0;
        border-radius: 7px;
        background: #fff;
        color: #263b61;
        font-size: 13px;
        outline: none;
    }

        .dashboard-filter-group input:focus {
            border-color: #2864e8;
            box-shadow: 0 0 0 3px rgba(40, 100, 232, 0.10);
        }

.dashboard-filter-btn {
    height: 39px;
    padding: 0 18px;
    border: none;
    border-radius: 7px;
    background: #2864e8;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .dashboard-filter-btn:hover {
        background: #174fc9;
    }

    .dashboard-filter-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* =========================================
   SUMMARY CARDS
========================================= */

.dashboard-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-kpi-card {
    background: #fff;
    border: 1px solid #e9eef6;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 12px rgba(26, 48, 91, 0.045);
    min-width: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .dashboard-kpi-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 7px 18px rgba(26, 48, 91, 0.08);
    }

.dashboard-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

    .dashboard-kpi-top p {
        margin: 0 0 10px;
        color: #71809b;
        font-size: 13px;
        font-weight: 600;
    }

    .dashboard-kpi-top h3 {
        margin: 0;
        color: #192d59;
        font-size: clamp(19px, 1.7vw, 25px);
        font-weight: 700;
        overflow-wrap: anywhere;
    }

        .dashboard-kpi-top h3 small {
            font-size: 13px;
            color: #71809b;
            font-weight: 600;
        }

.dashboard-kpi-description {
    display: block;
    margin-top: 14px;
    color: #8a97ad;
    font-size: 11px;
}

.dashboard-kpi-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 21px;
    font-weight: 700;
}

.icon-blue {
    color: #2864e8;
    background: #eaf1ff;
}

.icon-purple {
    color: #7955c9;
    background: #f1edff;
}

.icon-green {
    color: #15966a;
    background: #e7f7f0;
}

.icon-orange {
    color: #d58a22;
    background: #fff5e5;
}

/* =========================================
   PANELS AND CHARTS
========================================= */

.dashboard-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-panel {
    background: #fff;
    border: 1px solid #e9eef6;
    border-radius: 12px;
    padding: 21px;
    min-width: 0;
    box-shadow: 0 3px 12px rgba(26, 48, 91, 0.045);
}

.dashboard-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

    .dashboard-panel-header h4 {
        margin: 0 0 5px;
        color: #192d59;
        font-size: 16px;
        font-weight: 700;
    }

    .dashboard-panel-header p {
        margin: 0;
        color: #8996ab;
        font-size: 12px;
    }

.dashboard-panel-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    background: #eef3ff;
    color: #2864e8;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Dispatch bar chart */

.dashboard-bar-chart {
    height: 220px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 4px 0;
}

.dashboard-bar-item {
    flex: 1;
    min-width: 42px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.dashboard-bar-value {
    color: #71809b;
    font-size: 10px;
    margin-bottom: 6px;
    white-space: nowrap;
}

.dashboard-bar-track {
    width: 100%;
    height: 165px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-bottom: 1px solid #e7edf5;
}

.dashboard-bar {
    width: min(70%, 38px);
    min-height: 3px;
    background: linear-gradient(180deg, #4c83f5, #2864e8);
    border-radius: 6px 6px 0 0;
    transition: height 0.3s ease;
}

.dashboard-bar-item:hover .dashboard-bar {
    background: #174fc9;
}

.dashboard-bar-label {
    margin-top: 9px;
    color: #8491a8;
    font-size: 10px;
    white-space: nowrap;
}

/* Payment status */

.dashboard-payment-total {
    margin: 12px 0 20px;
    text-align: center;
}

    .dashboard-payment-total h3 {
        margin: 0;
        color: #192d59;
        font-size: 31px;
        font-weight: 700;
    }

    .dashboard-payment-total span {
        color: #8996ab;
        font-size: 12px;
    }

.dashboard-payment-bar {
    display: flex;
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 20px;
    background: #edf1f7;
}

.payment-segment {
    height: 100%;
    transition: width 0.3s ease;
}

.paid-segment {
    background: #20a477;
}

.partial-segment {
    background: #e9a23b;
}

.unpaid-segment {
    background: #e16b70;
}

.dashboard-payment-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 24px;
}

.dashboard-payment-item {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #71809b;
    font-size: 13px;
}

    .dashboard-payment-item strong {
        margin-left: auto;
        color: #263b61;
        font-size: 14px;
    }

.payment-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.paid-dot {
    background: #20a477;
}

.partial-dot {
    background: #e9a23b;
}

.unpaid-dot {
    background: #e16b70;
}

/* =========================================
   TABLES
========================================= */

.dashboard-table-panel {
    margin-bottom: 22px;
}

.dashboard-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    text-align: left;
}

    .dashboard-table thead {
        background: #f5f7fb;
    }

    .dashboard-table th {
        padding: 13px 14px;
        color: #71809b;
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
        border-bottom: 1px solid #e9eef6;
    }

    .dashboard-table td {
        padding: 14px;
        color: #52627d;
        font-size: 12px;
        white-space: nowrap;
        border-bottom: 1px solid #eef1f6;
    }

    .dashboard-table tbody tr:last-child td {
        border-bottom: none;
    }

    .dashboard-table tbody tr:hover {
        background: #f8faff;
    }

.dashboard-primary-text {
    color: #2864e8 !important;
    font-weight: 700;
}

.dashboard-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
}

.status-paid {
    color: #16835f;
    background: #e6f6ef;
}

.status-partial {
    color: #b7791f;
    background: #fff4df;
}

.status-unpaid {
    color: #c34c53;
    background: #ffebec;
}

.status-default {
    color: #64748b;
    background: #edf1f6;
}

/* Active DO progress */

.dashboard-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 115px;
}

.dashboard-progress-track {
    width: 75px;
    height: 7px;
    overflow: hidden;
    border-radius: 10px;
    background: #e9eef6;
}

.dashboard-progress-fill {
    height: 100%;
    border-radius: 10px;
    background: #2864e8;
}

.dashboard-progress-wrapper span {
    color: #71809b;
    font-size: 11px;
}

/* =========================================
   LOADING, ERROR AND EMPTY STATES
========================================= */

.dashboard-message {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #71809b;
    font-size: 13px;
}

.dashboard-loader {
    width: 34px;
    height: 34px;
    border: 3px solid #e1e9f7;
    border-top-color: #2864e8;
    border-radius: 50%;
    animation: dashboard-spin 0.8s linear infinite;
}

@keyframes dashboard-spin {
    to {
        transform: rotate(360deg);
    }
}

.dashboard-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px;
    border: 1px solid #f2c9c9;
    border-radius: 8px;
    background: #fff2f2;
    color: #b83f46;
    font-size: 13px;
}

    .dashboard-error button {
        border: none;
        border-radius: 6px;
        padding: 7px 14px;
        background: #2864e8;
        color: #fff;
        cursor: pointer;
    }

.dashboard-empty-state,
.dashboard-empty-chart {
    padding: 35px 15px;
    text-align: center;
    color: #8996ab;
    font-size: 13px;
}

/* =========================================
   RESPONSIVE DESIGN
========================================= */

@media (max-width: 1200px) {
    .dashboard-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .dashboard-page {
        padding: 16px 12px 25px;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 18px;
    }

        .dashboard-header h2 {
            font-size: 21px;
        }

    .dashboard-date-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 10px;
    }

    .dashboard-filter-group input {
        width: 100%;
        min-width: 0;
    }

    .dashboard-filter-btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .dashboard-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 14px;
    }

    .dashboard-kpi-card {
        padding: 13px 11px;
        border-radius: 9px;
    }

    .dashboard-kpi-top {
        gap: 5px;
    }

        .dashboard-kpi-top p {
            font-size: 11px;
            margin-bottom: 8px;
        }

        .dashboard-kpi-top h3 {
            font-size: 17px;
        }

            .dashboard-kpi-top h3 small {
                font-size: 11px;
            }

    .dashboard-kpi-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
        border-radius: 8px;
    }

    .dashboard-kpi-description {
        font-size: 9px;
        line-height: 1.4;
        margin-top: 10px;
    }

    .dashboard-chart-grid {
        gap: 13px;
        margin-bottom: 14px;
    }

    .dashboard-panel {
        padding: 15px 12px;
        border-radius: 9px;
    }

    .dashboard-panel-header {
        margin-bottom: 16px;
    }

        .dashboard-panel-header h4 {
            font-size: 14px;
        }

        .dashboard-panel-header p {
            font-size: 10px;
        }

    .dashboard-bar-chart {
        height: 190px;
        gap: 7px;
    }

    .dashboard-bar-track {
        height: 140px;
    }

    .dashboard-bar-value {
        font-size: 9px;
    }

    .dashboard-bar-label {
        font-size: 9px;
    }

    .dashboard-payment-total h3 {
        font-size: 27px;
    }

    .dashboard-table-panel {
        margin-bottom: 14px;
    }

    .dashboard-table th,
    .dashboard-table td {
        padding: 11px 10px;
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .dashboard-kpi-top h3 {
        font-size: 15px;
    }

    .dashboard-kpi-icon {
        width: 28px;
        height: 28px;
    }
}
