/* ========== DASHBOARD DEMO - Báo cáo và đo lường ========== */

.db-demo {
    width: 100%;
    background: #f8f9fc;
    border-radius: 1.2rem;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    border: 1px solid #e5e7eb;
    position: relative;
}

/* ── Tabs ── */
.db-demo-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    padding: 0 2rem;
}

.db-demo-tab {
    padding: 1.2rem 1.8rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: #667085;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.db-demo-tab:hover {
    color: #344054;
}

.db-demo-tab.active {
    color: #027BFF;
    border-bottom-color: #027BFF;
}

.db-demo-tab i {
    font-size: 1.2rem;
}

/* ── Header bar ── */
.db-demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.6rem 2.4rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.db-demo-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.db-demo-header-left h4 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #101828;
    margin: 0;
}

.db-demo-header-left span {
    font-size: 1.15rem;
    color: #667085;
}

.db-demo-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.db-demo-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid #d0d5dd;
    border-radius: 0.8rem;
    background: #fff;
    color: #344054;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.db-demo-btn:hover {
    background: #f9fafb;
    border-color: #98a2b3;
}

.db-demo-btn i {
    font-size: 1.1rem;
}

.db-demo-date-btn {
    background: #f9fafb;
}

.db-demo-date-btn i {
    color: #667085;
}

/* ── Stats Cards ── */
.db-demo-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.6rem;
    padding: 2rem 2.4rem;
    background: #fff;
}

.db-stat-card {
    padding: 1.6rem 1.8rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.db-stat-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 16px rgba(2, 123, 255, 0.08);
    transform: translateY(-2px);
}

.db-stat-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.db-stat-label {
    font-size: 1.25rem;
    font-weight: 500;
    color: #667085;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.db-stat-label i.info-icon {
    font-size: 1rem;
    color: #98a2b3;
    cursor: help;
}

