/**
 * 2010-2026 SwissGeek | Web Developer Freelance
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to a commercial proprietary license (EULA)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available worldwide at this URL:
 * https://swissgeek.dev/license/
 * If you did not receive a copy of the license and are unable to obtain it
 * online, please send an email to license@swissgeek.dev so we can send you
 * a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop or PhenixSuite to newer
 * versions in the future. If you wish to customize PrestaShop or PhenixSuite for your
 * needs please refer to https://www.prestashop.com or https://www.phenixsuite.com for more information.
 *
 * @Module       SGK Custom Wallet
 * @Description  Store-credit wallet, gift cards and referrals for PrestaShop 1.7, 8 and 9.
 * @Version      1.9.7
 * @Copyright    Copyright (c) 2010-2026 - SwissGeek | Web Developer Freelance <https://swissgeek.dev/> Tous droits réservés.
 * @Support      Support Requests <https://admin.swissgeek.dev/forms/ticket?styled=1&with_logo=1>
 * @Blog         Breaking News <https://news.swissgeek.dev/> <https://news.prestageek.ch/>
 * @Addons       Developments <https://prestageek.ch/> <https://add.swissgeek.dev/>
 *
 * @License      Valid for 1 website (or project) for each purchase of license. International Registered Trademark & Property of SwissGeek. More information on <https://swissgeek.dev/license/>
 */

.sgkw-wallet {
    --sgkw-accent: var(--color-primary, #D41414);     /* theme primary, SwissGeek red fallback */
    --sgkw-accent-soft: #FCEAEA;
    --sgkw-text: var(--text-color, #232323);
    --sgkw-muted: #7a7a7a;
    --sgkw-border: #e6e6e6;
    --sgkw-surface: #ffffff;
    --sgkw-surface-alt: #f6f8f9;
    --sgkw-radius: 10px;
    --sgkw-credit: #2f8a4c;
    --sgkw-debit: #c0392b;
    color: var(--sgkw-text);
}

.sgkw-wallet .alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* ----------------------------------------------------------------------
 * Balance summary — a calm, slightly elevated hero for the balance.
 * ------------------------------------------------------------------- */
.sgkw-balance {
    position: relative;
    background:
        radial-gradient(120% 140% at 100% 0%, var(--sgkw-accent-soft) 0%, transparent 60%),
        var(--sgkw-surface-alt);
    border: 1px solid var(--sgkw-border);
    border-radius: var(--sgkw-radius);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    overflow: hidden;
}

.sgkw-balance::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sgkw-accent);
}

.sgkw-balance__label {
    display: block;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sgkw-muted);
    margin-bottom: 0.4rem;
}

.sgkw-balance__amount {
    display: block;
    font-size: 2.35rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--sgkw-text);
}

.sgkw-balance__list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.sgkw-balance__list li {
    font-size: 0.8125rem;
    padding: 0.22rem 0.65rem;
    border: 1px solid var(--sgkw-border);
    border-radius: 999px;
    background: var(--sgkw-surface);
    color: var(--sgkw-muted);
}

.sgkw-balance__list-item--active {
    border-color: var(--sgkw-accent);
    color: var(--sgkw-accent);
    font-weight: 600;
}

.sgkw-balance__expiry {
    margin: 0.85rem 0 0;
    font-size: 0.8125rem;
    color: var(--sgkw-muted);
}

/* ----------------------------------------------------------------------
 * Top-up & gift card cards
 * ------------------------------------------------------------------- */
.sgkw-forms {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}

@media (max-width: 767px) {
    .sgkw-forms {
        grid-template-columns: 1fr;
    }
}

.sgkw-card {
    background: var(--sgkw-surface);
    border: 1px solid var(--sgkw-border);
    border-radius: var(--sgkw-radius);
    padding: 1.35rem;
    height: 100%;
    transition: box-shadow 0.18s ease;
}

.sgkw-card:hover {
    box-shadow: 0 10px 26px -16px rgba(31, 45, 61, 0.22);
}

.sgkw-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--sgkw-border);
}

.sgkw-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.sgkw-input-group,
.sgkw-code-input {
    margin-bottom: 0.5rem;
}

.sgkw-hint {
    font-size: 0.8125rem;
    color: var(--sgkw-muted);
    margin: 0 0 1rem;
}

.sgkw-btn {
    width: 100%;
}

.sgkw-code-input {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ----------------------------------------------------------------------
 * Referral block (rendered as a card inside the two-column grid)
 * ------------------------------------------------------------------- */
.sgkw-referral {
    display: flex;
    flex-direction: column;
}

.sgkw-referral .sgkw-card__title {
    border-bottom: 1px solid var(--sgkw-border);
}

.sgkw-referral__intro {
    color: var(--sgkw-muted);
    font-size: 0.9rem;
    margin: 0 0 0.85rem;
}

.sgkw-referral__row {
    display: flex;
    gap: 0.5rem;
}

.sgkw-referral__link {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    cursor: pointer;
}

.sgkw-referral__stats {
    margin: 0.85rem 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sgkw-accent);
}

