/*
 * GLTA WTC Invitations UI: the small component set behind the plugin's pages on glta.net
 * (player page, public list). Everything sits under .gwi so the theme's styles and these never
 * collide; the font comes from the theme. Preview with every component: docs/ui-preview.html.
 */

.gwi {
    --gwi-accent: #b51279; /* glta.net's primary color (theme setting colormag_primary_color) */
    --gwi-accent-soft: #fbe8f3;
    --gwi-on-accent: #ffffff;
    --gwi-blue: #0092bc; /* the logo's blue, for fills */
    --gwi-blue-ink: #00739a; /* the same blue, dark enough for text */
    --gwi-blue-soft: #e2f3f9;
    --gwi-ink: #1d1d1b;
    --gwi-quiet: #6b6a65;
    --gwi-rule: #e2e0d9;
    --gwi-panel: #ffffff;
    --gwi-soft: #f4f3ef;
    --gwi-good: #1f7a4a;
    --gwi-good-soft: #e3f3e9;
    --gwi-warn: #9a5b00;
    --gwi-warn-soft: #fbf0dc;
    --gwi-bad: #a33a32;
    --gwi-bad-soft: #f8e6e4;
    --gwi-mute-soft: #efeee9;
    --gwi-radius: 10px;

    color: var(--gwi-ink);
    line-height: 1.5;
}

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

/* Card: one block of content, such as one event on the player page. */
.gwi .gwi-card {
    background: var(--gwi-panel);
    border: 1px solid var(--gwi-rule);
    border-radius: var(--gwi-radius);
    padding: 16px 18px;
    margin: 0 0 12px;
}

.gwi .gwi-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
}

.gwi .gwi-card__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.gwi .gwi-card__sub {
    margin: 4px 0 12px;
    color: var(--gwi-quiet);
    font-size: 14px;
}

.gwi .gwi-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Buttons. */
.gwi .gwi-btn {
    display: inline-block;
    margin: 0;
    padding: 9px 16px;
    border: 1px solid var(--gwi-rule);
    border-radius: 8px;
    background: var(--gwi-panel);
    color: var(--gwi-ink);
    font: inherit;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
}

.gwi .gwi-btn:hover {
    background: var(--gwi-mute-soft);
}

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

.gwi .gwi-btn--primary {
    background: var(--gwi-accent);
    border-color: var(--gwi-accent);
    color: var(--gwi-on-accent);
}

.gwi .gwi-btn--primary:hover {
    background: var(--gwi-accent);
    filter: brightness(0.92);
}

.gwi .gwi-btn--small {
    padding: 6px 11px;
    font-size: 14px;
}

.gwi .gwi-btn:disabled,
.gwi .gwi-btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Status chips, one per status. Waiting uses the logo's blue: magenta means act now, blue means wait. */
.gwi .gwi-chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.gwi .gwi-chip--line {
    background: var(--gwi-blue-soft);
    color: var(--gwi-blue-ink);
}

.gwi .gwi-chip--offered {
    background: var(--gwi-warn-soft);
    color: var(--gwi-warn);
}

.gwi .gwi-chip--confirmed {
    background: var(--gwi-good-soft);
    color: var(--gwi-good);
}

/* "Not playing": declined, swapped, unpaid in time, or not joined in time. Gray, not red: no fault implied. */
.gwi .gwi-chip--declined {
    background: var(--gwi-soft);
    color: var(--gwi-quiet);
}

/* "May swap": a player registered here who may still give it up for another event, so the place may free up. */
.gwi .gwi-chip--maybe {
    background: transparent;
    border: 1px solid var(--gwi-blue);
    color: var(--gwi-blue-ink);
    padding: 1px 8px;
}

/* Live countdown, filled in by ui.js from data-gwi-deadline. */
.gwi .gwi-countdown {
    color: var(--gwi-quiet);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gwi .gwi-countdown--soon {
    color: var(--gwi-bad);
    font-weight: 600;
}

/* Notices: the result of an action, or something the player must know. */
.gwi .gwi-notice {
    margin: 0 0 16px;
    padding: 12px 16px;
    border-radius: var(--gwi-radius);
    background: var(--gwi-soft);
}

.gwi .gwi-notice--info {
    background: var(--gwi-blue-soft);
    color: var(--gwi-blue-ink);
}

.gwi .gwi-notice--good {
    background: var(--gwi-good-soft);
    color: var(--gwi-good);
    font-weight: 600;
}

.gwi .gwi-notice--warn {
    background: var(--gwi-warn-soft);
    color: var(--gwi-warn);
}

.gwi .gwi-notice--bad {
    background: var(--gwi-bad-soft);
    color: var(--gwi-bad);
}

/* Tabs: one per event on the public list. */
.gwi .gwi-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.gwi .gwi-tabs button {
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--gwi-rule);
    border-radius: 999px;
    background: var(--gwi-panel);
    color: var(--gwi-ink);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.gwi .gwi-tabs button[aria-selected="true"] {
    background: var(--gwi-ink);
    border-color: var(--gwi-ink);
    color: var(--gwi-panel);
}

/* Event filters: a light panel of segmented controls (category, level, singles or doubles). */
.gwi .gwi-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 40px;
    margin: 12px 0 24px;
    padding: 18px 20px;
    border: 1px solid var(--gwi-rule);
    border-radius: 14px;
    background: var(--gwi-soft);
}

