/*
 * Coupon table styles for [summoners_war_codes].
 *
 * Inherits GeneratePress typography and color tokens via var(--gp-*).
 * Each var() ships a sensible fallback so the table degrades gracefully on
 * GP versions that have not exposed that particular custom property.
 */

.swc-coupons-wrapper {
    width: 100%;
    margin: 2em 0 2em;
    overflow-x: auto;
    font-family: var(--gp-font-family-body, inherit);
    color: var(--gp-text-color, inherit);
    /* Slim 1px outline + soft elevation so the table reads as a distinct card.
     * Explicit border-bottom guards against parent themes that strip the
     * shorthand on the wrapper element. */
    border: 1px solid #0d6efd !important;
    border-bottom: 1px solid #0d6efd !important;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    /* Clip the inner table to the rounded corners */
    overflow: hidden;
    overflow-x: auto;
}

table.swc-coupons {
    width: 100%;
    margin: 0 !important;
    border-collapse: collapse;
    background: var(--gp-background-color, transparent);
    font-size: var(--gp-font-size-body, 1rem);
    line-height: 1.5;
}

table.swc-coupons thead th {
    text-align: left;
    padding: 0.85em 1em;
    /* Tint header with the accent so it stands out from row cells */
    background: rgba(74, 141, 247, 0.12);
    /* Single 1px underline — match the wrapper border weight. */
    border-bottom: 1px solid #0d6efd !important;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--gp-text-color, #111);
}

table.swc-coupons tbody td {
    padding: 0.8em 1em;
    /* Force-kill any parent-theme top border so the thead underline is the
     * only line between header and the first body row. */
    border-top: 0 !important;
    border-bottom: 1px solid var(--swc-border, #e5e7eb);
    vertical-align: middle;
}

/* Defensive override: some parent themes add border-top on tbody rows. */
table.swc-coupons tbody tr,
table.swc-coupons tbody tr:first-child,
table.swc-coupons tbody tr:first-child td {
    border-top: 0 !important;
}

/* Last row sits flush with the wrapper border — drop the cell underline */
table.swc-coupons tbody tr:last-child td {
    border-bottom: 0;
}

table.swc-coupons tbody tr.swc-row:hover {
    background: var(--swc-row-hover, #f9fafb);
}

table.swc-coupons tbody tr.swc-expired td {
    color: var(--swc-muted, #6b7280);
}

table.swc-coupons tbody tr.swc-expired .swc-code,
table.swc-coupons tbody tr.swc-expired .swc-cell-rewards {
    text-decoration: line-through;
}

/* Code cell ----------------------------------------------------------------- */

.swc-cell-code {
    white-space: nowrap;
}

.swc-code {
    display: inline-block;
    padding: 0.2em 0.55em;
    border-radius: 4px;
    background: var(--gp-content-background-color, #f3f4f6);
    border: 1px solid var(--swc-border, #e5e7eb);
    font-family: var(--gp-font-family-monospace, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
    font-size: 0.95em;
    margin-right: 0.5em;
}

.swc-copy-btn {
    appearance: none;
    -webkit-appearance: none;
    background: var(--swc-accent, #4a8df7);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 0.3em 0.75em;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s ease;
}

.swc-copy-btn:hover,
.swc-copy-btn:focus {
    background: var(--swc-accent-strong, #2563eb);
    outline: 0;
}

.swc-copy-btn.is-copied {
    background: var(--swc-success, #16a34a);
}

/* Reward cell --------------------------------------------------------------- */

.swc-cell-rewards {
    color: var(--gp-text-color, inherit);
}

.swc-muted {
    color: var(--swc-muted, #6b7280);
    font-style: italic;
}

/* Time cell ----------------------------------------------------------------- */

.swc-cell-time {
    color: var(--swc-muted, #6b7280);
    white-space: nowrap;
}

/* Status badges ------------------------------------------------------------- */

.swc-badge {
    display: inline-block;
    padding: 0.15em 0.65em;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1.5;
}

.swc-badge-active {
    background: rgba(22, 163, 74, 0.12);
    color: var(--swc-success, #16a34a);
}

.swc-badge-expired {
    background: rgba(107, 114, 128, 0.15);
    color: var(--swc-muted, #6b7280);
}

/* Empty state --------------------------------------------------------------- */

.swc-empty {
    padding: 1em 1.25em;
    margin: 1.5em 0;
    background: var(--gp-content-background-color, #f8f9fa);
    border: 1px dashed var(--swc-border, #e5e7eb);
    border-radius: 6px;
    color: var(--swc-muted, #6b7280);
    text-align: center;
}

/* List format (`format="list"`) --------------------------------------------- */

ul.swc-coupons-list {
    margin: 1em 0;
    padding-left: 1.25em;
    list-style: disc;
    line-height: 1.6;
}

ul.swc-coupons-list li {
    margin-bottom: 0.4em;
}

ul.swc-coupons-list li.swc-expired .swc-code,
ul.swc-coupons-list li.swc-expired .swc-list-rewards {
    text-decoration: line-through;
    color: var(--swc-muted, #6b7280);
}

.swc-list-rewards {
    color: var(--gp-text-color, inherit);
}

.swc-list-time {
    margin-left: 0.35em;
    color: var(--swc-muted, #6b7280);
    font-size: 0.85em;
}

/* Inline format (`format="inline"` / `"comma"`) ----------------------------- */

.swc-coupons-inline {
    display: inline;
    line-height: 1.6;
}

.swc-coupons-inline strong,
.swc-coupons-inline code,
.swc-coupons-inline b,
.swc-coupons-inline em {
    margin: 0 0.05em;
}

/* "new!" badge --------------------------------------------------------------- */

.swc-new-badge {
    display: inline-block;
    margin-left: 0.35em;
    padding: 0.05em 0.45em;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

/* Toast --------------------------------------------------------------------- */

.swc-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    padding: 0.6em 1.1em;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.swc-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive: <600px stacks each row as a card --------------------------- */

@media (max-width: 600px) {
    /* Drop the wrapper outline at this breakpoint — cards carry their own */
    .swc-coupons-wrapper {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    table.swc-coupons thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    table.swc-coupons tbody tr.swc-row {
        display: block;
        margin-bottom: 1em;
        border: 1px solid #0d6efd !important;
        border-radius: 10px;
        overflow: hidden;
        background: var(--gp-background-color, #fff);
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    }

    table.swc-coupons tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75em;
        padding: 0.65em 1em;
        border-bottom: 1px solid var(--swc-border, #e5e7eb);
    }

    table.swc-coupons tbody td:last-child {
        border-bottom: 0;
    }

    table.swc-coupons tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gp-text-color, #111);
        flex-shrink: 0;
    }

    .swc-cell-code {
        flex-wrap: wrap;
    }
}
