/* =========================================================
   coupon-listing.css  -  ADDITIVE. Load AFTER style.css.
   Built on your theme tokens (--ink, --stamp, --amber, --glass-*, --radius-*,
   --font-*). Every selector is "cp-" prefixed, or a scoped theme class,
   so nothing in style.css changes.
   Used by: category page, search page, brand page, coupon popup.
   ========================================================= */

/* [hidden] must beat .btn / flex rules */
.cp-page [hidden], .cp-modal [hidden] {
    display: none !important;
}

/* ---------- hero extras (brand page) ---------- */
.page-hero .breadcrumb span {
    opacity: .6;
}

.cp-hero-row {
    display: flex;
    align-items: center;
    gap: 22px;
}

.cp-hero-logo {
    --h: 210;
    width: 88px;
    height: 88px;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--h) 60% 93%);
    color: hsl(var(--h) 45% 28%);
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 900;
    border: 4px solid var(--white);
    box-shadow: 0 0 0 2px var(--amber);
}

    .cp-hero-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        padding: 12px;
        background: #fff;
    }

.cp-hero-text {
    min-width: 0;
}

    .cp-hero-text h1 {
        overflow-wrap: anywhere;
    }

.cp-hero-sub {
    color: #C9D2E6;
    margin-top: 8px;
    font-size: 14px;
}

    .cp-hero-sub b {
        color: var(--amber);
        font-family: var(--font-mono);
    }

@media (max-width: 640px) {
    .cp-hero-row {
        gap: 14px;
    }

    .cp-hero-logo {
        width: 64px;
        height: 64px;
        font-size: 24px;
        border-width: 3px;
    }

        .cp-hero-logo img {
            padding: 8px;
        }
}

/* ---------- page sections ---------- */
.cp-page {
    padding-bottom: 70px;
}

    .cp-page > .container {
        padding-top: 36px;
    }

.cp-section {
    padding: 36px 0 0;
}

.cp-section-tight {
    padding-top: 34px;
}

.cp-head {
    margin-bottom: 20px;
}

    .cp-head h2 {
        font-size: clamp(22px, 3vw, 30px);
        margin-top: 8px;
    }

.cp-note {
    font-size: 13.5px;
    color: var(--slate);
}

@media (max-width: 640px) {
    .cp-section, .cp-section-tight {
        padding-top: 26px;
    }
}

/* ---------- results bar ---------- */
.cp-page .results-bar {
    gap: 12px;
}

.cp-sort {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    padding: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

    .cp-sort::-webkit-scrollbar {
        display: none;
    }

    .cp-sort button {
        white-space: nowrap;
        flex: 0 0 auto;
    }

/* ---------- category/search layout ---------- */
.cp-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.cp-main {
    min-width: 0;
}

/* ---------- filter: sidebar (desktop) ---------- */
.cp-sidebar {
    position: sticky;
    top: 90px;
    padding: 20px;
}

.cp-sheet-head, .cp-sheet-foot, .cp-sheet-backdrop {
    display: none;
}

.cp-brand-search {
    width: 100%;
    padding: 10px 12px;
    margin: 0 0 14px;
    font-size: 13.5px;
    border-radius: var(--radius-s);
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--ink);
}

.cp-brand-list {
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

    .cp-brand-list label {
        cursor: pointer;
    }

    .cp-brand-list input {
        width: 16px;
        height: 16px;
        flex: 0 0 auto;
    }

    .cp-brand-list .cp-brand-name {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .cp-brand-list small {
        color: var(--slate);
        margin-left: auto;
        font-family: var(--font-mono);
        font-size: 11px;
    }

.cp-clear {
    margin-top: 16px;
    width: 100%;
    padding: 9px 14px;
}

/* ---------- filter button + badge (mobile only) ---------- */
.cp-filter-btn {
    display: none;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 9px 16px;
    border-radius: 100px;
    border: none;
    background: var(--ink);
    color: var(--paper);
    font-size: 13px;
    font-weight: 700;
}

.cp-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--stamp);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

/* ---------- MOBILE: Flipkart-style filter sheet ---------- */
@media (max-width: 900px) {
    .cp-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .cp-filter-btn {
        display: inline-flex;
        order: 1;
    }

    .cp-toolbar .cp-sort {
        order: 2;
        flex: 1 1 0;
        min-width: 0;
    }

    .cp-toolbar .count {
        order: 3;
        flex: 0 0 100%;
        font-size: 13px;
    }

    .cp-toolbar {
        margin-bottom: 16px;
    }

    .cp-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 2090;
        background: rgba(10, 14, 24, .55);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

        .cp-sheet-backdrop.cp-show {
            opacity: 1;
            pointer-events: auto;
        }

    .cp-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 2100;
        display: flex;
        flex-direction: column;
        max-height: 82vh;
        padding: 0;
        background: var(--paper);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 40px -12px rgba(22, 35, 63, .45);
        transform: translateY(100%);
        visibility: hidden;
        transition: transform .28s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .28s;
    }

        .cp-sidebar.cp-open {
            transform: none;
            visibility: visible;
            transition: transform .28s cubic-bezier(.2, .7, .2, 1);
        }

    .cp-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
        padding: 16px 20px;
        border-bottom: 1px solid var(--line);
    }

        .cp-sheet-head h4 {
            font-size: 17px;
        }

    .cp-sheet-body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 18px 20px 6px;
    }

    .cp-brand-list {
        max-height: none;
        overflow: visible;
        gap: 16px;
    }

        .cp-brand-list label {
            font-size: 14.5px;
        }

    .cp-sidebar .cp-clear {
        display: none !important;
    }

    .cp-sheet-foot {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 10px;
        flex: 0 0 auto;
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--line);
        background: var(--paper);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cp-sidebar, .cp-sheet-backdrop {
        transition: none !important;
    }
}