.db-stat-icon {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.db-stat-icon.purple {
    background: linear-gradient(135deg, #e0d4fc, #c4b5fd);
    color: #7c3aed;
}

.db-stat-icon.blue {
    background: linear-gradient(135deg, #d1e8ff, #93c5fd);
    color: #2563eb;
}

.db-stat-icon.green {
    background: linear-gradient(135deg, #d1fae5, #6ee7b7);
    color: #059669;
}

.db-stat-icon.indigo {
    background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
    color: #4f46e5;
}

.db-stat-card-body {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.db-stat-value {
    font-size: 3.2rem;
    font-weight: 800;
    color: #101828;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.db-stat-change {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.15rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    margin-bottom: 0.4rem;
}

.db-stat-change.up {
    color: #059669;
    background: rgba(5, 150, 105, 0.08);
}

.db-stat-change.down {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.db-stat-change i {
    font-size: 0.9rem;
}

.db-stat-sub {
    font-size: 1.1rem;
    color: #98a2b3;
    margin-top: -0.2rem;
}

/* ── Chart section ── */
.db-demo-chart-section {
    padding: 2rem 2.4rem;
    background: #fff;
}

.db-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.db-chart-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.db-chart-title i {
    color: #027BFF;
    font-size: 1.3rem;
}

.db-chart-title h5 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #101828;
    margin: 0;
}

.db-chart-subtitle {
    font-size: 1.15rem;
    color: #667085;
    margin-bottom: 1.6rem;
}

/* Combined chart wrapper */
.db-combined-chart-wrap {
    position: relative;
    width: 100%;
}

/* Bar chart area */
.db-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12rem;
    padding-bottom: 0;
    position: relative;
    z-index: 1;
}

.db-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    position: relative;
}

.db-bar {
    width: 100%;
    max-width: 3.6rem;
    border-radius: 0.4rem 0.4rem 0 0;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    cursor: pointer;
    min-height: 2px;
}

.db-bar:hover {
    filter: brightness(1.1);
    transform: scaleY(1.05);
    transform-origin: bottom;
}

.db-bar-value {
    position: absolute;
    top: -1.8rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 700;
    color: #344054;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.db-bar-col:hover .db-bar-value {
    opacity: 1;
}

.db-bar.has-value .db-bar-value {
    opacity: 1;
}

/* Time labels */
.db-bar-time-row {
    display: flex;
    gap: 2px;
    padding-top: 0.4rem;
    border-top: 1px solid #e5e7eb;
}

.db-bar-time {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: #98a2b3;
    font-weight: 500;
}

/* Line chart overlay */
.db-line-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 12rem;
    pointer-events: none;
    z-index: 2;
}

.db-line-overlay svg {
    width: 100%;
    height: 100%;
}

.db-line-path {
    fill: none;
    stroke: #027BFF;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgba(2, 123, 255, 0.3));
}

.db-line-area {
    fill: url(#lineGradient);
    opacity: 0.15;
}

/* ── Staff Activity Timeline ── */
.db-staff-section {
    padding: 0rem 2.4rem 2rem;
    background: #fff;
}

.db-staff-label {
    font-size: 1.15rem;
    font-weight: 600;
    color: #667085;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.db-staff-label i {
    font-size: 1.1rem;
}

.db-staff-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.db-staff-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.db-staff-info {
    width: 14rem;
    min-width: 14rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

.db-staff-avatar {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.db-staff-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #344054;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-staff-timeline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 2.8rem;
    position: relative;
}

.db-staff-cell {
    flex: 1;
    height: 100%;
    border-radius: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.db-staff-cell:hover {
    transform: scaleY(1.15);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.db-staff-cell.empty {
    background: transparent;
}

.db-staff-cell.level-1 {
    background: #c7d2fe;
    color: #4338ca;
}

.db-staff-cell.level-2 {
    background: #a5b4fc;
    color: #fff;
}

.db-staff-cell.level-3 {
    background: #818cf8;
    color: #fff;
}

.db-staff-cell.level-4 {
    background: #6366f1;
    color: #fff;
}

.db-staff-cell.level-5 {
    background: #4f46e5;
    color: #fff;
}

.db-staff-cell.green-1 {
    background: #86efac;
    color: #166534;
}

.db-staff-cell.green-2 {
    background: #4ade80;
    color: #fff;
}

.db-staff-cell.green-3 {
    background: #22c55e;
    color: #fff;
}

.db-staff-cell.orange-1 {
    background: #fdba74;
    color: #9a3412;
}

.db-staff-cell.orange-2 {
    background: #fb923c;
    color: #fff;
}

.db-staff-cell.orange-3 {
    background: #f97316;
    color: #fff;
}

.db-staff-total {
    width: 4.5rem;
    text-align: right;
    font-size: 1.35rem;
    font-weight: 800;
    flex-shrink: 0;
}

.db-staff-total.purple { color: #6366f1; }
.db-staff-total.green { color: #16a34a; }
.db-staff-total.orange { color: #ea580c; }
.db-staff-total.blue { color: #2563eb; }

/* ── Animated number counter ── */
@keyframes dbCountUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.db-stat-value {
    animation: dbCountUp 0.6s ease forwards;
}

/* Bar entrance animation */
@keyframes dbBarGrow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

.db-bar {
    transform-origin: bottom;
    animation: dbBarGrow 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Line draw animation */
@keyframes dbLineDraw {
    from { stroke-dashoffset: 2000; }
    to { stroke-dashoffset: 0; }
}

.db-line-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.db-demo.animated .db-line-path {
    animation: dbLineDraw 2s ease forwards 0.5s;
}

/* Cell entrance */
@keyframes dbCellFadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.db-staff-cell:not(.empty) {
    animation: dbCellFadeIn 0.4s ease forwards;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .db-demo-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1.4rem;
    }

    .db-stat-card {
        padding: 1.2rem;
    }

    .db-stat-value {
        font-size: 2.4rem;
    }

    .db-stat-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.2rem;
    }

    .db-demo-chart-section {
        padding: 1.4rem;
    }

    .db-bar-chart {
        height: 8rem;
    }

    .db-line-overlay {
        height: 8rem;
    }

    .db-staff-section {
        padding: 0 1.4rem 1.4rem;
        overflow-x: auto;
    }

    .db-staff-info {
        width: 10rem;
        min-width: 10rem;
    }

    .db-staff-name {
        font-size: 1.1rem;
    }

    .db-demo-header {
        padding: 1.2rem 1.4rem;
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    .db-demo-header-right {
        flex-wrap: wrap;
    }

    .db-demo-tabs {
        padding: 0 1.4rem;
        overflow-x: auto;
    }

    .db-demo-tab {
        padding: 1rem 1.2rem;
        font-size: 1.2rem;
    }

    .db-demo-btn {
        padding: 0.5rem 0.8rem;
        font-size: 1.1rem;
    }

    .db-bar-value {
        font-size: 0.85rem;
    }

    .db-bar-time {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .db-demo-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }

    .db-stat-card {
        padding: 1rem;
    }

    .db-stat-value {
        font-size: 2rem;
    }

    .db-stat-change {
        font-size: 1rem;
    }

    .db-staff-timeline {
        min-width: 40rem;
    }

    .db-staff-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
