/**
 * PrestaChamps
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Commercial License
 * you can't distribute, modify or sell this code
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file
 * If you need help please contact leo@prestachamps.com
 *
 * @author    PrestaChamps <leo@prestachamps.com>
 * @copyright PrestaChamps
 * @license   commercial
 */

/*
 * Consent statistics tab, in the shared PrestaChamps look.
 *
 * The design tokens (--gdpr-*) and the components (.gdpr-card, .gdpr-head,
 * .gdpr-body, .gdpr-btn, .gdpr-box, .gdpr-sect, .gdpr-lead, .gdpr-faint) come
 * from pch-ui.css; #gdpr-consent-stats carries the root class pch-ui. This file
 * keeps the page's own rules: the filters (the period buttons as pills), the
 * KPI tiles, the chart, the tables.
 *
 * The admin theme styles bare tags inside .bootstrap (h4, label, the .table
 * cells, .form-control, select) with one or two classes; rules on tags and form
 * controls therefore use the id-weight prefix :is(.pch-ui, #pch-ui), as
 * pch-ui.css does. Light only, as the back office is.
 *
 * The chart hues (accept blue, partial amber, reject red) come from the
 * controller's data-config: validated for colour-vision deficiency on white.
 */
.gdpr-stats { font-variant-numeric: tabular-nums; }
.gdpr-stats [hidden] { display: none !important; }

/* ------------------------------------------------------ card or card body
   On its own (the configuration page without the shell) the panel is a card.
   Inside a card of the configuration shell (#pch-config section.gdpr-card >
   .gdpr-body) it drops its frame, padding and heading: the shell's card head
   names the section. The panel's own card is a .gdpr-card too, so "nested"
   means a card around .gdpr-stats__card, not around its head or body. */