/* ---------- grid: 2 per row on mobile ---------- */
.cp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 700px) {
    .cp-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (min-width: 1100px) {
    .cp-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cp-layout .cp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 700px) {
    .cp-layout .cp-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }
}

/* ---------- expiring-today strip ---------- */
.cp-strip {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 6px 2px 16px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

    .cp-strip > .cp-card {
        flex: 0 0 240px;
        scroll-snap-align: start;
    }

@media (max-width: 640px) {
    .cp-strip {
        gap: 10px;
    }

        .cp-strip > .cp-card {
            flex-basis: calc((100% - 10px) / 2);
        }
}

/* ---------- coupon card ---------- */
.cp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    cursor: pointer;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-radius: var(--radius-m);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

    .cp-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--glass-shadow);
        background: var(--glass-bg-strong);
    }

.cp-card-img {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--paper-2);
}

    .cp-card-img > img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.cp-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    pointer-events: none;
}

.cp-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.2;
}

.cp-pill-free {
    background: var(--amber);
    color: var(--ink);
}

.cp-pill-ok {
    background: rgba(47, 109, 79, .95);
    color: #fff;
}

.cp-expiry {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    background: rgba(20, 26, 46, .82);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.cp-expiry-urgent {
    background: var(--stamp);
}

.cp-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 16px 16px;
}

.cp-brand {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--slate);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.cp-card h4 {
    font-size: 15px;
    line-height: 1.25;
    min-height: 2.5em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.cp-card-foot {
    margin-top: auto;
/*    padding-top: 10px;*/
    border-top: 1.5px dashed var(--line);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.cp-card h4 + .cp-card-foot {
/*    margin-top: 12px;*/
}

.cp-price {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 900;
    color: var(--ink);
}

.cp-price-free {
    color: var(--forest);
}

.cp-worth {
    font-size: 12px;
    color: var(--slate);
}

    .cp-worth b {
        color: var(--ink-2);
        font-family: var(--font-mono);
        font-weight: 700;
    }

@media (max-width: 640px) {
    .cp-badges {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    .cp-expiry {
        left: 8px;
        bottom: 8px;
        font-size: 10px;
        padding: 3px 8px;
    }

    .cp-card-body {
        padding: 10px 12px 12px;
    }

    .cp-card h4 {
        font-size: 13.5px;
    }

    .cp-price {
        font-size: 17px;
    }

    .cp-worth {
        font-size: 11px;
    }
}

/* fallback tiles: brand logo on light tile, or generated initial tile */
.cp-tile {
    --h: 210;
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    text-align: center;
    background: hsl(var(--h) 60% 93%);
    color: hsl(var(--h) 45% 28%);
}

    .cp-tile b {
        font-family: var(--font-display);
        font-size: 56px;
        line-height: 1;
        font-weight: 900;
    }

    .cp-tile small {
        max-width: 90%;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.cp-tile-logo {
    background: #fff;
    padding: 18%;
}

    .cp-tile-logo img {
        position: static;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

@media (max-width: 640px) {
    .cp-tile b {
        font-size: 42px;
    }

    .cp-tile small {
        font-size: 12px;
    }
}

/* ---------- status / loader / empty ---------- */
.cp-status {
    text-align: center;
    padding: 26px 0 8px;
    color: var(--slate);
    font-size: 14px;
    min-height: 20px;
}

    .cp-status .fa-spinner {
        color: var(--stamp);
        margin-right: 6px;
    }

    .cp-status .btn {
        margin-left: 8px;
        padding: 7px 16px;
    }

/* ---------- popup ---------- */
.cp-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

    .cp-modal[hidden] {
        display: none;
    }

.cp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 35, 63, .55);
    backdrop-filter: blur(2px);
}

.cp-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    overflow-y: auto;
    outline: none;
    background: rgba(251, 246, 236, .96);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-m);
    box-shadow: 0 24px 60px -20px rgba(22, 35, 63, .5);
    animation: cpIn .22s ease;
}

@keyframes cpIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cp-modal-dialog {
        animation: none;
    }
}

