/*
 * Qbon CSS hardening layer.
 * Version: 1.0.175
 * Purpose: narrow risky global styles and stabilize Qbon public/dashboard screens
 * without changing business logic, database, roles, QR, coupons or payment flows.
 */

/* Safe dashboard isolation without relying only on :has(). */
body.qbon-site.qbon-dashboard-page-body .qbon-header,
body.qbon-site.qbon-dashboard-page-body .qbon-footer,
body.qbon-site.qbon-dashboard-page-body > header,
body.qbon-site.qbon-dashboard-page-body > footer {
    display: none !important;
}

body.qbon-site.qbon-dashboard-page-body,
body.qbon-site.qbon-dashboard-page-body .ql-dashboard-page,
body.qbon-site.qbon-dashboard-page-body .ql-page.ql-dashboard-page {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

body.qbon-site.qbon-dashboard-page-body {
    background: #f5f8fb !important;
}

body.qbon-site.qbon-dashboard-page-body .ql-dashboard-page {
    padding: 0 !important;
}

/* Keep public Qbon layouts isolated from the theme and browser defaults. */
body.pc-public-body,
body.pc-public-body * ,
.pc-dashboard,
.pc-dashboard * ,
.pc-dashboard-redesign,
.pc-dashboard-redesign * ,
.pc-claim,
.pc-claim * ,
.pc-coupon,
.pc-coupon * ,
.pc-public-shell,
.pc-public-shell * {
    box-sizing: border-box;
}

body.pc-public-body {
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;
    font-family: Inter, Arial, "Helvetica Neue", sans-serif;
    background: #f5f8fb;
    color: #0f172a;
}

body.pc-public-body img,
.pc-dashboard img,
.pc-dashboard-redesign img,
.pc-claim img,
.pc-coupon img,
.pc-public-shell img {
    max-width: 100%;
    height: auto;
}

/* Prevent theme link/button rules from leaking into Qbon app controls. */
.pc-dashboard a,
.pc-dashboard-redesign a,
.pc-claim a,
.pc-coupon a,
.pc-public-shell a {
    text-decoration-thickness: auto;
    text-underline-offset: 2px;
}

.pc-dashboard .pc-btn,
.pc-dashboard-redesign .pc-btn,
.pc-claim .pc-btn,
.pc-coupon .pc-btn,
.pc-public-shell .pc-btn,
.pc-dashboard button,
.pc-dashboard-redesign button,
.pc-claim button,
.pc-coupon button,
.pc-public-shell button {
    font-family: inherit;
}

/* Mobile tables: allow controlled horizontal scroll instead of page overflow. */
.pc-dashboard .pc-table-wrap,
.pc-dashboard-redesign .pc-table-wrap,
.pc-dashboard .pc-responsive-table,
.pc-dashboard-redesign .pc-responsive-table,
.pc-dashboard .pc-billing-table-wrap,
.pc-dashboard-redesign .pc-billing-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pc-dashboard table,
.pc-dashboard-redesign table {
    max-width: 100%;
}

@media (max-width: 782px) {
    body.qbon-site.qbon-dashboard-page-body {
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    .pc-dashboard,
    .pc-dashboard-redesign,
    .pc-public-shell,
    .pc-claim,
    .pc-coupon {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .pc-dashboard .pc-table-wrap,
    .pc-dashboard-redesign .pc-table-wrap,
    .pc-dashboard .pc-responsive-table,
    .pc-dashboard-redesign .pc-responsive-table,
    .pc-dashboard .pc-billing-table-wrap,
    .pc-dashboard-redesign .pc-billing-table-wrap {
        overflow-x: auto !important;
        overflow-y: visible;
    }

    .pc-dashboard .pc-actions,
    .pc-dashboard-redesign .pc-actions,
    .pc-dashboard .pc-form-actions,
    .pc-dashboard-redesign .pc-form-actions {
        flex-wrap: wrap;
    }

    .pc-dashboard .pc-actions .pc-btn,
    .pc-dashboard-redesign .pc-actions .pc-btn,
    .pc-dashboard .pc-form-actions .pc-btn,
    .pc-dashboard-redesign .pc-form-actions .pc-btn {
        max-width: 100%;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    body.pc-public-body {
        font-size: 15px;
    }

    .pc-dashboard .pc-table-wrap,
    .pc-dashboard-redesign .pc-table-wrap,
    .pc-dashboard .pc-responsive-table,
    .pc-dashboard-redesign .pc-responsive-table,
    .pc-dashboard .pc-billing-table-wrap,
    .pc-dashboard-redesign .pc-billing-table-wrap {
        margin-left: 0;
        margin-right: 0;
    }

    .pc-dashboard .pc-btn,
    .pc-dashboard-redesign .pc-btn,
    .pc-claim .pc-btn,
    .pc-coupon .pc-btn,
    .pc-public-shell .pc-btn {
        max-width: 100%;
    }
}
