/**
 * Guardian Tickets widget styles.
 *
 * Every colour and radius is a custom property set on .cljgt, so the Elementor
 * style controls can override the whole widget by redefining a handful of
 * variables instead of chasing individual selectors.
 */

.cljgt {
    --cljgt-accent: #a6ce39;
    --cljgt-accent-soft: #f0f9e6;
    --cljgt-text: #4d4d4f;
    --cljgt-muted: #7a7a7c;
    --cljgt-surface: #ffffff;
    --cljgt-surface-alt: #f7f8f4;
    --cljgt-border: #dcddde;
    --cljgt-radius: 12px;

    --cljgt-used-bg: #f0f9e6;
    --cljgt-used-fg: #5c7a17;
    --cljgt-upcoming-bg: #e6f4fb;
    --cljgt-upcoming-fg: #04688f;
    --cljgt-unscheduled-bg: #fff4e2;
    --cljgt-unscheduled-fg: #8a5a11;
    --cljgt-cancelled-bg: #fdecef;
    --cljgt-cancelled-fg: #a32340;

    /* Circular arrow for the refresh button, as a mask so it follows currentColor. */
    --cljgt-refresh-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 12a8.5 8.5 0 1 1-2.6-6.1'/%3E%3Cpath d='M20.9 3.6v5.1h-5.1'/%3E%3C/svg%3E");

    color: var(--cljgt-text);
}

/* Filtering toggles the hidden attribute; themes that set display on sections
   would otherwise win over the browser default. */
.cljgt [hidden] {
    display: none !important;
}

.cljgt *,
.cljgt *::before,
.cljgt *::after {
    box-sizing: border-box;
}

.cljgt__title {
    margin: 0 0 20px;
    font-size: 24px;
    line-height: 1.3;
}

/* ── Summary tiles ───────────────────────────────────────────────────────── */

.cljgt__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.cljgt-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    background: var(--cljgt-surface-alt);
    border: 1px solid var(--cljgt-border);
    border-radius: var(--cljgt-radius);
}

.cljgt-tile__value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.cljgt-tile__label {
    font-size: 13px;
    color: var(--cljgt-muted);
}

.cljgt-tile--used .cljgt-tile__value { color: var(--cljgt-used-fg); }
.cljgt-tile--upcoming .cljgt-tile__value { color: var(--cljgt-upcoming-fg); }
.cljgt-tile--unscheduled .cljgt-tile__value { color: var(--cljgt-unscheduled-fg); }
.cljgt-tile--cancelled .cljgt-tile__value { color: var(--cljgt-cancelled-fg); }

/* ── Filters ─────────────────────────────────────────────────────────────── */

.cljgt__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.cljgt-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--cljgt-text);
    background: var(--cljgt-surface);
    border: 1px solid var(--cljgt-border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cljgt-filter:hover {
    border-color: var(--cljgt-accent);
}

.cljgt-filter.is-active {
    background: var(--cljgt-accent-soft);
    border-color: var(--cljgt-accent);
    font-weight: 600;
}

.cljgt-filter__count {
    font-size: 12px;
    color: var(--cljgt-muted);
}

.cljgt-filter.is-active .cljgt-filter__count {
    color: inherit;
}

/* ── Student and course cards ────────────────────────────────────────────── */

.cljgt-student {
    margin-bottom: 28px;
}

.cljgt-student:last-child {
    margin-bottom: 0;
}

.cljgt-student__header {
    margin-bottom: 12px;
}

.cljgt-student__name {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.cljgt-student__meta {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--cljgt-muted);
}

.cljgt-course {
    margin-bottom: 16px;
    background: var(--cljgt-surface);
    border: 1px solid var(--cljgt-border);
    border-radius: var(--cljgt-radius);
    overflow: hidden;
}

/* The gap between cards belongs to the list, not to each card, so the last
   one does not have to cancel its own margin — which left it flush against
   the footnote underneath. */
.cljgt__students > :last-child .cljgt-course:last-child {
    margin-bottom: 0;
}

.cljgt-course__header {
    padding: 16px 18px;
    background: var(--cljgt-surface-alt);
    border-bottom: 1px solid var(--cljgt-border);
}

.cljgt-course__name {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
}

.cljgt-course__dates {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--cljgt-muted);
}

/* ── Progress ────────────────────────────────────────────────────────────── */

.cljgt-progress {
    margin-top: 12px;
}

.cljgt-progress__track {
    height: 6px;
    background: var(--cljgt-border);
    border-radius: 999px;
    overflow: hidden;
}

.cljgt-progress__bar {
    display: block;
    height: 100%;
    background: var(--cljgt-accent);
    border-radius: inherit;
}

.cljgt-progress__label {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--cljgt-muted);
}

.cljgt-progress__extra {
    color: var(--cljgt-unscheduled-fg);
}

