/* =========================================================
   CLIENT REWARDS PAGE
========================================================= */

.rewards-page {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.rewards-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.rewards-page-header h1 {
    margin: 0 0 8px;
    color: #111;
    font-size: 30px;
    line-height: 1.2;
}

.rewards-page-header p {
    max-width: 700px;
    margin: 0;
    color: #65676b;
    font-size: 15px;
    line-height: 1.55;
}

/* =========================================================
   ALERT
========================================================= */

.rewards-alert {
    display: none;
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.rewards-alert.is-success {
    display: block;
    border-color: #b8e2c8;
    background: #eefaf2;
    color: #1c6b3c;
}

.rewards-alert.is-error {
    display: block;
    border-color: #f0c0c0;
    background: #fff5f5;
    color: #b00020;
}

/* =========================================================
   WALLET
========================================================= */

.wallet-card {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding: 24px;
    border: 1px solid #e4e6eb;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.04);
}

.wallet-card-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wallet-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border-radius: 15px;
    background: #e7f3ff;
    color: #1877f2;
    font-size: 24px;
}

.wallet-label,
.wallet-note {
    display: block;
    color: #65676b;
    font-size: 13px;
}

.wallet-balance {
    margin: 3px 0;
    color: #111;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.wallet-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 10px;
    min-width: 280px;
}

.wallet-meta > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 13px 15px;
    border-radius: 12px;
    background: #f8f9fa;
}

.wallet-meta span {
    margin-bottom: 4px;
    color: #65676b;
    font-size: 12px;
}

.wallet-meta strong {
    color: #111;
    font-size: 18px;
}

/* =========================================================
   LOADING / PANELS
========================================================= */

.rewards-loading {
    padding: 45px 20px;
    color: #65676b;
    text-align: center;
    font-size: 14px;
}

.rewards-loading i {
    margin-right: 8px;
}

.rewards-content {
    display: grid;
    gap: 22px;
}

.rewards-panel {
    padding: 24px;
    border: 1px solid #e4e6eb;
    border-radius: 14px;
    background: #fff;
}

.panel-heading {
    margin-bottom: 20px;
}

.panel-heading h2 {
    margin: 0 0 6px;
    color: #111;
    font-size: 20px;
}

.panel-heading p {
    margin: 0;
    color: #65676b;
    font-size: 13px;
    line-height: 1.5;
}

/* =========================================================
   VOUCHER FORM
========================================================= */

.voucher-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-field {
    min-width: 0;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field label {
    display: block;
    margin-bottom: 7px;
    color: #333;
    font-size: 13px;
    font-weight: 700;
}

.form-field input,
.form-field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus {
    border-color: #1877f2;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.1);
}

.form-field small {
    display: block;
    margin-top: 6px;
    color: #7a7d81;
    font-size: 12px;
    line-height: 1.45;
}

.money-input-wrap {
    position: relative;
}

.money-input-wrap > span {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #65676b;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

.money-input-wrap input {
    padding-left: 38px;
}

.voucher-balance-preview {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.balance-preview-value {
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 9px;
    background: #f8f9fa;
    color: #111;
    font-size: 18px;
    font-weight: 700;
}

.voucher-rule-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 15px;
    border-radius: 10px;
    background: #f5f8ff;
    color: #364152;
}

.voucher-rule-box > i {
    margin-top: 2px;
    color: #1877f2;
}

.voucher-rule-box strong,
.voucher-rule-box span {
    display: block;
}

.voucher-rule-box strong {
    margin-bottom: 3px;
    font-size: 13px;
}

.voucher-rule-box span {
    font-size: 12px;
    line-height: 1.5;
}

.rewards-primary-button,
.rewards-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.rewards-primary-button {
    background: #1877f2;
    color: #fff;
}

.rewards-primary-button:hover {
    background: #0f68dc;
}

.rewards-primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rewards-secondary-button {
    background: #e4e6eb;
    color: #050505;
}

/* =========================================================
   VOUCHERS
========================================================= */

.voucher-list {
    display: grid;
    gap: 14px;
}

.voucher-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    padding: 18px;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    background: #fff;
}

.voucher-card-main {
    min-width: 0;
}

.voucher-code-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 10px;
}

.voucher-code {
    color: #111;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.voucher-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.voucher-status.active {
    background: #e7f3ff;
    color: #1877f2;
}

.voucher-status.redeemed {
    background: #e9f8ef;
    color: #1c7c45;
}