.gwi .gwi-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.gwi .gwi-filter__label {
    color: var(--gwi-quiet);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gwi .gwi-segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--gwi-rule);
    border-radius: 999px;
    background: var(--gwi-panel);
}

.gwi .gwi-segmented button {
    margin: 0;
    padding: 7px 16px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--gwi-ink);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.gwi .gwi-segmented button:hover {
    background: var(--gwi-mute-soft);
}

.gwi .gwi-segmented button[aria-pressed="true"] {
    background: var(--gwi-ink);
    color: var(--gwi-panel);
}

.gwi .gwi-segmented button:disabled {
    background: none;
    color: var(--gwi-rule);
    cursor: not-allowed;
}

.gwi .gwi-segmented button:focus-visible {
    outline: 2px solid var(--gwi-accent);
    outline-offset: 2px;
}

.gwi .gwi-panel-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

/* The Women and All Gender headings between the tables of a mixed event. */
.gwi .gwi-subtitle {
    margin: 32px 0 12px;
}

/* A full-width picture opening a page, such as the Perth banner on the public list. */
.gwi .gwi-header {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 0 20px;
    border-radius: var(--gwi-radius);
}

/* Key figures above a list, such as places and players confirmed. */
.gwi .gwi-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0 0 12px;
    color: var(--gwi-quiet);
    font-size: 14px;
}

.gwi .gwi-facts b {
    color: var(--gwi-ink);
}

/* Table: the public list. The wrapper scrolls sideways on phones instead of the page. */
.gwi .gwi-table-wrap {
    overflow-x: auto;
}

/* Fixed column widths, so the Women and All Gender tables of an event line up. */
.gwi .gwi-table {
    width: 100%;
    min-width: 420px;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 15px;
}

.gwi .gwi-table:has(th:nth-child(4)) {
    min-width: 680px;
}

.gwi .gwi-table th:first-child {
    width: 72px;
}

.gwi .gwi-table th:nth-child(3) {
    width: 96px;
}

.gwi .gwi-table th:nth-child(4) {
    width: 45%;
}

/* A long name wraps inside its column instead of running into the country. */
.gwi .gwi-table td:nth-child(2) {
    white-space: normal;
    overflow-wrap: anywhere;
}

.gwi .gwi-table th,
.gwi .gwi-table td {
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid var(--gwi-rule);
    background: none;
    text-align: left;
    white-space: nowrap;
}

.gwi .gwi-table th {
    color: var(--gwi-quiet);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gwi .gwi-table .gwi-num {
    color: var(--gwi-quiet);
    font-variant-numeric: tabular-nums;
}

.gwi .gwi-legend {
    margin-top: 12px;
    color: var(--gwi-quiet);
    font-size: 13px;
}

/* The payment dialog: Zeffy's form over the player's page; ui.js sets the form's height from Zeffy's messages. */
.gwi .gwi-modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 16px 18px; border: 0; border-radius: 12px; color: var(--gwi-ink); background: var(--gwi-panel); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); }
.gwi .gwi-modal[open] { display: grid; gap: 10px; }
.gwi .gwi-modal::backdrop { background: rgba(29, 29, 27, 0.55); }
.gwi .gwi-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gwi .gwi-modal__title { margin: 0; font-size: 1.15em; }
.gwi .gwi-modal__head form { margin: 0; }
.gwi .gwi-modal__close { width: 36px; height: 36px; padding: 0; border: 1px solid var(--gwi-rule); border-radius: 8px; background: var(--gwi-panel); color: var(--gwi-ink); font-size: 22px; line-height: 1; cursor: pointer; }
.gwi .gwi-modal__close:hover { border-color: var(--gwi-accent); color: var(--gwi-accent); }
.gwi .gwi-pay__frame { width: 100%; min-height: 480px; border: 0; border-radius: 8px; }
.gwi .gwi-pay__status { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--gwi-blue-soft); color: var(--gwi-blue-ink); font-weight: 600; }

/* "I'll play" on an invitation: a checkbox dressed as a button, magenta once chosen (ui.js sets --on). */
.gwi .gwi-toggle { display: inline-flex; align-items: center; gap: 8px; }
.gwi .gwi-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--gwi-accent); }
.gwi .gwi-toggle--on { border-color: var(--gwi-accent); background: var(--gwi-accent-soft); color: var(--gwi-accent); }
.gwi .gwi-toggle:has(input:focus-visible) { outline: 2px solid var(--gwi-accent); outline-offset: 2px; }
.gwi .gwi-toggle--off { opacity: 0.45; cursor: not-allowed; } /* A third event while two are registered or chosen. */

/* The payment under the cards: what the player chose, and one button for it. */
.gwi .gwi-paybar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 14px 18px; border: 1px solid var(--gwi-accent); border-radius: 10px; background: var(--gwi-accent-soft); }
.gwi .gwi-paybar__text { flex: 1 1 260px; min-width: 0; margin: 0; font-weight: 600; }