/* ----------------------------------------------------------------------
 * History table
 * ------------------------------------------------------------------- */
.sgkw-history {
    background: var(--sgkw-surface);
    border: 1px solid var(--sgkw-border);
    border-radius: var(--sgkw-radius);
    padding: 1.35rem;
}

.sgkw-table {
    margin-bottom: 0;
}

.sgkw-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--sgkw-muted);
    border-bottom: 2px solid var(--sgkw-border);
}

.sgkw-table td {
    vertical-align: middle;
}

.sgkw-amount--credit {
    color: var(--sgkw-credit);
    font-weight: 600;
    white-space: nowrap;
}

.sgkw-amount--debit {
    color: var(--sgkw-debit);
    font-weight: 600;
    white-space: nowrap;
}

.sgkw-empty {
    color: var(--sgkw-muted);
    margin: 0;
    padding: 0.5rem 0;
}

/* Status pills (0 pending, 1 validated, 2 cancelled) */
.sgkw-status {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    line-height: 1.4;
}

.sgkw-status--0 {
    background: #fdf3d8;
    color: #8a6d1a;
}

.sgkw-status--1 {
    background: #e3f3e8;
    color: #2f8a4c;
}

.sgkw-status--2 {
    background: #f2f2f2;
    color: #777777;
}

/* ----------------------------------------------------------------------
 * Account links
 * ------------------------------------------------------------------- */
.sgkw-account-link__balance,
.sgkw-nav-wallet__balance {
    font-weight: 600;
    margin-left: 0.35rem;
}

.sgkw-nav-wallet {
    display: inline-block;
}

.sgkw-nav-wallet a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.sgkw-myaccount-block a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sgkw-myaccount-block .sgkw-icon {
    width: 1.1em;
    height: 1.1em;
}

/* Inline SVG wallet icon — replaces the Material Icons webfont, which is not
 * loaded in the front office. Sized relative to the surrounding text so it
 * matches whatever theme typography is in use. */
.sgkw-icon {
    width: 1.2em;
    height: 1.2em;
    flex: 0 0 auto;
    vertical-align: -0.18em;
}

/* PrestaShop native Material Icons glyph (used in place of the inline SVG on
 * themes that ship the Material Icons webfont). Sized relative to the
 * surrounding text so it matches whatever theme typography is in use. In the
 * self-contained account card it is scaled to fill the round icon holder. */
.sgkw-mi {
    font-size: 1.2em;
    line-height: 1;
    flex: 0 0 auto;
    vertical-align: -0.24em;
}

.sgkw-account-card__icon .sgkw-mi {
    font-size: 1.3rem;
    vertical-align: middle;
}

.sgkw-myaccount-block__balance {
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Self-contained wallet card (account_card.tpl) for themes that do not style
 * the Classic .link-item tiles. Uses theme-neutral values (currentColor and
 * translucent tints) so it inherits the theme's text colour and reads well on
 * light or dark backgrounds without hard-coded brand colours. */
.sgkw-account-cell {
    margin-bottom: 1rem;
}

.sgkw-account-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    height: 100%;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.015);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sgkw-account-card:hover,
.sgkw-account-card:focus {
    border-color: currentColor;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.sgkw-account-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    font-size: 1.25rem;
}

.sgkw-account-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.sgkw-account-card__label {
    font-weight: 600;
}

.sgkw-account-card__balance {
    font-size: 0.9375rem;
    opacity: 0.85;
}

/* Full-width wallet banner at the top of the customer account page
 * (displayCustomerAccountTop). Theme-neutral: inherits the surrounding text
 * colour and works on Classic, Hummingbird, Panda and custom themes. */
.sgkw-account-top {
    margin: 0 0 1.25rem;
}

.sgkw-account-top__link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.9rem 1.15rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.015);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sgkw-account-top__link:hover,
.sgkw-account-top__link:focus {
    border-color: currentColor;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
}

.sgkw-account-top__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    font-size: 1.25rem;
}

.sgkw-account-top__label {
    font-weight: 600;
}

.sgkw-account-top__balance {
    margin-left: auto;
    font-weight: 600;
    font-size: 1.0625rem;
    white-space: nowrap;
}

/* ----------------------------------------------------------------------
 * Payment hooks
 * ------------------------------------------------------------------- */
.sgkw-payment-info {
    font-size: 0.875rem;
}

.sgkw-payment-info__balance {
    margin-top: 0.35rem;
}

