﻿/* ============================================================
   AwashPaygo — Admin Dashboard Styles
   Step 1: Layout shell + KPI cards
   ============================================================ */

:root {
    --kpi-primary: #3b82f6;
    --kpi-success: #10b981;
    --kpi-warning: #f59e0b;
    --kpi-info: #06b6d4;
    --kpi-secondary: #8b5cf6;
    --kpi-danger: #ef4444;
    --bg-page: #f5f7fb;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-soft: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* ---------- Wrapper ---------- */
.dashboard-wrapper {
    padding: 1.5rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
    background: var(--bg-page);
    min-height: 100vh;
}

/* ---------- Header ---------- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-header__subtitle {
    color: var(--text-secondary);
    margin: .25rem 0 0;
    font-size: .95rem;
}

.dashboard-header__timestamp {
    color: var(--text-muted);
    font-size: .85rem;
}

/* ---------- KPI Grid ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ---------- KPI Card ---------- */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--kpi-color, var(--kpi-primary));
    transition: transform .15s ease, box-shadow .15s ease;
    position: relative;
    overflow: hidden;
    min-height: 96px;
}

.kpi-card--clickable {
    cursor: pointer;
}

    .kpi-card--clickable:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

/* Color themes */
.kpi-card--primary {
    --kpi-color: var(--kpi-primary);
}

.kpi-card--success {
    --kpi-color: var(--kpi-success);
}

.kpi-card--warning {
    --kpi-color: var(--kpi-warning);
}

.kpi-card--info {
    --kpi-color: var(--kpi-info);
}

.kpi-card--secondary {
    --kpi-color: var(--kpi-secondary);
}

.kpi-card--danger {
    --kpi-color: var(--kpi-danger);
}

/* Icon */
.kpi-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--kpi-color) 12%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: var(--kpi-color);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* Simple inline SVG masks for the icons we use */
.kpi-icon--users {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M23 21v-2a4 4 0 0 0-3-3.87'/><path d='M16 3.13a4 4 0 0 1 0 7.75'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M23 21v-2a4 4 0 0 0-3-3.87'/><path d='M16 3.13a4 4 0 0 1 0 7.75'/></svg>");
}

.kpi-icon--user-check {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='8.5' cy='7' r='4'/><polyline points='17 11 19 13 23 9'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='8.5' cy='7' r='4'/><polyline points='17 11 19 13 23 9'/></svg>");
}

.kpi-icon--user-plus {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='8.5' cy='7' r='4'/><line x1='20' y1='8' x2='20' y2='14'/><line x1='17' y1='11' x2='23' y2='11'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='8.5' cy='7' r='4'/><line x1='20' y1='8' x2='20' y2='14'/><line x1='17' y1='11' x2='23' y2='11'/></svg>");
}

.kpi-icon--user-cog {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='7' r='4'/><path d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='19' cy='11' r='2'/><path d='M19 8v-1M19 15v-1M22 11h1M15 11h1'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='7' r='4'/><path d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='19' cy='11' r='2'/><path d='M19 8v-1M19 15v-1M22 11h1M15 11h1'/></svg>");
}

.kpi-icon--building {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='2' width='16' height='20' rx='2'/><line x1='9' y1='6' x2='9' y2='6.01'/><line x1='15' y1='6' x2='15' y2='6.01'/><line x1='9' y1='10' x2='9' y2='10.01'/><line x1='15' y1='10' x2='15' y2='10.01'/><line x1='9' y1='14' x2='9' y2='14.01'/><line x1='15' y1='14' x2='15' y2='14.01'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='2' width='16' height='20' rx='2'/><line x1='9' y1='6' x2='9' y2='6.01'/><line x1='15' y1='6' x2='15' y2='6.01'/><line x1='9' y1='10' x2='9' y2='10.01'/><line x1='15' y1='10' x2='15' y2='10.01'/><line x1='9' y1='14' x2='9' y2='14.01'/><line x1='15' y1='14' x2='15' y2='14.01'/></svg>");
}

.kpi-icon--home {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/><polyline points='9 22 9 12 15 12 15 22'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/><polyline points='9 22 9 12 15 12 15 22'/></svg>");
}

.kpi-icon--map-pin {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/><circle cx='12' cy='10' r='3'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/><circle cx='12' cy='10' r='3'/></svg>");
}

.kpi-icon--layers {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 2 7 12 12 22 7 12 2'/><polyline points='2 17 12 22 22 17'/><polyline points='2 12 12 17 22 12'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 2 7 12 12 22 7 12 2'/><polyline points='2 17 12 22 22 17'/><polyline points='2 12 12 17 22 12'/></svg>");
}