/* ── Class rows ──────────────────────────────────────────────────────────── */

.cljgt-course__classes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cljgt-class {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--cljgt-border);
    font-size: 14px;
}

.cljgt-class:last-child {
    border-bottom: none;
}

.cljgt-class--cancelled .cljgt-class__date {
    text-decoration: line-through;
}

.cljgt-class__when {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.cljgt-class__date {
    font-weight: 600;
}

.cljgt-class__date--muted {
    font-weight: 400;
    color: var(--cljgt-muted);
}

.cljgt-class__time {
    color: var(--cljgt-muted);
}

.cljgt-class__tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.cljgt-class__duration {
    font-size: 12px;
    color: var(--cljgt-muted);
}

.cljgt-badge {
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    white-space: nowrap;
}

.cljgt-badge--makeup {
    color: #6b4e00;
    background: #fff2cc;
}

.cljgt-status {
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

.cljgt-status--used {
    color: var(--cljgt-used-fg);
    background: var(--cljgt-used-bg);
}

.cljgt-status--upcoming {
    color: var(--cljgt-upcoming-fg);
    background: var(--cljgt-upcoming-bg);
}

.cljgt-status--unscheduled {
    color: var(--cljgt-unscheduled-fg);
    background: var(--cljgt-unscheduled-bg);
}

.cljgt-status--cancelled {
    color: var(--cljgt-cancelled-fg);
    background: var(--cljgt-cancelled-bg);
}

/* ── Notices, footnote, loading ──────────────────────────────────────────── */

.cljgt-notice {
    padding: 16px 18px;
    background: var(--cljgt-surface-alt);
    border: 1px solid var(--cljgt-border);
    border-left: 4px solid var(--cljgt-accent);
    border-radius: var(--cljgt-radius);
}

.cljgt-notice p {
    margin: 0;
}

.cljgt-notice--error {
    border-left-color: #f04e69;
}

.cljgt-notice--warning {
    border-left-color: #faa634;
}

.cljgt__footnote {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 0;
    font-size: 12px;
    color: var(--cljgt-muted);
}

/* The theme's form reset (hello-elementor and most of its peers) styles bare
   `button` elements and their :hover, at a specificity this single class
   cannot beat from an earlier stylesheet. Every declaration here is therefore
   !important: without it the button inherits the theme's fill, border and
   colours and stops matching the rest of the widget. */
.cljgt .cljgt__refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px !important;
    font: inherit;
    font-size: 14px !important;
    line-height: 1.4;
    width: auto !important;
    color: var(--cljgt-text) !important;
    background-color: var(--cljgt-surface) !important;
    border: 1px solid var(--cljgt-border) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    text-transform: none !important;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.cljgt__refresh::before {
    content: "";
    flex: none;
    width: 13px;
    height: 13px;
    background-color: currentColor;
    /* Circular arrow, drawn from a mask so it inherits the text colour. */
    -webkit-mask: var(--cljgt-refresh-icon) center / contain no-repeat;
    mask: var(--cljgt-refresh-icon) center / contain no-repeat;
}

.cljgt .cljgt__refresh:hover,
.cljgt .cljgt__refresh:focus {
    color: var(--cljgt-accent) !important;
    border-color: var(--cljgt-accent) !important;
    background-color: var(--cljgt-accent-soft) !important;
}

.cljgt .cljgt__refresh:focus-visible {
    outline: 2px solid var(--cljgt-accent);
    outline-offset: 2px;
}

.cljgt .cljgt__refresh[disabled] {
    opacity: 0.5;
    cursor: default;
    color: var(--cljgt-muted) !important;
    background-color: var(--cljgt-surface) !important;
    border-color: var(--cljgt-border) !important;
}

/* Spinning while the panel it belongs to is fetching. */
.cljgt__panel.is-loading .cljgt__refresh::before {
    animation: cljgt-spin 0.8s linear infinite;
}

@keyframes cljgt-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cljgt__panel.is-loading .cljgt__refresh::before {
        animation: none;
    }
}

.cljgt__panel.is-loading {
    opacity: 0.6;
}

.cljgt-skeleton {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cljgt-skeleton__line {
    display: block;
    height: 44px;
    background: var(--cljgt-surface-alt);
    border: 1px solid var(--cljgt-border);
    border-radius: var(--cljgt-radius);
    animation: cljgt-pulse 1.4s ease-in-out infinite;
}

.cljgt-skeleton__line:nth-child(3) { animation-delay: 0.15s; }
.cljgt-skeleton__line:nth-child(4) { animation-delay: 0.3s; }

@keyframes cljgt-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
    .cljgt-skeleton__line {
        animation: none;
    }
}

/* ── Narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .cljgt-class {
        align-items: flex-start;
        flex-direction: column;
    }

    .cljgt-class__tags {
        margin-left: 0;
    }
}