.voucher-status.cancelled,
.voucher-status.expired {
    background: #f1f2f4;
    color: #65676b;
}

.voucher-company {
    margin-bottom: 5px;
    color: #222;
    font-size: 14px;
    font-weight: 700;
}

.voucher-service,
.voucher-dates {
    color: #65676b;
    font-size: 12px;
    line-height: 1.5;
}

.voucher-card-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.voucher-amount {
    color: #111;
    font-size: 22px;
    font-weight: 800;
}

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

.voucher-action-button {
    padding: 7px 10px;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.voucher-action-button:hover {
    background: #f5f6f7;
}

.voucher-action-button.cancel {
    color: #b00020;
}

/* =========================================================
   TRANSACTIONS
========================================================= */

.transactions-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.transactions-table {
    width: 100%;
    min-width: 690px;
    border-collapse: collapse;
    font-size: 13px;
}

.transactions-table th,
.transactions-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ebee;
    text-align: left;
    vertical-align: middle;
}

.transactions-table th {
    background: #f8f9fa;
    color: #4d5156;
    font-size: 12px;
    white-space: nowrap;
}

.transaction-title {
    color: #111;
    font-weight: 700;
}

.transaction-description {
    display: block;
    margin-top: 3px;
    color: #777;
    font-size: 11px;
}

.transaction-amount.positive {
    color: #1c7c45;
    font-weight: 700;
}

.transaction-amount.negative {
    color: #b00020;
    font-weight: 700;
}

.transaction-amount.neutral {
    color: #65676b;
    font-weight: 700;
}

/* =========================================================
   EMPTY / LOGIN
========================================================= */

.rewards-empty {
    padding: 35px 18px;
    color: #65676b;
    text-align: center;
}

.rewards-empty > i {
    margin-bottom: 10px;
    font-size: 28px;
    color: #a0a4a8;
}

.rewards-empty h3 {
    margin: 0 0 6px;
    color: #222;
    font-size: 17px;
}

.rewards-empty p {
    margin: 0;
    font-size: 13px;
}

.rewards-login-box {
    padding: 45px 25px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8f9fa;
    text-align: center;
}

.rewards-login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 15px;
    border-radius: 50%;
    background: #e7f3ff;
    color: #1877f2;
    font-size: 24px;
}

.rewards-login-box h2 {
    margin: 0 0 9px;
    font-size: 22px;
}

.rewards-login-box p {
    max-width: 550px;
    margin: 0 auto 20px;
    color: #65676b;
    font-size: 14px;
    line-height: 1.6;
}

.rewards-login-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {
    .rewards-page {
        max-width: none;
    }

    .rewards-page-header h1 {
        font-size: 25px;
    }

    .wallet-card {
        flex-direction: column;
        padding: 18px;
    }

    .wallet-meta {
        min-width: 0;
        width: 100%;
    }

    .rewards-panel {
        padding: 18px;
        border-radius: 12px;
    }

    .voucher-form {
        grid-template-columns: 1fr;
    }

    .form-field-full {
        grid-column: auto;
    }

    .voucher-card {
        grid-template-columns: 1fr;
    }

    .voucher-card-side {
        align-items: flex-start;
    }

    .rewards-primary-button,
    .rewards-secondary-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .wallet-meta {
        grid-template-columns: 1fr;
    }

    .wallet-balance {
        font-size: 28px;
    }
}

/* =========================================================
   FIX REWARDS CONTENT WIDTH / OVERFLOW
========================================================= */

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


/* Critical: allow rewards grid itself to shrink */

.rewards-content {
    width: 100%;
    min-width: 0;
}


/* Critical: grid children must not inherit table width */

.rewards-content > * {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}


/* Panels stay within rewards column */

.rewards-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}


/* Voucher form */

.voucher-form {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.voucher-form .form-field,
.money-input-wrap,
.voucher-balance-preview {
    min-width: 0;
    max-width: 100%;
}

.voucher-form input,
.voucher-form select,
.voucher-form textarea,
.balance-preview-value {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}


/* =========================================================
   TRANSACTION TABLE
========================================================= */

/*
 * The table may be wider than the panel.
 * Only this wrapper is allowed to scroll.
 */

.transactions-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;

    overflow-x: auto;
    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;
}

.transactions-table {
    width: 100%;
    min-width: 690px;
    border-collapse: collapse;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .voucher-form {
        grid-template-columns: 1fr;
    }

    .voucher-form .form-field {
        grid-column: 1 / -1;
    }
}