.kpi-icon--grid {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='7'/><rect x='14' y='3' width='7' height='7'/><rect x='14' y='14' width='7' height='7'/><rect x='3' y='14' width='7' height='7'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='7'/><rect x='14' y='3' width='7' height='7'/><rect x='14' y='14' width='7' height='7'/><rect x='3' y='14' width='7' height='7'/></svg>");
}

.kpi-icon--dollar-sign {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='12' y1='1' x2='12' y2='23'/><path d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='12' y1='1' x2='12' y2='23'/><path d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/></svg>");
}

.kpi-icon--chart {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='20' x2='18' y2='10'/><line x1='12' y1='20' x2='12' y2='4'/><line x1='6' y1='20' x2='6' y2='14'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='20' x2='18' y2='10'/><line x1='12' y1='20' x2='12' y2='4'/><line x1='6' y1='20' x2='6' y2='14'/></svg>");
}

/* Body */
.kpi-card__body {
    flex: 1;
    min-width: 0;
}

.kpi-card__title {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-card__delta {
    font-size: .78rem;
    margin-top: .25rem;
    display: flex;
    align-items: center;
    gap: .25rem;
}

.kpi-card__delta--up {
    color: var(--kpi-success);
}

.kpi-card__delta--down {
    color: var(--kpi-danger);
}

.kpi-card__delta-arrow {
    font-size: .7rem;
}

.kpi-card__delta-label {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: .15rem;
}

.kpi-card__subtitle {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

/* ---------- Placeholder (Step 2+) ---------- */
.dashboard-placeholder {
    margin-top: 1rem;
}

.placeholder-box {
    background: var(--bg-card);
    border: 2px dashed var(--border-soft);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

    .placeholder-box h3 {
        color: var(--text-secondary);
        margin: 0 0 .5rem;
        font-size: 1.1rem;
    }

    .placeholder-box p {
        margin: 0;
        font-size: .9rem;
    }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .dashboard-wrapper {
        padding: 1rem;
    }

    .dashboard-header__title {
        font-size: 1.4rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: .75rem;
    }

    .kpi-card {
        padding: .85rem 1rem;
        min-height: 84px;
    }

    .kpi-card__icon {
        width: 40px;
        height: 40px;
    }

    .kpi-card__value {
        font-size: 1.25rem;
    }

    /* ============================================================
   STEP 2 — Chart Cards
   ============================================================ */

    .charts-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .chart-card {
        background: var(--bg-card);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        transition: box-shadow .15s ease;
        border-top: 3px solid var(--chart-color, var(--kpi-primary));
    }

        .chart-card:hover {
            box-shadow: var(--shadow-md);
        }

    .chart-card--primary {
        --chart-color: var(--kpi-primary);
    }

    .chart-card--success {
        --chart-color: var(--kpi-success);
    }

    .chart-card--warning {
        --chart-color: var(--kpi-warning);
    }

    .chart-card--info {
        --chart-color: var(--kpi-info);
    }

    .chart-card--secondary {
        --chart-color: var(--kpi-secondary);
    }

    .chart-card--danger {
        --chart-color: var(--kpi-danger);
    }

    /* Header */
    .chart-card__header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 1rem 1.25rem .5rem;
        gap: 1rem;
    }

    .chart-card__title-group {
        min-width: 0;
    }

    .chart-card__title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
        margin: 0;
    }

    .chart-card__subtitle {
        display: block;
        font-size: .78rem;
        color: var(--text-muted);
        margin-top: .15rem;
    }

    .chart-card__meta {
        flex-shrink: 0;
    }

    .chart-card__period {
        font-size: .72rem;
        color: var(--text-secondary);
        background: #f3f4f6;
        padding: .25rem .55rem;
        border-radius: 999px;
        white-space: nowrap;
    }

    /* Body / chart container */
    .chart-card__body {
        padding: 0 .5rem .5rem;
        flex: 1;
        min-height: 280px;
    }

    .chart-container {
        width: 100%;
        min-height: 260px;
        position: relative;
    }

    /* Loading skeleton */
    .chart-skeleton {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
    }

    .chart-skeleton__spinner {
        width: 28px;
        height: 28px;
        border: 3px solid #e5e7eb;
        border-top-color: var(--chart-color, var(--kpi-primary));
        border-radius: 50%;
        animation: chart-spin .8s linear infinite;
    }

    @keyframes chart-spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* Footer */
    .chart-card__footer {
        padding: .5rem 1.25rem 1rem;
        border-top: 1px solid #f3f4f6;
        margin-top: auto;
    }

    .chart-card__footer-link {
        font-size: .82rem;
        color: var(--kpi-primary);
        text-decoration: none;
        font-weight: 500;
    }

        .chart-card__footer-link:hover {
            text-decoration: underline;
        }

    /* Responsive */
    @media (max-width: 992px) {
        .charts-grid {
            grid-template-columns: 1fr;
        }
    }
}
