/* ===== Stats page ===== */

/* --- Filters card --- */
.stats-filters-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
    margin-top: 20px;
}

.stats-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px 16px;
    align-items: end;
}

.stats-filters-card .filter-item {
    min-width: 0;
}

.stats-filters-card .filter-item .help-block {
    display: none;
}

.stats-filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b8fa3;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.stats-filter-input {
    border: 1px solid #e0e0e0;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    padding: 6px 12px !important;
    height: 38px !important;
    width: 100% !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.stats-filter-input:focus {
    border-color: #5c6bc0;
    box-shadow: 0 0 0 3px rgba(92, 107, 192, 0.1);
    background: #fff;
}

.stats-filter-btn {
    height: 38px;
    min-width: 100px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
    box-shadow: none !important;
}

a.stats-filter-btn,
a.stats-filter-btn:hover {
    text-decoration: none;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.stats-filter-btn.btn-outline-secondary {
    border: 1.5px solid #d1d5db;
    color: #4b5563;
    background: #fff;
}

.stats-filter-btn.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #1f2937;
}

.stats-filters-card .filter-actions-row {
    display: flex;
    gap: 8px;
}

/* --- KPI cards --- */
.stats-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.stats-kpi-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stats-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3142;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stats-kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #8b8fa3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 6px;
}

/* --- Charts --- */
.stats-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.stats-chart-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 20px 24px;
}

.stats-chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3142;
    margin-bottom: 16px;
}

.stats-chart-card-line {
    height: 320px;
}

.stats-chart-card-line canvas {
    height: 260px !important;
}

.stats-chart-card-funnel {
    height: 320px;
}

.stats-chart-card-funnel canvas {
    height: 260px !important;
}

/* --- Chart empty state --- */
.stats-chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 220px;
    color: #b0b5c3;
}

.stats-chart-empty i {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.stats-chart-empty p {
    font-size: 0.9rem;
    margin: 0;
}

@media (max-width: 768px) {
    .stats-charts-row {
        grid-template-columns: 1fr;
    }

    .stats-kpi-row {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* --- Results bar --- */
.stats-results-bar {
    display: flex;
    align-items: center;
    padding: 10px 0;
    font-size: 0.85rem;
    color: #6b7280;
}

/* --- Table card --- */
.stats-table-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    overflow: hidden;
}

/* --- Table --- */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.stats-table thead th {
    background: #fafbfc;
    font-weight: 600;
    font-size: 0.78rem;
    color: #8b8fa3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px 16px;
    border-bottom: 1px solid #e8eaed;
    border-top: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.stats-table thead th a {
    color: #8b8fa3;
    text-decoration: none;
}

.stats-table thead th a:hover {
    color: #5c6bc0;
}

.stats-table tbody tr {
    transition: background-color 0.15s;
}

.stats-table tbody tr:hover {
    background-color: #f5f6ff;
}

.stats-table tbody td {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: #2d3142;
    border-bottom: 1px solid #f0f1f3;
    vertical-align: middle;
}

.stats-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column widths */
.stats-th-offer { width: 220px; }
.stats-th-num {
    width: 110px;
    text-align: right;
}

/* Right-align numeric cells */
.stats-table tbody td.stats-td-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --- Pager --- */
.stats-pager-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #f0f1f3;
}

.stats-pager-left {
    display: flex;
    align-items: center;
}

.stats-pager-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-perpage-label {
    font-size: 0.82rem;
    color: #8b8fa3;
    white-space: nowrap;
    margin: 0;
}

.stats-perpage-select {
    width: auto !important;
    height: 32px !important;
    font-size: 0.82rem !important;
    padding: 2px 28px 2px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #e0e0e0;
    cursor: pointer;
}

.stats-pager-wrap .pagination {
    margin: 0;
    gap: 4px;
}

.stats-pager-wrap .page-link {
    border: none;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.85rem;
    padding: 6px 12px;
    background: transparent;
}

.stats-pager-wrap .page-link:hover {
    background: #f0f1f3;
    color: #2d3142;
}

.stats-pager-wrap .page-item.active .page-link {
    background: #5c6bc0;
    color: #fff;
}

/* --- GridView overrides --- */
.stats-table .filters {
    display: none;
}

.stats-table-card .grid-view {
    margin: 0;
}

.stats-table-card .summary {
    display: none;
}

/* --- Daterangepicker custom --- */
#stats-daterange {
    cursor: pointer;
    background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238b8fa3' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: 30px !important;
}
