/**
 * GPL Times Download History - downloads-history.css (2.7.0)
 *
 * Loads only on /my-account/download-history/ (or a page holding the shortcode).
 * 2.7.0 (2026-10-02): rewritten in the My Account look - light cards with a 1px
 * #e2e8f0 border, list rows with a bar per month or day, pill buttons, no hover
 * lifts. The source chips and their CSS-only tooltip (2.5.x, chosen by the owner)
 * are unchanged apart from the table around them.
 *
 * Everything is scoped to .gdhist; the theme's table, list and heading rules are
 * reset where they reach in.
 */

.gdhist {
    --gdhist-ink: #0f1b2a;
    --gdhist-ink-2: #46556a;
    --gdhist-mute: #6b7a8f;
    --gdhist-line: #e2e8f0;
    --gdhist-line-soft: #edf1f5;
    --gdhist-brand: #1a8fc4;
    --gdhist-brand-dark: #0d7ab0;
    --gdhist-soft: #e8f3fb;
    --gdhist-text-muted: #6b7a8f;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin: 0;
    color: var(--gdhist-ink);
}

.gdhist :where(h2, p, ul, li) { margin: 0; padding: 0; }
.gdhist svg { display: block; flex: none; }

/* Notice (log-in prompt, unknown page) */
.gdhist .gdhist-notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid #f6dfb3; border-radius: 14px; background: #fff8eb; color: #8a4b08; font-size: 14.5px; line-height: 1.45; }
.gdhist-notice svg { width: 18px; height: 18px; }

