/* HJ Bonus Points — front-end styles */

:root {
    --hjbp-btn-bg: #ca0000;          /* shophjk red */
    --hjbp-btn-bg-hover: #b8050f;
    --hjbp-btn-fg: #ffffff;
    --hjbp-btn-disabled-bg: #c8c8c8;
    --hjbp-btn-disabled-fg: #ffffff;
    --hjbp-card-border: #e3e3e3;
    --hjbp-card-bg: #ffffff;
    --hjbp-card-radius: 8px;
}

.hjbp-balance-line {
    font-size: 1.1em;
    margin-bottom: 1em;
}

.hjbp-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* Desktop: 4 columns. Tablet: 2. Mobile: 1. */
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .hjbp-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .hjbp-grid {
        grid-template-columns: 1fr;
    }
}

.hjbp-card {
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 1;
}

.hjbp-card:hover,
.hjbp-card:focus-within,
.hjbp-card.is-popover-open {
    z-index: 199;
}

.hjbp-card .hjbp-info-btn {
    position: absolute;
    top: .7rem;
    right: .7rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 1px solid #c0c0c0;
    border-radius: 50%;
    background: transparent;
    color: #888;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-weight: 600;
    font-size: .75rem;
    line-height: 1;
    text-align: center;
    text-transform: none;
    cursor: pointer;
    z-index: 3;
    box-shadow: none;
    opacity: .7;
    transition: opacity .15s ease, color .15s ease, border-color .15s ease, background-color .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.hjbp-card .hjbp-info-btn > span {
    display: block;
    line-height: 1;
}

.hjbp-card .hjbp-info-btn:hover,
.hjbp-card .hjbp-info-btn:focus {
    background: transparent;
    color: #444;
    border-color: #888;
    outline: none;
    opacity: 1;
}

.hjbp-card .hjbp-card-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    right: .4rem;
    left: auto;
    max-width: 260px;
    min-width: 200px;
    width: max-content;
    padding: .7rem .85rem;
    background: #2a2a2a;
    color: #fff;
    font-size: .8rem;
    line-height: 1.45;
    text-align: left;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
    z-index: 9999;
    pointer-events: none;
}

.hjbp-card .hjbp-card-popover::after {
    content: "";
    position: absolute;
    bottom: -5px;
    right: 1rem;
    width: 10px;
    height: 10px;
    background: #2a2a2a;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, .08);
}

.hjbp-card .hjbp-info-btn:hover + .hjbp-card-popover,
.hjbp-card .hjbp-info-btn:focus + .hjbp-card-popover,
.hjbp-card .hjbp-card-popover:hover,
.hjbp-card .hjbp-card-popover.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.hjbp-card.is-disabled .hjbp-card-image,
.hjbp-card.is-disabled .hjbp-card-title,
.hjbp-card.is-disabled .hjbp-card-foot {
    opacity: 0.55;
}

/* Uniform square image area regardless of source aspect ratio. */
.hjbp-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hjbp-card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.hjbp-card-title {
    font-size: 1rem!important;
    margin: 0;
    line-height: 1.3;
    /* Reserve roughly two lines so cards stay aligned. */
    min-height: 2.6em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hjbp-card-excerpt {
    font-size: .85rem;
    line-height: 1.4;
    color: #555;
    margin: 0;
    /* Push the cost + button group to the bottom. */
    flex-grow: 1;
    display:none;
}

.hjbp-card-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    align-items: stretch;
}

.hjbp-card-cost {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
}

.hjbp-redeem-btn.button {
    display: inline-block;
    width: 100%;
    padding: .65rem 1rem;
    background: var(--hjbp-btn-bg);
    color: var(--hjbp-btn-fg);
    border: 0;
    border-radius: 4px;
    font-weight: 700;
    text-transform: none;
    cursor: pointer;
    transition: background-color .15s ease;
}

.hjbp-redeem-btn.button:hover,
.hjbp-redeem-btn.button:focus {
    background: var(--hjbp-btn-bg-hover);
    color: var(--hjbp-btn-fg);
}

.hjbp-redeem-btn[disabled],
.hjbp-redeem-btn.button[disabled] {
    background: var(--hjbp-btn-disabled-bg);
    color: var(--hjbp-btn-disabled-fg);
    cursor: not-allowed;
}

.hjbp-redeem-msg {
    display: block;
    font-size: .85em;
    min-height: 1.1em;
}

.hjbp-redeem-lottie {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    pointer-events: none;
    z-index: 2;
    opacity: 1;
    transition: opacity .6s ease;
}