.pch-ui .gdpr-stats__body { gap: 18px; }
:is(.pch-ui, #pch-ui) :is(.gdpr-card, .pch-sect) .gdpr-stats__card { max-width: none; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
:is(.pch-ui, #pch-ui) :is(.gdpr-card, .pch-sect) .gdpr-stats__card > .gdpr-stats__head { display: none; }
:is(.pch-ui, #pch-ui) :is(.gdpr-card, .pch-sect) .gdpr-stats__card > .gdpr-stats__body { padding: 0; }

/* ---------------------------------------------------------------- filters */
.pch-ui .gdpr-stats__filters { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 14px; border: 1px solid var(--gdpr-line); border-radius: 10px; background: var(--gdpr-foot); }

/* The period buttons as pills; .active (set by consent-stats.js) is the chosen one. */
.gdpr-stats__ranges { display: flex; flex-wrap: wrap; gap: 8px; }
:is(.pch-ui, #pch-ui) .gdpr-stats__range { box-sizing: border-box; display: inline-flex; align-items: center; min-height: 36px; margin: 0; padding: 0 14px; border: 1.5px solid var(--gdpr-line-2); border-radius: 999px; background: #fff; color: var(--gdpr-ink-2); font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; text-transform: none; box-shadow: none; cursor: pointer; }
:is(.pch-ui, #pch-ui) .gdpr-stats__range:hover { border-color: var(--gdpr-off); background: var(--gdpr-ground); color: var(--gdpr-ink); }
:is(.pch-ui, #pch-ui) .gdpr-stats__range.active { border-color: var(--gdpr-acc-2); background: var(--gdpr-acc-soft); color: var(--gdpr-acc-ink); }
:is(.pch-ui, #pch-ui) .gdpr-stats__range:focus { outline: none; }
:is(.pch-ui, #pch-ui) .gdpr-stats__range:focus-visible { outline: 2px solid var(--gdpr-acc-2); outline-offset: 2px; }

/* Labelled fields in a row that wraps; the Show button sits on their baseline. */
.gdpr-stats__fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.gdpr-stats__field { display: flex; flex: 1 1 150px; flex-direction: column; gap: 4px; min-width: 0; }
:is(.pch-ui, #pch-ui) .gdpr-stats__field label { display: block; margin: 0; padding: 0; font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--gdpr-muted); }
:is(.pch-ui, #pch-ui) .gdpr-stats__field :is(input, select) { box-sizing: border-box; display: block; width: 100%; min-width: 0; height: 44px; margin: 0; padding: 0 12px; border: 1px solid var(--gdpr-line-2); border-radius: 10px; background-color: #fff; box-shadow: none; color: var(--gdpr-ink); font-family: inherit; font-size: 13px; line-height: 1.4; }
:is(.pch-ui, #pch-ui) .gdpr-stats__field select { -webkit-appearance: none; -moz-appearance: none; appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235d5d5d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; cursor: pointer; }
:is(.pch-ui, #pch-ui) .gdpr-stats__field :is(input, select):focus { outline: none; border-color: var(--gdpr-acc-2); box-shadow: 0 0 0 3px rgba(16, 163, 127, .16); }
:is(.pch-ui, #pch-ui) .gdpr-stats__apply { flex: none; }

/* ------------------------------------------------------------------- KPIs */
.gdpr-stats__kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gdpr-stats__kpis:empty { display: none; }
.gdpr-stats__kpi { box-sizing: border-box; min-width: 0; padding: 10px 12px; border: 1px solid var(--gdpr-line); border-radius: 10px; background: #fff; }
.gdpr-stats__kpi-label { display: flex; align-items: center; min-width: 0; font-size: 11px; font-weight: 700; line-height: 1.35; letter-spacing: .05em; text-transform: uppercase; color: var(--gdpr-faint); overflow-wrap: anywhere; }
.gdpr-stats__kpi-value { margin-top: 4px; font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--gdpr-ink); overflow-wrap: anywhere; }
.gdpr-stats__kpi-suffix { margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--gdpr-faint); }
.gdpr-stats__dot { flex: none; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; vertical-align: baseline; }

/* ---------------------------------------------------- blocks and headings */
.gdpr-stats__block { position: relative; min-width: 0; }
:is(.pch-ui, #pch-ui) .gdpr-stats__title { height: auto; margin: 0 0 8px; padding: 0; border: 0; background: none; font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.4; letter-spacing: .05em; text-transform: uppercase; white-space: normal; color: var(--gdpr-faint); }

/* ------------------------------------------------------------------ chart */
.gdpr-stats__legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.gdpr-stats__legend-item { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--gdpr-muted); }
/* One more class than .gdpr-faint (margin: 0), whichever stylesheet loads last. */
.pch-ui .gdpr-stats__block .gdpr-stats__notice { margin: 0 0 8px; }
.gdpr-stats__chart { position: relative; width: 100%; min-height: 120px; overflow-x: auto; }
/* Loading, no data: a quiet placeholder where the chart or the table goes. */
.pch-ui .gdpr-stats__state { margin: 0; padding: 24px 16px; border: 1px dashed var(--gdpr-line-2); border-radius: 10px; font-size: 13px; color: var(--gdpr-faint); text-align: center; }
.gdpr-stats__grid { stroke: var(--gdpr-soft); stroke-width: 1; }
.gdpr-stats__axis { stroke: var(--gdpr-line-2); stroke-width: 1; }
.gdpr-stats__tick { fill: var(--gdpr-faint); font-size: 11px; }
.gdpr-stats__bar-label { fill: var(--gdpr-ink-2); font-size: 11px; font-weight: 600; }
.gdpr-stats__hit { cursor: default; }

/* The hover card, as the (i) tip of pch-ui.css: dark, 10px corners. */
.gdpr-stats__tooltip { position: absolute; z-index: 20; box-sizing: border-box; padding: 8px 12px; border-radius: 10px; background: var(--gdpr-ink); box-shadow: 0 4px 14px rgba(13, 13, 13, .18); color: #fff; font-size: 12px; line-height: 1.6; white-space: nowrap; pointer-events: none; }
.gdpr-stats__tooltip strong { font-weight: 700; color: #fff; }
.gdpr-stats__tooltip-title { margin-bottom: 4px; font-weight: 700; }
.gdpr-stats__tooltip-total { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, .22); }

/* ------------------------------------------------------------------ tables
   The wizard's table look: 13px, faint uppercase header, 8px cells, a line
   between rows, numbers right-aligned in tabular figures. */
.gdpr-stats__scroll { min-width: 0; overflow-x: auto; }
:is(.pch-ui, #pch-ui) table.gdpr-stats__table { width: 100%; max-width: none; margin: 0; border: 0; border-collapse: collapse; background: none; font-size: 13px; }
:is(.pch-ui, #pch-ui) .gdpr-stats__table :is(th, td) { padding: 8px 10px; border: 0; border-bottom: 1px solid var(--gdpr-line); background: none; font-size: 13px; line-height: 1.4; text-align: left; vertical-align: middle; white-space: nowrap; }
:is(.pch-ui, #pch-ui) .gdpr-stats__table th { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gdpr-faint); }
/* The daily table: every column after the date holds a number. */
:is(.pch-ui, #pch-ui) .gdpr-stats__table th + th { text-align: right; }
:is(.pch-ui, #pch-ui) .gdpr-stats__table td { color: var(--gdpr-ink-2); }
:is(.pch-ui, #pch-ui) .gdpr-stats__table tbody tr:hover td { background: var(--gdpr-ground); }
:is(.pch-ui, #pch-ui) .gdpr-stats__table td.gdpr-stats__num { text-align: right; font-variant-numeric: tabular-nums; }
:is(.pch-ui, #pch-ui) .gdpr-stats__table tfoot td { border-top: 1px solid var(--gdpr-line-2); border-bottom: 0; font-weight: 700; color: var(--gdpr-ink); }
:is(.pch-ui, #pch-ui) .gdpr-stats__table .gdpr-stats__row-empty td { color: var(--gdpr-dim); }

/* "Showing the last 3 days" + the Show all / Show less button. */
.pch-ui .gdpr-stats__block .gdpr-stats__table-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 8px; }
.pch-ui .gdpr-stats__block .gdpr-stats__table-note:empty, .pch-ui .gdpr-stats__coverage:empty { display: none; }
.gdpr-stats__coverage strong { font-weight: 600; color: var(--gdpr-ink-2); }

@media (max-width: 559px) {
    .gdpr-stats__field { flex-basis: 130px; }
    :is(.pch-ui, #pch-ui) .gdpr-stats__apply { flex: 1 1 100%; }
    .gdpr-stats__kpi-value { font-size: 20px; }
    /* Six columns in a phone-wide card: narrower cells, headers on two lines. */
    :is(.pch-ui, #pch-ui) .gdpr-stats__table :is(th, td) { padding: 8px 6px; }
    :is(.pch-ui, #pch-ui) .gdpr-stats__table th { white-space: normal; }
}
