/* =========================
   REPORTS PAGE
========================= */

.reports-page {
    min-height: calc(100vh - 100px);
}


/* =========================
   REPORTS HEADER
========================= */

.reports-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;
}

.reports-header h3 {
    color: var(--text);

    font-size: 21px;
}

.reports-header p {
    margin-top: 5px;

    color: var(--text-soft);

    font-size: 13px;
}

.reports-header__actions {
    display: flex;
    align-items: center;

    gap: 10px;
}


/* PERIOD SELECT */

.reports-period {
    min-height: 42px;

    padding: 0 13px;

    background: var(--surface);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 10px;

    outline: none;

    font-family: inherit;
    font-size: 11px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.reports-period:hover,
.reports-period:focus {
    border-color: var(--primary);
}

.reports-period:focus {
    box-shadow:
        0 0 0 3px var(--primary-soft);
}


/* =========================
   KPI CARDS
========================= */

.reports-stats {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 20px;
}

.report-stat {
    display: flex;
    flex-direction: column;

    gap: 12px;

    padding: 20px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-sm);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.report-stat:hover {
    transform: translateY(-2px);

    border-color: var(--primary);

    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.07);
}

.report-stat__top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.report-stat__icon {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    background: var(--primary-soft);
    color: var(--primary);

    font-size: 16px;
}

.report-stat__change {
    display: inline-flex;
    align-items: center;

    padding: 5px 8px;

    border-radius: 999px;

    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;

    font-size: 10px;
    font-weight: 700;
}

.report-stat__change.negative {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.report-stat__label {
    color: var(--text-soft);

    font-size: 11px;
}

.report-stat__value {
    color: var(--text);

    font-size: 23px;
}


/* =========================
   SHARED REPORT CARD HEADER
========================= */

.report-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    padding: 18px 20px;

    border-bottom: 1px solid var(--border);
}

.report-card__header h3 {
    color: var(--text);

    font-size: 14px;
}

.report-card__header p {
    margin-top: 4px;

    color: var(--text-soft);

    font-size: 10px;
}


/* =========================
   MAIN CHART
========================= */

.report-main-chart {
    margin-bottom: 20px;

    overflow: hidden;
}

.report-chart-container {
    position: relative;

    width: 100%;
    height: 280px;

    padding: 18px;
}

.report-chart-container--large {
    height: 370px;

    padding: 20px;
}

.report-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}


/* =========================
   CHART LEGEND
========================= */

.chart-legend {
    display: flex;
    align-items: center;

    gap: 16px;

    color: var(--text-soft);

    font-size: 10px;
}

.chart-legend span {
    display: flex;
    align-items: center;

    gap: 6px;
}

.chart-legend__dot {
    width: 8px;
    height: 8px;

    display: inline-block;

    border-radius: 50%;
}

.chart-legend__dot--revenue {
    background: #6366f1;
}

.chart-legend__dot--orders {
    background: #22c55e;
}


/* =========================
   SECONDARY CHART GRID
========================= */

.reports-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 20px;
}

.report-chart-card {
    min-width: 0;

    overflow: hidden;
}


/* =========================
   MONTHLY PERFORMANCE
========================= */

.monthly-performance {
    margin-bottom: 20px;

    overflow: hidden;
}

.monthly-table {
    width: 100%;

    border-collapse: collapse;
}

.monthly-table th,
.monthly-table td {
    padding: 15px 18px;

    text-align: left;
    white-space: nowrap;

    border-bottom: 1px solid var(--border);
}

.monthly-table th {
    color: var(--text-soft);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.monthly-table td {
    color: var(--text);

    font-size: 12px;
}

.monthly-table tbody tr {
    transition: background-color 0.2s ease;
}

.monthly-table tbody tr:hover {
    background: var(--surface-soft);
}

.monthly-table tbody tr:last-child td {
    border-bottom: none;
}


/* =========================
   MONTHLY GROWTH
========================= */

.monthly-growth {
    display: inline-flex;
    align-items: center;

    gap: 5px;

    padding: 5px 8px;

    border-radius: 999px;

    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;

    font-size: 10px;
    font-weight: 700;
}

.monthly-growth.negative {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}


/* =========================
   INSIGHTS
========================= */

.reports-insights {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 18px;
}

.report-insight {
    display: flex;
    align-items: center;

    gap: 14px;

    padding: 20px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-sm);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}

.report-insight:hover {
    transform: translateY(-2px);

    border-color: var(--primary);
}

.report-insight__icon {
    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    flex-shrink: 0;

    border-radius: 12px;

    background: var(--primary-soft);
    color: var(--primary);

    font-size: 17px;
}

.report-insight > div:last-child {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 4px;
}

.report-insight span {
    color: var(--text-soft);

    font-size: 10px;
}

.report-insight strong {
    overflow: hidden;

    color: var(--text);

    font-size: 13px;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-insight small {
    color: var(--text-light);

    font-size: 9px;
}


/* =========================
   TABLE WRAPPER
========================= */

.monthly-performance .table-wrapper {
    width: 100%;

    overflow-x: auto;
}


/* =========================
   SCROLLBAR
========================= */

.monthly-performance
.table-wrapper::-webkit-scrollbar,
.report-chart-container::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.monthly-performance
.table-wrapper::-webkit-scrollbar-thumb,
.report-chart-container::-webkit-scrollbar-thumb {
    background: var(--border);

    border-radius: 999px;
}


/* =========================
   DARK MODE
========================= */

body.dark-theme .report-stat:hover {
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.2);
}

body.dark-theme .reports-period {
    background: var(--surface);
    color: var(--text);
}

body.dark-theme .monthly-table tbody tr:hover {
    background: var(--surface-soft);
}


/* =========================
   RESPONSIVE - 1200px
========================= */

@media (max-width: 1200px) {

    .reports-stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}


/* =========================
   RESPONSIVE - 900px
========================= */

@media (max-width: 900px) {

    .reports-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .reports-header__actions {
        width: 100%;
    }

    .reports-period {
        flex: 1;
    }

    .reports-grid {
        grid-template-columns: 1fr;
    }

    .reports-insights {
        grid-template-columns: 1fr;
    }

    .report-chart-container--large {
        height: 330px;
    }
}


/* =========================
   RESPONSIVE - 600px
========================= */

@media (max-width: 600px) {

    .reports-stats {
        grid-template-columns: 1fr;
    }

    .reports-header__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .reports-period {
        width: 100%;
    }

    .reports-header__actions .button {
        width: 100%;

        justify-content: center;
    }

    .report-card__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-legend {
        flex-wrap: wrap;
    }

    .report-chart-container--large {
        height: 300px;

        padding: 14px;
    }

    .report-chart-container {
        height: 260px;

        padding: 14px;
    }

    .report-stat__value {
        font-size: 21px;
    }
}


/* =========================
   RESPONSIVE - 420px
========================= */

@media (max-width: 420px) {

    .report-stat,
    .report-insight {
        padding: 17px;
    }

    .report-card__header {
        padding: 16px;
    }

    .monthly-table th,
    .monthly-table td {
        padding: 13px 15px;
    }
}