.hjbp-redeem-lottie.is-entering {
    opacity: 0;
}

.hjbp-redeem-lottie.is-leaving {
    opacity: 0;
}

.hjbp-redeem-msg.is-success { color: #2e7d32; }
.hjbp-redeem-msg.is-error   { color: #c62828; }

.hjbp-account .hjbp-summary {
    margin: 0 0 1.75rem;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid var(--hjbp-card-border);
    border-radius: var(--hjbp-card-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.hjbp-summary-lottie {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 90px;
    height: 90px;
    pointer-events: none;
    z-index: 1;
    opacity: .95;
}

@media (max-width: 480px) {
    .hjbp-summary-lottie {
        width: 64px;
        height: 64px;
        top: -4px;
        right: -4px;
    }
}

.hjbp-summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    border-left: 3px solid var(--hjbp-btn-bg);
    padding-left: .85rem;
}

.hjbp-summary-item:first-child {
    /* Optional: keep border on first item too for consistency */
}

.hjbp-summary-label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    font-weight: 600;
}

.hjbp-summary-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.1;
    color: #222;
}

.hjbp-summary-unit {
    font-size: .85rem;
    color: #777;
}

.hjbp-ledger.shop_table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--hjbp-card-border);
    border-radius: var(--hjbp-card-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin: 0 0 1rem;
}

.hjbp-ledger.shop_table thead th {
    background: #fafafa;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    font-weight: 600;
    text-align: left;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--hjbp-card-border);
}

.hjbp-ledger.shop_table tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: .95rem;
    color: #333;
}

.hjbp-ledger.shop_table tbody tr:last-child td {
    border-bottom: 0;
}

.hjbp-ledger.shop_table tbody tr:hover td {
    background: #fafafa;
}

.hjbp-ledger .hjbp-delta {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hjbp-ledger .hjbp-delta-pos { color: #2e7d32; }
.hjbp-ledger .hjbp-delta-neg { color: #c62828; }

.hjbp-ledger td a {
    color: var(--hjbp-btn-bg);
    text-decoration: none;
    font-weight: 600;
}

.hjbp-ledger td a:hover {
    text-decoration: underline;
}

.hjbp-pagination {
    margin-top: 1rem;
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.hjbp-pagination .hjbp-page {
    display: inline-block;
    padding: .35rem .7rem;
    border: 1px solid var(--hjbp-card-border);
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    background: #fff;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.hjbp-pagination .hjbp-page:hover {
    background: #fafafa;
    border-color: #bbb;
}

.hjbp-pagination .hjbp-page.current {
    background: var(--hjbp-btn-bg);
    color: #fff;
    border-color: var(--hjbp-btn-bg);
}

/* "Bonuspoint brugt" row in cart / checkout order-review tables. */
.hjbp-points-summary > th,
.hjbp-points-summary > td {
    border-top: 1px solid var(--hjbp-card-border);
    padding-top: .9rem;
    padding-bottom: .9rem;
    vertical-align: middle;
}

.hjbp-points-summary > th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    font-weight: 600;
}

.hjbp-points-summary .hjbp-points-amount {
    display: inline-flex;
    align-items: baseline;
    gap: .35rem;
    white-space: nowrap;
    padding: .25rem .65rem;
    border-radius: 999px;
    background: rgba(202, 0, 0, .08);
    color: var(--hjbp-btn-bg);
    font-variant-numeric: tabular-nums;
}

.hjbp-points-summary .hjbp-points-value {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.hjbp-points-summary .hjbp-points-unit {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Bonus line items in the cart / checkout order-review table. */
.hjbp-bonus-row > td {
    background: rgba(202, 0, 0, .04);
    border-left: 3px solid var(--hjbp-btn-bg);
}

.hjbp-bonus-row > td:first-child {
    /* Keep the colored left bar on the first cell only. */
    padding-left: 1rem;
}

.hjbp-bonus-row > td:not(:first-child) {
    border-left: 0;
}

.hjbp-bonus-badge {
    display: inline-block;
    padding: .15rem .55rem;
    margin-right: .35rem;
    border-radius: 999px;
    background: var(--hjbp-btn-bg);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    vertical-align: middle;
    line-height: 1.4;
}

/* Cart-item meta line (the "Pris: 2500 point" entry from get_item_data). */
.hjbp-bonus-row .wc-item-meta,
.hjbp-bonus-row .variation,
.hjbp-bonus-row dl.variation {
    color: var(--hjbp-btn-bg);
    font-weight: 600;
}