/* Stat tiles */
.gdhist-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gdhist-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px; border: 1px solid var(--gdhist-line); border-radius: 16px; background: #ffffff; }
.gdhist-stat__top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.gdhist-stat__icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--gdhist-soft); color: var(--gdhist-brand-dark); }
.gdhist-stat__icon svg { width: 18px; height: 18px; }
.gdhist-stat.is-month .gdhist-stat__icon { background: #e8f7ee; color: #15803d; }
.gdhist-stat.is-total .gdhist-stat__icon { background: #f1ecfd; color: #6d28d9; }
.gdhist-stat__label { color: var(--gdhist-ink-2); font-size: 14px; font-weight: 700; line-height: 1.3; }
.gdhist-stat__value { overflow: hidden; color: var(--gdhist-ink); font-family: var(--gplt-font-heading); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gdhist-stat__detail { color: var(--gdhist-mute); font-size: 13px; line-height: 1.4; }

/* Card */
.gdhist-card { overflow: hidden; border: 1px solid var(--gdhist-line); border-radius: 18px; background: #ffffff; }
.gdhist-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 14px 20px; border-bottom: 1px solid var(--gdhist-line-soft); }
.gdhist h2.gdhist-card__title { width: auto; margin: 0; color: var(--gdhist-ink); font-size: 17px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; text-transform: none; }
.gdhist h2.gdhist-card__title::before,
.gdhist h2.gdhist-card__title::after { content: none; display: none; }
.gdhist-card__meta { color: var(--gdhist-mute); font-size: 13.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Month and day rows */
.gdhist ul.gdhist-rows,
.gdhist ul.gdhist-rows > li { margin: 0; padding: 0; list-style: none; }
.gdhist ul.gdhist-rows > li + li { border-top: 1px solid var(--gdhist-line-soft); }
.gdhist a.gdhist-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(80px, 1fr) 128px 88px 18px; align-items: center; gap: 16px; padding: 13px 20px; color: inherit; text-decoration: none; transition: background-color 0.15s ease; }
.gdhist a.gdhist-row:hover { background: #f6fafd; color: inherit; }
.gdhist a.gdhist-row:focus-visible { outline: 2px solid var(--gdhist-brand); outline-offset: -2px; }
.gdhist-row__label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; color: var(--gdhist-ink); font-size: 15px; font-weight: 700; line-height: 1.3; }
.gdhist-tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: var(--gdhist-soft); color: var(--gdhist-brand-dark); font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.gdhist-row__bar { display: block; height: 8px; overflow: hidden; border-radius: 999px; background: #eef3f8; }
.gdhist-row__bar > span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, #5cc0ea, #1a8fc4); }
.gdhist-row__count { color: var(--gdhist-ink-2); font-size: 14px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gdhist-row__count b { color: var(--gdhist-ink); font-size: 15px; font-weight: 800; }
.gdhist-row__unique { color: var(--gdhist-mute); font-size: 13.5px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gdhist-row__go { display: grid; place-items: center; color: #98a6b7; }
.gdhist-row__go svg { width: 18px; height: 18px; }
.gdhist a.gdhist-row:hover .gdhist-row__go { color: var(--gdhist-brand); }

.gdhist .gdhist-empty { padding: 22px 20px; }
.gdhist .gdhist-empty p { color: var(--gdhist-ink-2); font-size: 14.5px; line-height: 1.5; }

/* Pager */
.gdhist-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 20px; border-top: 1px solid var(--gdhist-line-soft); }
.gdhist .gdhist-pager__info { color: var(--gdhist-mute); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.gdhist-pager__nav { display: flex; flex-wrap: wrap; gap: 6px; }
.gdhist .gdhist-page { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 12px; border-radius: 50px; background: #ffffff; box-shadow: inset 0 0 0 1px #d5e0ea; color: var(--gdhist-ink); font-size: 14px; font-weight: 700; line-height: 1; text-decoration: none; transition: box-shadow 0.15s ease, color 0.15s ease; font-variant-numeric: tabular-nums; }
.gdhist a.gdhist-page:hover { box-shadow: inset 0 0 0 1px var(--gdhist-brand); color: var(--gdhist-brand-dark); }
.gdhist .gdhist-page.is-current { background: linear-gradient(180deg, #23a3dc, #1a8fc4); box-shadow: none; color: #ffffff; }
.gdhist .gdhist-page.is-dots { min-width: 0; padding: 0 4px; background: transparent; box-shadow: none; color: var(--gdhist-mute); }
.gdhist .gdhist-page.is-arrow { padding: 0; }
.gdhist-page svg { width: 16px; height: 16px; }

/* Back / previous / next */
.gdhist-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.gdhist-nav__step { display: flex; gap: 8px; }
.gdhist .gdhist-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 50px; font-size: 14px; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap; transition: box-shadow 0.15s ease, color 0.15s ease; }
.gdhist .gdhist-btn.is-ghost { background: #ffffff; box-shadow: inset 0 0 0 1px #c9dbe8; color: var(--gdhist-ink); }
.gdhist .gdhist-btn.is-ghost:hover { box-shadow: inset 0 0 0 1px var(--gdhist-brand); color: var(--gdhist-brand-dark); }
.gdhist .gdhist-btn.is-step { padding: 0 14px; color: var(--gdhist-ink-2); }
.gdhist .gdhist-btn:focus-visible,
.gdhist .gdhist-page:focus-visible { outline: 2px solid var(--gdhist-brand); outline-offset: 2px; }
.gdhist-btn svg { width: 16px; height: 16px; }

/* Day view: split by source, then the table */
.gdhist-split { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--gdhist-line-soft); background: #fbfcfe; }
.gdhist-split__item { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: #eef2f6; color: #475569; font-size: 12.5px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.gdhist-split__item b { font-weight: 800; font-variant-numeric: tabular-nums; }
.gdhist-split__item.is-updater { background: var(--gdhist-soft); color: var(--gdhist-brand-dark); }
.gdhist-split__item.is-woo { background: #e8f7ee; color: #2f7d54; }
.gdhist-split__note { margin-left: auto; color: var(--gdhist-mute); font-size: 12.5px; }

/* No sideways scroll: the table fits on desktop and stacks on phones, and a scrolling
   wrapper (or the card's overflow) would clip the site tooltip. */
.gdhist-table-wrapper { overflow: visible; }
.gdhist-card:has(.gdhist-table) { overflow: visible; }
.gdhist table.gdhist-table { width: 100%; margin: 0; border: 0; border-collapse: collapse; font-size: 14.5px; }
.gdhist table.gdhist-table th { padding: 10px 20px; border: 0; border-bottom: 1px solid var(--gdhist-line-soft); background: #f8fafc; color: var(--gdhist-mute); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.4; text-align: left; text-transform: uppercase; }
.gdhist table.gdhist-table td { padding: 11px 20px; border: 0; border-bottom: 1px solid var(--gdhist-line-soft); color: var(--gdhist-ink-2); font-size: 14.5px; line-height: 1.4; vertical-align: middle; }
.gdhist table.gdhist-table tbody tr:last-child td { border-bottom: 0; }
.gdhist table.gdhist-table tbody tr:hover td { background: #f6fafd; }
.gdhist .gdhist-table__name a,
.gdhist .gdhist-table__name span { color: var(--gdhist-ink); font-weight: 700; text-decoration: none; word-break: break-word; }
.gdhist .gdhist-table__name a:hover { color: var(--gdhist-brand-dark); }
.gdhist .gdhist-table__time { width: 1%; color: var(--gdhist-mute); font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gdhist .gdhist-table__source { width: 1%; white-space: nowrap; }

/* Source chips (2.5.x design, chosen by the owner). The chip carries the site it
   updated: inline on desktop, and in a CSS-only tooltip drawn from data-site that
   appears in ~90ms with no JavaScript. Source is the last column, so the tooltip is
   anchored to the chip's right edge and long domains grow leftwards. */
.gdhist table.gdhist-table tbody td .gdhist-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px 0 8px;
    border-radius: 13px;
    /* width and style only - the colour comes from the per-source rules below,
       which are less specific than this one and would lose to a shorthand */
    border-width: 1px;
    border-style: solid;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    vertical-align: middle;
}
.gdhist-chip svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.gdhist-chip-direct  { color: #4a5568; background: #fff; border-color: rgba(45, 55, 72, 0.16); }
.gdhist-chip-updater { color: var(--gdhist-brand); background: rgba(26, 143, 196, 0.06); border-color: rgba(26, 143, 196, 0.30); }
.gdhist-chip-woo     { color: #2f7d54; background: rgba(47, 125, 84, 0.06); border-color: rgba(47, 125, 84, 0.30); }

.gdhist table.gdhist-table tbody td .gdhist-chip-site {
    max-width: 180px;
    overflow: hidden;
    margin-left: 2px;
    padding-left: 6px;
    border-left: 1px solid rgba(26, 143, 196, 0.25);
    color: var(--gdhist-text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
}

/* the tooltip */
.gdhist-chip-has-site { cursor: default; }
.gdhist-chip-has-site::before,
.gdhist-chip-has-site::after {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 90ms ease-out, transform 90ms ease-out;
}
.gdhist-chip-has-site::after {
    content: attr(data-site);
    right: 0;
    bottom: calc(100% + 9px);
    z-index: 5;
    padding: 8px 10px;
    border-radius: 6px;
    background: #1f2937;
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.35);
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
}
.gdhist-chip-has-site::before {
    content: "";
    right: 14px;
    bottom: calc(100% + 4px);
    z-index: 5;
    border: 5px solid transparent;
    border-top-color: #1f2937;
    border-bottom: 0;
}
.gdhist-chip-has-site:hover::before,
.gdhist-chip-has-site:hover::after,
.gdhist-chip-has-site:focus-visible::before,
.gdhist-chip-has-site:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}
.gdhist-chip-has-site:focus-visible { outline: 2px solid var(--gdhist-brand); outline-offset: 2px; }

@media (max-width: 849px) {
    .gdhist a.gdhist-row { grid-template-columns: minmax(130px, 1fr) minmax(60px, 1fr) 118px 18px; }
    .gdhist-row__unique { display: none; }
}

/* Phones */
@media (max-width: 600px) {
    .gdhist { gap: 12px; }

    .gdhist-stats { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .gdhist-stat { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; row-gap: 0; align-items: center; padding: 12px 14px; }
    .gdhist-stat__top { display: contents; }
    .gdhist-stat__icon { grid-column: 1; grid-row: 1 / 3; }
    .gdhist-stat__label { grid-column: 2; grid-row: 1; }
    .gdhist-stat__detail { grid-column: 2; grid-row: 2; }
    .gdhist-stat__value { grid-column: 3; grid-row: 1 / 3; font-size: 20px; }

    .gdhist-card__head { padding: 12px 16px; }
    .gdhist a.gdhist-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label count" "bar bar"; gap: 8px 12px; padding: 12px 16px; }
    .gdhist-row__label { grid-area: label; }
    .gdhist-row__count { grid-area: count; }
    .gdhist-row__bar { grid-area: bar; height: 6px; }
    .gdhist-row__go { display: none; }

    .gdhist-pager { justify-content: center; padding: 12px 16px; }
    .gdhist .gdhist-pager__info { width: 100%; text-align: center; }

    .gdhist .gdhist-btn { height: 36px; padding: 0 14px; font-size: 13.5px; }
    .gdhist .gdhist-btn.is-step { padding: 0 12px; }

    .gdhist-split { padding: 10px 16px; }
    .gdhist-split__note { width: 100%; margin-left: 0; }

    .gdhist table.gdhist-table thead { display: none; }
    .gdhist table.gdhist-table,
    .gdhist table.gdhist-table tbody { display: block; }
    .gdhist table.gdhist-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--gdhist-line-soft); }
    .gdhist table.gdhist-table tbody tr:last-child { border-bottom: 0; }
    .gdhist table.gdhist-table td { display: block; width: auto; padding: 0; border: 0; }
    .gdhist .gdhist-table__name { grid-column: 1 / -1; }
    .gdhist .gdhist-table__time { grid-column: 1; }
    .gdhist .gdhist-table__source { grid-column: 2; justify-self: end; }
    .gdhist table.gdhist-table tbody tr:hover td { background: transparent; }

    /* the inline site would crowd the row: keep it in the tooltip, opened below */
    .gdhist table.gdhist-table tbody td .gdhist-chip-site { display: none; }
    .gdhist-chip-has-site::after { top: calc(100% + 9px); bottom: auto; }
    .gdhist-chip-has-site::before { top: calc(100% + 4px); bottom: auto; border-top: 0; border-bottom: 5px solid #1f2937; }
}

@media (prefers-reduced-motion: reduce) {
    .gdhist a.gdhist-row,
    .gdhist .gdhist-btn,
    .gdhist .gdhist-page,
    .gdhist-chip-has-site::before,
    .gdhist-chip-has-site::after { transition: none; }
}