@media (max-width: 640px) {
    .cp-modal {
        align-items: flex-end;
        padding: 0;
    }

    .cp-modal-dialog {
        max-width: none;
        max-height: 94vh;
        border-radius: 20px 20px 0 0;
    }
}

body.cp-lock {
    overflow: hidden;
}

.cp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--white);
    color: var(--ink);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .cp-modal-close:hover {
        background: var(--stamp);
        border-color: var(--stamp);
        color: #fff;
    }

.cp-loading {
    padding: 70px 0;
    text-align: center;
    color: var(--slate);
}

    .cp-loading .fa-spinner {
        color: var(--stamp);
        font-size: 24px;
    }

.cp-gal-main {
    aspect-ratio: 16 / 10;
    position: relative;
    background: var(--paper-2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .cp-gal-main > img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .cp-gal-main .cp-tile {
        position: static;
        width: 100%;
        height: 100%;
    }

        .cp-gal-main .cp-tile b {
            font-size: 84px;
        }

.cp-thumbs {
    display: flex;
    gap: 8px;
    padding: 10px 20px 0;
    overflow-x: auto;
}

    .cp-thumbs button {
        flex: 0 0 auto;
        width: 56px;
        height: 56px;
        padding: 0;
        border: 2px solid transparent;
        border-radius: var(--radius-s);
        overflow: hidden;
        background: var(--paper-2);
    }

        .cp-thumbs button.active {
            border-color: var(--stamp);
        }

    .cp-thumbs img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.cp-detail {
    padding: 18px 20px 22px;
}

.cp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.cp-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    background: var(--paper-2);
    color: var(--ink-2);
}

.cp-tag-ok {
    background: #E5F2EA;
    color: var(--forest);
}

.cp-detail h3 {
    font-size: 22px;
    margin: 0 0 14px;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.cp-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.cp-fact {
    background: var(--glass-bg-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    padding: 10px 8px;
    text-align: center;
}

    .cp-fact small {
        display: block;
        font-family: var(--font-mono);
        font-size: 10px;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: var(--slate);
        margin-bottom: 3px;
    }

    .cp-fact b {
        font-family: var(--font-display);
        font-size: 15px;
        color: var(--ink);
    }

    .cp-fact.cp-fact-price b {
        color: var(--stamp);
    }

.cp-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-2);
    margin: 0 0 16px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.cp-disclaimer {
    background: #FFF4E0;
    border: 1px solid rgba(242, 169, 59, .6);
    border-left: 4px solid var(--amber-dark);
    border-radius: var(--radius-s);
    padding: 14px;
    margin-bottom: 14px;
}

    .cp-disclaimer h5 {
        font-family: var(--font-display);
        font-size: 14px;
        margin: 0 0 6px;
        color: var(--ink);
    }

    .cp-disclaimer p {
        font-size: 12.5px;
        line-height: 1.55;
        color: var(--ink-2);
        margin: 0 0 10px;
    }

.cp-agree {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    margin: 0;
}

    .cp-agree input {
        width: 18px;
        height: 18px;
        margin-top: 1px;
        flex: 0 0 auto;
        accent-color: var(--stamp);
    }

.cp-reveal-btn {
    width: 100%;
}

    .cp-reveal-btn[disabled] {
        opacity: .5;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

.cp-reveal h5 {
    font-family: var(--font-display);
    font-size: 14px;
    margin: 0 0 8px;
    color: var(--ink);
}

.cp-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 2px dashed var(--stamp);
    border-radius: var(--radius-s);
    padding: 10px 12px;
    margin-bottom: 16px;
    background: var(--white);
}

    .cp-code code {
        font-family: var(--font-mono);
        font-size: 17px;
        font-weight: 700;
        color: var(--ink);
        overflow-wrap: anywhere;
        user-select: all;
    }

.cp-copy {
    flex: 0 0 auto;
    padding: 8px 16px;
}

.cp-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

    .cp-contact a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 10px;
        border-radius: 100px;
        color: #fff;
        font-weight: 700;
        font-size: 14px;
        transition: transform .15s ease, box-shadow .15s ease;
    }

        .cp-contact a:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 18px -8px rgba(20, 26, 46, .5);
        }

    .cp-contact .cp-tg {
        background: #229ed9;
    }

    .cp-contact .cp-wa {
        background: #25d366;
    }

    .cp-contact a:only-child {
        grid-column: 1 / -1;
    }

.cp-err {
    color: var(--stamp);
    font-size: 13px;
    margin: 8px 0 0;
}