/* Partial-use widget */
.sgkw-partial {
    margin: 0 0 1rem;
}

.sgkw-partial__inner {
    border: 1px solid var(--color-primary, #D41414);
    border-radius: var(--sgkw-radius, 10px);
    padding: 1rem;
    background: #f6f8f9;
}

.sgkw-partial__head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.sgkw-partial__balance {
    margin-left: auto;
    font-weight: 700;
}

.sgkw-partial__body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.sgkw-partial__group {
    flex: 1 1 140px;
    margin: 0;
}

.sgkw-partial__hint {
    font-size: 0.8125rem;
    color: #7a7a7a;
    margin: 0.6rem 0 0;
}

.sgkw-partial__msg {
    margin: 0.6rem 0 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.sgkw-partial__msg--ok {
    color: #2f8a4c;
}

.sgkw-partial__msg--ko {
    color: #c0392b;
}

/* ----------------------------------------------------------------------
 * Responsive: stacked-card history on small screens
 * ------------------------------------------------------------------- */
@media (max-width: 575px) {
    .sgkw-balance {
        padding: 1.5rem 1.25rem;
    }

    .sgkw-balance__amount {
        font-size: 1.95rem;
    }

    .sgkw-table thead {
        display: none;
    }

    .sgkw-table,
    .sgkw-table tbody,
    .sgkw-table tr,
    .sgkw-table td {
        display: block;
        width: 100%;
    }

    .sgkw-table tr {
        border: 1px solid var(--sgkw-border);
        border-radius: var(--sgkw-radius);
        margin-bottom: 0.6rem;
        padding: 0.35rem 0.6rem;
    }

    .sgkw-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: 0;
        padding: 0.35rem 0;
        text-align: right;
    }

    .sgkw-table td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--sgkw-muted);
        text-align: left;
        margin-right: 1rem;
    }

    .sgkw-partial__body {
        flex-direction: column;
    }

    .sgkw-partial__apply,
    .sgkw-partial__remove {
        width: 100%;
    }
}

/* ----------------------------------------------------------------------
 * Cross-theme Bootstrap compatibility
 *
 * The module ships its own visual language (the .sgkw-* classes above) but
 * still leans on a few Bootstrap component/utility classes for inputs, the
 * currency addon and a secondary button. Those classes were renamed or
 * dropped between Bootstrap 3, 4 and 5, so the wallet rendered differently
 * once a PrestaShop 9 store switched to the Hummingbird theme (Bootstrap 5):
 * `input-group-addon` and `text-right` no longer exist and `btn-default` is
 * unstyled. We recreate them here, scoped strictly to the module's own
 * containers, so the wallet looks identical on PrestaShop 1.7, 8 and 9
 * whatever Bootstrap version the active theme is built on. Nothing outside
 * the module is affected.
 * ------------------------------------------------------------------- */

/* Text-alignment utilities (text-right was renamed text-end in Bootstrap 5). */
.sgkw-wallet .text-right {
    text-align: right;
}

.sgkw-wallet .text-left {
    text-align: left;
}

.sgkw-wallet .text-center {
    text-align: center;
}

/* Input group: lay out as a single flex row whatever the theme provides. */
.sgkw-wallet .input-group {
    width: 100%;
}

.sgkw-wallet .input-group,
.sgkw-partial .input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
}

.sgkw-wallet .input-group > .form-control,
.sgkw-partial .input-group > .form-control {
    flex: 1 1 auto;
    min-width: 0;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Currency addon (input-group-addon is a Bootstrap 3 class dropped in 4/5). */
.sgkw-wallet .input-group-addon,
.sgkw-partial .input-group-addon {
    display: flex;
    align-items: center;
    padding: 0 0.85rem;
    white-space: nowrap;
    font-weight: 600;
    color: var(--sgkw-muted, #7a7a7a);
    background: var(--sgkw-surface-alt, #f6f8f9);
    border: 1px solid var(--sgkw-border, #e6e6e6);
    border-left: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Secondary button (btn-default was renamed btn-secondary in Bootstrap 4/5). */
.sgkw-wallet .btn-default,
.sgkw-partial .btn-default {
    color: #363a41;
    background-color: #ffffff;
    border: 1px solid #c5ccd3;
}

.sgkw-wallet .btn-default:hover,
.sgkw-wallet .btn-default:focus,
.sgkw-partial .btn-default:hover,
.sgkw-partial .btn-default:focus {
    color: #363a41;
    background-color: #f3f5f7;
    border-color: #adb6bf;
}

/* Account-links tile: keep the icon, label and balance aligned even on
 * themes (e.g. Hummingbird) that no longer style the .link-item structure. */
.sgkw-account-link .link-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sgkw-account-link .sgkw-icon {
    width: 1.25em;
    height: 1.25em;
}
