/**
 * Pharmacy & General Store Platform — Additive Styles
 *
 * Layered ON TOP of prime-pm.css. Converts the clothing marketplace into a
 * a pharmacy/medical theme using green, white, and light blue palette.
 * All original .ppm-* class structures preserved.
 */

/* ===== Pharmacy Color Theme Override ===== */
:root {
    --ppm-primary: #16a34a;       /* Medical green */
    --ppm-primary-dark: #15803d;
    --ppm-primary-light: #dcfce7;
    --ppm-secondary: #0ea5e9;     /* Light medical blue */
    --ppm-accent: #f0fdf4;
    --pgsp-rx-color: #7c3aed;     /* Purple for Rx badge */
}

/* Dashboard header — pharmacy green gradient */
.ppm-dashboard-header {
    background: linear-gradient(135deg, #16a34a 0%, #0ea5e9 100%) !important;
}

/* Primary buttons */
.ppm-btn--primary {
    background: #16a34a !important;
}
.ppm-btn--primary:hover {
    background: #15803d !important;
}

/* WhatsApp button stays green — no change needed */

/* Auth logo area */
.ppm-auth-header .ppm-auth-logo {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

/**
 * Pharmacy & General Store Platform — additive styles
 *
 * Layered ON TOP of the original prime-pm.css. Only ADDS or refines styles
 * for the pharmacy-specific UI bits (quantity buttons, discount badges, sticky
 * mobile Buy bar, order modal, image-hint card, seller storefront).
 *
 * Nothing in the original .ppm-* classes is overridden destructively.
 */

/* ===== Card refinements ===== */
.csp-product-card .ppm-card-img {
    background-size: cover;
    background-position: center;
}
.csp-card-brand {
    font-size: 0.78rem;
    color: #6b7280;
    font-weight: 600;
    margin: 4px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.csp-card-price {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.csp-price-now {
    font-size: 1.15rem;
    font-weight: 800;
    color: #111827;
}
.csp-price-mrp {
    font-size: 0.85rem;
    color: #9ca3af;
    text-decoration: line-through;
}
.csp-price-off {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
}
.csp-card-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}
.csp-size-chip {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #6b7280;
    background: #fff;
    font-weight: 600;
}
.csp-discount-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.72rem;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}
.csp-subcat-badge {
    background: #eff6ff !important;
    color: #1e40af !important;
}
.csp-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}
.csp-badge--low {
    background: #fef3c7;
    color: #92400e;
}

/* ===== Filter bar — minor refinement ===== */
.csp-filter-bar .ppm-filter-group {
    min-width: 140px;
}

/* ===== Submit-product form ===== */
.csp-product-form .ppm-form-section-title {
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 8px;
    margin-bottom: 16px;
}
.csp-size-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.csp-size-check {
    cursor: pointer;
    user-select: none;
}
.csp-size-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.csp-size-check span {
    display: inline-block;
    padding: 10px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-weight: 700;
    color: #374151;
    transition: all 0.15s;
    min-width: 50px;
    text-align: center;
}
.csp-size-check:hover span {
    border-color: #9ca3af;
}
.csp-size-check input:checked + span {
    border-color: var(--ppm-primary, #e63946);
    background: var(--ppm-primary, #e63946);
    color: #fff;
}

.csp-image-hint {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #075985;
}
.csp-image-hint ul {
    margin: 6px 0 6px 18px;
    padding: 0;
}
.csp-image-hint code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.78rem;
    border: 1px solid #bae6fd;
}

/* ===== Single product page ===== */
.csp-product-title {
    font-size: 1.6rem;
    line-height: 1.3;
    margin: 0 0 4px;
}
.csp-product-brand {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 12px;
}
.csp-product-brand strong {
    color: #111827;
}
.csp-product-price {
    margin: 0 0 4px;
    font-size: 1.5rem;
}
.csp-product-price .csp-price-now {
    font-size: 1.8rem;
    color: #059669;
}
.csp-price-tax-note {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-bottom: 18px;
}
.csp-spec-grid .ppm-spec-item {
    background: #f9fafb;
    border-radius: 8px;
    padding: 10px 12px;
}
.csp-product-desc h3 {
    font-size: 1.05rem;
    margin: 18px 0 10px;
    color: #111827;
}
.csp-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}
.csp-tag {
    background: #f3f4f6;
    color: #6b7280;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== Size buttons on product page ===== */
.csp-size-section {
    margin: 20px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 10px;
}
.csp-size-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.csp-size-section-head strong {
    font-size: 0.95rem;
    color: #111827;
}
.csp-size-section-head small {
    color: #9ca3af;
    font-size: 0.75rem;
}
.csp-size-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.csp-size-btn {
    min-width: 56px;
    padding: 12px 18px;
    border: 2px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.95rem;
}
.csp-size-btn:hover {
    border-color: #6b7280;
}
.csp-size-btn--active {
    border-color: var(--ppm-primary, #e63946);
    background: var(--ppm-primary, #e63946);
    color: #fff;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.25);
}

/* ===== Buy on WhatsApp button ===== */
.csp-buy-card {
    margin-top: 24px;
    padding: 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
}
.csp-buy-btn {
    width: 100%;
    padding: 16px 24px !important;
    font-size: 1.05rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #25d366 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}
.csp-buy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.45);
}
.csp-buy-btn:disabled {
    background: #d1d5db !important;
    box-shadow: none;
    cursor: not-allowed;
}
.csp-buy-note {
    margin: 10px 0 0;
    font-size: 0.78rem;
    color: #6b7280;
    text-align: center;
}

/* ===== Order modal ===== */
.csp-order-modal-box {
    max-width: 560px !important;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}
.csp-order-modal-head {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 12px;
    margin-bottom: 16px;
}
.csp-order-modal-head h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}
.csp-order-modal-head p {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}
.csp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.csp-form-grid .ppm-form-group--full {
    grid-column: 1 / -1;
}
.csp-form-grid .ppm-form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}
.csp-form-grid input,
.csp-form-grid textarea,
.csp-form-grid select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: inherit;
}
.csp-form-grid input:focus,
.csp-form-grid textarea:focus,
.csp-form-grid select:focus {
    outline: none;
    border-color: var(--ppm-primary, #e63946);
}
.csp-order-submit {
    width: 100%;
    margin-top: 16px;
    padding: 14px 24px !important;
    font-size: 1rem !important;
    background: #25d366 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 800;
    cursor: pointer;
}
.csp-order-submit:hover {
    background: #1ebe5d !important;
}
.csp-modal-disclaimer {
    margin: 12px 0 0;
    font-size: 0.72rem;
    color: #9ca3af;
    text-align: center;
}

/* ===== Sticky mobile Buy bar ===== */
.csp-sticky-buy {
    display: none;
}
@media (max-width: 768px) {
    .csp-sticky-buy {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        padding: 10px 14px;
        gap: 10px;
        align-items: center;
        z-index: 90;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    }
    .csp-sticky-price {
        flex: 0 0 auto;
        font-size: 1rem;
        font-weight: 800;
    }
    .csp-sticky-buy .ppm-btn {
        flex: 1;
        padding: 12px !important;
        font-size: 0.92rem !important;
        background: #25d366 !important;
        color: #fff !important;
        border: none !important;
        font-weight: 800;
    }
    /* push the page up so sticky bar doesn't cover content */
    body { padding-bottom: 70px !important; }
}

/* ===== Categories grid (homepage tiles) ===== */
.csp-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.csp-category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 14px;
    text-decoration: none;
    color: #111827;
    transition: transform 0.15s, box-shadow 0.15s;
    font-weight: 700;
}
.csp-category-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}
.csp-category-tile--men    { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.csp-category-tile--women  { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }
.csp-category-tile--kids   { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.csp-category-tile--unisex { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); }
.csp-cat-icon {
    font-size: 2.5rem;
    margin-bottom: 6px;
}
.csp-cat-name {
    font-size: 1.05rem;
}

/* ===== Seller storefront ===== */
.csp-seller-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 28px;
    background: linear-gradient(135deg, #e63946, #c1272d);
    color: #fff;
    border-radius: 16px;
    margin-bottom: 24px;
}
.csp-seller-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
}
.csp-seller-name {
    margin: 0 0 6px;
    font-size: 1.6rem;
    color: #fff;
}
.csp-seller-stats {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.92rem;
}
.csp-seller-stats span {
    margin-right: 16px;
}

/* ===== Sub-admin dashboard ===== */
.csp-subadmin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.csp-subadmin-grid .ppm-stat-card.csp-cap-off {
    opacity: 0.45;
}

/* ===== Mobile tweaks for product form ===== */
@media (max-width: 768px) {
    .csp-form-grid {
        grid-template-columns: 1fr;
    }
    .csp-product-title {
        font-size: 1.3rem;
    }
    .csp-product-price .csp-price-now {
        font-size: 1.4rem;
    }
}

/* ============================================================================
 * v5.0.2 — point-targeted UI improvements
 * Only adds new rules. Does NOT override base layout or branding.
 * ============================================================================ */

/* Point 3 — modern size badges (grid card + single page) */
.csp-card-sizes .csp-size-chip,
.csp-spec-grid .csp-size-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 26px;
    padding: 0 9px;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;             /* pill */
    background: linear-gradient(180deg, #ffffff, #f9fafb);
    color: #374151;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1;
    transition: transform .12s ease, border-color .12s ease;
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
}
.csp-card-sizes .csp-size-chip:hover,
.csp-spec-grid .csp-size-chip:hover {
    transform: translateY(-1px);
    border-color: #9ca3af;
}
.csp-card-sizes {
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #f3f4f6;
}

/* Point 4 — Mobile WhatsApp duplicate: hide inline buy card on mobile,
   keep only the sticky bottom bar */
@media (max-width: 768px) {
    .csp-buy-card {
        display: none !important;
    }
    /* keep sticky bar visible (already shown by .csp-sticky-buy in base CSS) */
}
/* Desktop: hide sticky bar (already in base CSS — confirming) */
@media (min-width: 769px) {
    .csp-sticky-buy {
        display: none !important;
    }
}

/* Point 5 — Order popup responsiveness + footer overlap fix */
.ppm-inquiry-modal-overlay.csp-order-modal {
    z-index: 999999;                  /* above any footer / fixed bar */
    align-items: flex-start;          /* anchor to top on tall content */
    padding: 24px 16px;
    overflow-y: auto;                 /* allow modal to scroll within overlay if very tall */
    -webkit-overflow-scrolling: touch;
}
.csp-order-modal .csp-order-modal-box {
    margin: auto;                     /* recentre vertically when content fits */
    max-width: 520px !important;
    max-height: calc(100vh - 48px);
    /* Use dynamic viewport height where supported — fixes mobile address-bar
       jump on Safari / Chrome mobile that otherwise let the modal bleed under
       the address bar or footer. */
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 22px 22px 20px;
}

/* Tighter modal layout on small screens */
@media (max-width: 600px) {
    .ppm-inquiry-modal-overlay.csp-order-modal {
        padding: 12px 10px;
    }
    .csp-order-modal .csp-order-modal-box {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 18px 16px 16px;
        border-radius: 14px;
    }
    .csp-form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .csp-order-modal-head h3 {
        font-size: 1.05rem;
    }
    .csp-order-modal-head p {
        font-size: 0.8rem;
    }
    /* Body lock when modal open — prevents background scroll under modal */
    body.csp-modal-open {
        overflow: hidden;
    }
}

/* Slightly tighter modal head on all screens */
.csp-order-modal-head {
    margin-bottom: 14px;
    padding-bottom: 10px;
}
/* Confirm submit button never gets clipped by footer */
.csp-order-submit {
    margin-bottom: 4px;
}

/* Point 6 — Lead status badge + inline dropdown */
.csp-lead-status-wrap {
    position: relative;
    display: inline-block;
    min-width: 130px;
}
.csp-lead-status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    background: #dbeafe;
    color: #1e40af;
    line-height: 1.2;
    pointer-events: none;             /* clicks go through to the select */
    transition: background .25s, color .25s, transform .15s;
    white-space: nowrap;
}
.csp-lead-status-badge.csp-flash-ok {
    transform: scale(1.06);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
/* Native <select> stacked invisibly on top of the badge — keeps native UI
   (best mobile picker support) without losing the modern badge look. */
.csp-lead-status-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font: inherit;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}
.csp-lead-status-select:focus + .csp-lead-status-badge,
.csp-lead-status-wrap:hover .csp-lead-status-badge {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.csp-lead-status-select:disabled {
    cursor: progress;
}

/* On the leads table, give the Status cell some breathing room */
.csp-leads-table th:nth-child(5),
.csp-leads-table td:nth-child(5) {
    padding-left: 12px;
    padding-right: 12px;
}

/* Point 7 — modest typography/spacing polish in only the edited sections */
.csp-filter-bar .ppm-filter-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: 0.2px;
}
.csp-card-sizes {
    align-items: center;
}

/* ============================================================================
 * v5.0.3 — bulletproof fixes
 * - csp-desktop-only / csp-mobile-only: high-specificity show/hide utilities
 * - csp-modal-open body class lock (replaces inline style.overflow toggle)
 * - --csp-vh fallback for browsers without 100dvh support
 * ============================================================================ */

/* Mobile WhatsApp duplicate fix (final). The mobile breakpoint is 768px below
   which only the .csp-sticky-buy bar should be visible. Two complementary
   rules — class-based AND structural — make this resistant to caching issues
   and any theme overrides. */
@media (max-width: 768px) {
    .ppm-single-wrap .csp-desktop-only,
    body .csp-desktop-only {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }
}
@media (min-width: 769px) {
    .ppm-single-wrap .csp-mobile-only,
    body .csp-mobile-only {
        display: none !important;
    }
}

/* Body scroll lock when modal is open — class-based, more reliable than
   inline style.overflow which iOS Safari sometimes ignores. */
body.csp-modal-open {
    overflow: hidden !important;
    position: relative;
}
@media (max-width: 768px) {
    body.csp-modal-open {
        /* fixed prevents iOS rubber-banding from scrolling page behind modal */
        position: fixed;
        width: 100%;
    }
}

/* Modal sizing: dvh-with-fallback. Browsers without dvh fall back to the
   --csp-vh CSS variable that the inline JS keeps in sync with the actual
   visible viewport on resize/orientation changes. */
.csp-order-modal .csp-order-modal-box {
    /* Fallback chain: hard cap → CSS var (set by JS) → 100vh → 100dvh */
    max-height: calc((var(--csp-vh, 1vh) * 100) - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 600px) {
    .csp-order-modal .csp-order-modal-box {
        max-height: calc((var(--csp-vh, 1vh) * 100) - 20px);
        max-height: calc(100dvh - 20px);
        padding: 16px 14px 16px;
        border-radius: 12px;
    }
}

/* Modal overlay: extra high z-index + safe positioning */
.ppm-inquiry-modal-overlay.csp-order-modal {
    z-index: 2147483000 !important;  /* near max int — beats any theme/footer */
    position: fixed !important;
    inset: 0 !important;
    overflow-y: auto;
    padding: 20px 12px;
}

/* Larger size badges on grid card — make sure they're clearly visible.
   These are size-display badges (not the form checkboxes). The selectors
   are scoped to .csp-card-sizes so they only affect cards. */
.ppm-card-body .csp-card-sizes {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #f3f4f6;
}
.ppm-card-body .csp-card-sizes .csp-size-chip {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 24px;
    padding: 0 9px;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: inset 0 -1px 0 rgba(17, 24, 39, 0.04);
}

/* Spec grid sizes on single product page (also pill-shaped) */
.ppm-single-specs .csp-spec-item span.csp-size-chip {
    display: inline-flex;
    align-items: center;
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    color: #374151;
    line-height: 1;
}

/* ============================================================================
 * v5.0.5 — product card redesign to match reference design
 * Scoped to .csp-product-card--v2 — does not affect any other UI.
 * ============================================================================ */

/* Card shell */
.csp-product-card--v2 {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.csp-product-card--v2:hover {
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(17, 24, 39, 0.06);
}

/* Image area — clean square, no internal padding */
.csp-product-card--v2 .csp-card-img-link {
    display: block;
    background: #ffffff;
    padding: 0;
    margin: 0;
}
.csp-product-card--v2 .csp-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #f3f4f6;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
/* Browsers that don't support aspect-ratio (older Safari) */
@supports not (aspect-ratio: 1/1) {
    .csp-product-card--v2 .csp-card-img {
        padding-top: 100%;
    }
}

/* Top-left image badge — single label, solid style */
.csp-product-card--v2 .csp-card-img-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}
.csp-product-card--v2 .csp-img-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 1;
    color: #ffffff;
    background: #111827;          /* default — TRENDING / NEW ARRIVAL look */
    box-shadow: 0 2px 6px rgba(17, 24, 39, 0.15);
    text-transform: uppercase;
}
.csp-product-card--v2 .csp-img-badge--discount {
    background: #ef4444;           /* red for discount, matches screenshot */
}
.csp-product-card--v2 .csp-img-badge--low {
    background: #f59e0b;
}
.csp-product-card--v2 .csp-img-badge--sold {
    background: #6b7280;
}

/* Body */
.csp-product-card--v2 .csp-card-body {
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
}

/* Brand line: small icon + uppercase name, grey */
.csp-product-card--v2 .csp-card-brand-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0 0 2px;
}
.csp-product-card--v2 .csp-card-brand-icon {
    flex-shrink: 0;
    color: #9ca3af;
}

/* Title */
.csp-product-card--v2 .csp-card-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
    /* Match the reference's slightly classy/serif feel where possible —
       fall back to system fonts otherwise */
    font-family: Georgia, 'Times New Roman', 'Source Serif Pro', serif;
    letter-spacing: -0.01em;
}
.csp-product-card--v2 .csp-card-title a {
    color: inherit;
    text-decoration: none;
}
.csp-product-card--v2 .csp-card-title a:hover {
    color: #111827;
    text-decoration: none;
}

/* Price row */
.csp-product-card--v2 .csp-card-price {
    margin: 2px 0 4px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.csp-product-card--v2 .csp-card-price .csp-price-now {
    font-size: 1.05rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.01em;
}
.csp-product-card--v2 .csp-card-price .csp-price-mrp {
    font-size: 0.85rem;
    color: #9ca3af;
    text-decoration: line-through;
    font-weight: 500;
}
/* Hide the "% OFF" inline label on the price row — it's already shown as the
   top-left image badge in v2 cards */
.csp-product-card--v2 .csp-card-price .csp-price-off {
    display: none;
}

/* Size chips — small light-bordered squares */
.csp-product-card--v2 .csp-card-sizes {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    border: 0;
    align-items: center;
}
.csp-product-card--v2 .csp-card-sizes .csp-size-chip {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 7px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    color: #374151;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: none;
}

/* Footer with single full-width WhatsApp button */
.csp-product-card--v2 .csp-card-footer {
    padding: 0 16px 16px;
    margin: 0;
    background: #ffffff;
    border: 0;
    display: block;
}
.csp-product-card--v2 .csp-card-wa-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 16px !important;
    margin: 0 !important;
    background: #25d366 !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 6px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.7px !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    box-shadow: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
    line-height: 1;
}
.csp-product-card--v2 .csp-card-wa-btn:hover {
    background: #1ebe5d !important;
    color: #ffffff !important;
    transform: none;
    text-decoration: none !important;
}
.csp-product-card--v2 .csp-card-wa-btn:active {
    transform: scale(0.99);
}
.csp-product-card--v2 .csp-card-wa-btn svg {
    flex-shrink: 0;
    fill: currentColor;
}

/* Out-of-stock visual */
.csp-product-card--v2.ppm-property-card--sold .csp-card-img {
    filter: grayscale(0.4) brightness(0.95);
}
.csp-product-card--v2.ppm-property-card--sold .csp-card-wa-btn {
    background: #9ca3af !important;
    pointer-events: none;
}

/* Mobile — keep the same look, just slightly tighter */
@media (max-width: 600px) {
    .csp-product-card--v2 .csp-card-body {
        padding: 12px 13px 10px;
    }
    .csp-product-card--v2 .csp-card-footer {
        padding: 0 13px 13px;
    }
    .csp-product-card--v2 .csp-card-title {
        font-size: 0.98rem;
    }
    .csp-product-card--v2 .csp-card-wa-btn {
        padding: 12px 14px !important;
        font-size: 0.78rem !important;
    }
}

/* ============================================================================
 * v5.0.6 — search bar redesign (clean white pill matching reference)
 * Scoped to .csp-filter-bar--v2 — does not affect any other UI.
 * ============================================================================ */

/* The outer container becomes a white rounded pill with a soft shadow.
   Inner padding zero — the columns themselves carry the visual padding. */
.csp-filter-bar.csp-filter-bar--v2 {
    background: #ffffff;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

/* Single horizontal row, no wrapping on desktop */
.csp-filter-bar--v2 .csp-filter-inner {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    margin: 0;
}

/* Each filter column */
.csp-filter-bar--v2 .csp-filter-col {
    flex: 1 1 0;
    min-width: 0;
    padding: 16px 22px;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: 0;
}

/* Wider search column (matches the reference where 'Search Product' is the
   widest cell) */
.csp-filter-bar--v2 .csp-filter-col--search {
    flex: 2 1 0;
}

/* Label */
.csp-filter-bar--v2 .csp-filter-col label {
    display: block;
    margin: 0 0 2px;
    color: #9ca3af;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    line-height: 1.1;
}

/* Inputs + selects — borderless, no background, look like plain text */
.csp-filter-bar--v2 .csp-filter-input,
.csp-filter-bar--v2 .csp-filter-select {
    width: 100%;
    border: 0 !important;
    background: transparent !important;
    padding: 4px 0 !important;
    margin: 0 !important;
    font-size: 0.92rem !important;
    font-weight: 500;
    color: #111827 !important;
    line-height: 1.3;
    box-shadow: none !important;
    outline: none !important;
    height: auto !important;
    min-height: 0 !important;
    font-family: inherit;
}
.csp-filter-bar--v2 .csp-filter-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}
.csp-filter-bar--v2 .csp-filter-input:focus,
.csp-filter-bar--v2 .csp-filter-select:focus {
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

/* Native caret on select — replaced with a clean SVG arrow */
.csp-filter-bar--v2 .csp-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1,1 6,6 11,1'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 0 center !important;
    padding-right: 22px !important;
    cursor: pointer;
}

/* Vertical separators between columns */
.csp-filter-bar--v2 .csp-filter-divider {
    width: 1px;
    background: #f3f4f6;
    flex: 0 0 1px;
    align-self: stretch;
    margin: 14px 0;
}

/* Actions column at the right */
.csp-filter-bar--v2 .csp-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 10px 4px;
    flex: 0 0 auto;
}

/* Solid black SEARCH button */
.csp-filter-bar--v2 .csp-filter-search-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0f172a !important;
    border: 0 !important;
    color: #ffffff !important;
    padding: 14px 26px !important;
    border-radius: 8px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    letter-spacing: 1.3px !important;
    text-transform: uppercase !important;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
    transition: background-color 0.15s ease, transform 0.1s ease;
}
.csp-filter-bar--v2 .csp-filter-search-btn:hover {
    background: #1e293b !important;
    color: #ffffff !important;
}
.csp-filter-bar--v2 .csp-filter-search-btn:active {
    transform: scale(0.99);
}
.csp-filter-bar--v2 .csp-filter-search-btn svg {
    flex-shrink: 0;
    stroke: currentColor;
}

/* Reset is a quiet link-style button, sits next to Search */
.csp-filter-bar--v2 .csp-filter-reset-btn {
    background: transparent !important;
    border: 0 !important;
    color: #6b7280 !important;
    padding: 8px 10px !important;
    font-size: 0.78rem !important;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.csp-filter-bar--v2 .csp-filter-reset-btn:hover {
    color: #111827 !important;
    background: #f9fafb !important;
}

/* ─── Tablet and below ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .csp-filter-bar--v2 .csp-filter-col {
        padding: 14px 16px;
    }
    .csp-filter-bar--v2 .csp-filter-search-btn {
        padding: 12px 20px !important;
    }
}

/* ─── Mobile — stack vertically ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .csp-filter-bar.csp-filter-bar--v2 {
        border-radius: 14px;
    }
    .csp-filter-bar--v2 .csp-filter-inner {
        flex-direction: column;
    }
    .csp-filter-bar--v2 .csp-filter-col,
    .csp-filter-bar--v2 .csp-filter-col--search {
        flex: 0 0 auto;
        width: 100%;
        padding: 12px 18px;
        border-bottom: 1px solid #f3f4f6;
    }
    .csp-filter-bar--v2 .csp-filter-divider {
        display: none;
    }
    .csp-filter-bar--v2 .csp-filter-actions {
        padding: 14px 14px;
        width: 100%;
        gap: 10px;
    }
    .csp-filter-bar--v2 .csp-filter-search-btn {
        flex: 1;
        padding: 14px !important;
    }
    .csp-filter-bar--v2 .csp-filter-reset-btn {
        flex: 0 0 auto;
        padding: 10px 14px !important;
    }
}

/* ============================================================================
 * v5.0.7 — responsive / alignment fixes per user spec
 *
 * Points addressed in this block:
 *   1.  Mobile 2-column product grid (was 1-column below 640px)
 *   3.  Center-aligned Category & Size dropdowns
 *   4.  Search bar field alignment (equal heights, single-line on mobile)
 *   5.  Price + WhatsApp button on same line (where space allows)
 *   8/9. Discount badge + striked price visibility across all listing surfaces
 *   10. Uniform card height, responsive images, compact spacing
 *   11. Touch-friendly button sizing on mobile
 *   12. Dropdown padding / arrow positioning / focus styles
 *   13. Performance: no animations on mobile, contain layout to cards
 *
 * Scoped to existing class hierarchy — no new wrapper classes needed.
 * ============================================================================ */

/* ─── Point 1: Mobile 2-column product grid ──────────────────────────── */
/* Override the base CSS that drops to 1 column at 640px. Use higher
   specificity (.csp-product-grid.ppm-cols-X) so this beats prime-pm.css
   without needing !important. */
@media (max-width: 640px) {
    .csp-product-grid.ppm-cols-2,
    .csp-product-grid.ppm-cols-3,
    .csp-product-grid.ppm-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    /* Tighten card body padding on tiny screens to fit 2-up cleanly */
    .csp-product-card--v2 .csp-card-body {
        padding: 10px 11px 8px;
    }
    .csp-product-card--v2 .csp-card-footer {
        padding: 0 11px 11px;
    }
    .csp-product-card--v2 .csp-card-title {
        font-size: 0.85rem;
        line-height: 1.25;
    }
    .csp-product-card--v2 .csp-card-brand-line {
        font-size: 0.62rem;
        letter-spacing: 0.6px;
    }
    .csp-product-card--v2 .csp-card-price .csp-price-now {
        font-size: 0.92rem;
    }
    .csp-product-card--v2 .csp-card-price .csp-price-mrp {
        font-size: 0.72rem;
    }
}
/* Phones below 380px — still 2 columns but tighter */
@media (max-width: 380px) {
    .csp-product-grid.ppm-cols-2,
    .csp-product-grid.ppm-cols-3,
    .csp-product-grid.ppm-cols-4 {
        gap: 8px !important;
    }
}

/* ─── Point 10: Uniform card heights (already mostly OK, ensure equal) ── */
.csp-product-grid {
    align-items: stretch;
}
.csp-product-card--v2 {
    height: 100%;
}
.csp-product-card--v2 .csp-card-body {
    flex: 1 1 auto;     /* body absorbs extra height so all cards align */
}

/* ─── Point 5: Price + WhatsApp button on same row ──────────────────── */
/* Hide the footer button on cards; price row gets an inline mini-WA button
   so they sit on the same line. */
.csp-product-card--v2 .csp-card-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 0;
    flex-wrap: nowrap;
}
.csp-product-card--v2 .csp-card-price-row .csp-card-price {
    flex: 1 1 auto;
    min-width: 0;
}
.csp-product-card--v2 .csp-card-price-row .csp-card-wa-inline {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #25d366;
    color: #ffffff !important;
    border: 0;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.15s;
    line-height: 1;
}
.csp-product-card--v2 .csp-card-price-row .csp-card-wa-inline:hover {
    background: #1ebe5d;
}
.csp-product-card--v2 .csp-card-price-row .csp-card-wa-inline svg {
    flex-shrink: 0;
}
/* When the inline button is present, hide the old footer button. PHP sets
   the .csp-has-inline-wa class on the card. */
.csp-product-card--v2.csp-has-inline-wa .csp-card-footer {
    display: none;
}
/* Mobile: stack price label above button, but keep them in the same row */
@media (max-width: 380px) {
    .csp-product-card--v2 .csp-card-price-row .csp-card-wa-inline {
        padding: 7px 9px;
        font-size: 0.62rem;
    }
    .csp-product-card--v2 .csp-card-price-row .csp-card-wa-inline svg {
        width: 11px;
        height: 11px;
    }
    .csp-product-card--v2 .csp-card-price-row .csp-card-wa-inline span {
        display: none;  /* on tiny screens show only the icon */
    }
}

/* ─── Points 8/9: Discount badge + crossed-out original price ────────── */
/* The image badge already shows -N% OFF in red. Strengthen the strikethrough
   on price MRP so the discount is unmistakable. */
.csp-product-card--v2 .csp-card-price .csp-price-mrp {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    text-decoration-color: rgba(107, 114, 128, 0.7);
    opacity: 0.85;
}
.csp-product-card--v2 .csp-card-price .csp-price-now {
    color: #0f172a;
}
/* On product detail page — make the discount tag more prominent */
.csp-single-wrap .info__discount-tag,
.csp-single-wrap .csp-price-off {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    margin-left: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* ─── Points 3, 4, 12: Search bar mobile responsiveness ──────────────── */
/* On mobile the bar must stay COMPACT and SINGLE-LINE-ish.
   Strategy: a 2-row layout — input on top, [Cat][Size][🔍] on bottom row. */
@media (max-width: 768px) {
    .csp-filter-bar.csp-filter-bar--v2 {
        border-radius: 10px;
        margin-bottom: 18px;
        box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    }
    .csp-filter-bar--v2 .csp-filter-inner {
        display: grid !important;
        grid-template-columns: 1fr 1fr auto;
        grid-template-areas:
            "search search search"
            "cat    size   btn";
        gap: 0;
        padding: 0;
    }
    .csp-filter-bar--v2 .csp-filter-col {
        padding: 9px 12px !important;
        min-width: 0;
        border-bottom: 1px solid #f3f4f6;
    }
    .csp-filter-bar--v2 .csp-filter-col--search {
        grid-area: search;
        padding: 10px 14px !important;
    }
    .csp-filter-bar--v2 .csp-filter-col:nth-of-type(3) {
        grid-area: cat;
        border-right: 1px solid #f3f4f6;
        border-bottom: 0;
    }
    .csp-filter-bar--v2 .csp-filter-col:nth-of-type(5) {
        grid-area: size;
        border-bottom: 0;
    }
    /* Hide the vertical divider DIVs on mobile — grid handles separation */
    .csp-filter-bar--v2 .csp-filter-divider {
        display: none !important;
    }
    .csp-filter-bar--v2 .csp-filter-actions {
        grid-area: btn;
        padding: 7px 10px !important;
        border-bottom: 0;
        align-self: stretch;
    }
    /* Compact labels */
    .csp-filter-bar--v2 .csp-filter-col label {
        font-size: 0.58rem;
        letter-spacing: 1px;
        margin-bottom: 2px;
    }
    .csp-filter-bar--v2 .csp-filter-input,
    .csp-filter-bar--v2 .csp-filter-select {
        font-size: 0.86rem !important;
        padding: 2px 0 !important;
    }
    .csp-filter-bar--v2 .csp-filter-select {
        padding-right: 18px !important;
        background-size: 10px 7px !important;
    }
    /* Compact icon-only search button */
    .csp-filter-bar--v2 .csp-filter-search-btn {
        padding: 12px 16px !important;
        height: 100%;
        min-width: 44px;
        border-radius: 7px !important;
    }
    .csp-filter-bar--v2 .csp-filter-search-btn .csp-search-btn-label {
        display: none;       /* show only magnifying-glass on mobile */
    }
    .csp-filter-bar--v2 .csp-filter-search-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ─── Points 3 & 12: Centered dropdowns (Category & Size) ───────────── */
/* Center-align the value text inside selects so it's clearly visible.
   Search input stays left-aligned (more natural for typed text). */
.csp-filter-bar--v2 .pf-category,
.csp-filter-bar--v2 .pf-bhk {
    text-align: center;
    text-align-last: center;     /* center the currently-selected option */
    padding-right: 22px !important;
    padding-left: 8px !important;
    background-position: right 4px center !important;
}
/* The dropped-down option list — center the option text where supported */
.csp-filter-bar--v2 .pf-category option,
.csp-filter-bar--v2 .pf-bhk option {
    text-align: center;
    text-align-last: center;
}

/* Ensure dropdown values are fully visible (no clipping) on mobile */
@media (max-width: 768px) {
    .csp-filter-bar--v2 .pf-category,
    .csp-filter-bar--v2 .pf-bhk {
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
}

/* ─── Point 12: Focus + hover polish ─────────────────────────────────── */
.csp-filter-bar--v2 .csp-filter-input:focus,
.csp-filter-bar--v2 .csp-filter-select:focus {
    color: #0f172a !important;
    background-color: transparent !important;
}
.csp-filter-bar--v2 .csp-filter-col:focus-within {
    background: rgba(15, 23, 42, 0.02);
}

/* ─── Point 11: Touch-friendly button sizing on mobile ───────────────── */
@media (max-width: 768px) {
    .csp-product-card--v2 .csp-card-wa-btn {
        padding: 12px 14px !important;
        font-size: 0.72rem !important;
        letter-spacing: 0.5px !important;
    }
    .csp-product-card--v2 .csp-card-wa-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ─── Point 13: Performance — contain layout / paint to each card ────── */
.csp-product-card--v2 {
    contain: layout style paint;
}
/* Disable hover-lift animation on touch devices — saves a paint */
@media (hover: none) {
    .csp-product-card--v2:hover {
        transform: none;
        box-shadow: none;
    }
    .csp-product-card--v2:hover .csp-card-img {
        transform: none;
    }
}

/* ============================================================================
 * v5.0.8 — Desktop gallery fix on single product page
 *
 * Problem: the main image had inline height:520px + object-fit:contain, which
 * "letterboxed" portrait product images on desktop — leaving big gray bands
 * either side because the image was constrained to 520px tall and contain-
 * fitted into whatever-wide column was actually rendered.
 *
 * Fix: use an aspect-ratio container with object-fit:cover so the image fills
 * the box at the right proportion regardless of column width. Bigger square
 * thumbnails on desktop too.
 *
 * Mobile behaviour preserved — same proportions apply but in a single column.
 * ============================================================================ */

/* Main image: 4:5 portrait container, image fills it cleanly */
.csp-gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
}
/* Fallback for browsers without aspect-ratio support (older Safari < 15) */
@supports not (aspect-ratio: 4/5) {
    .csp-gallery-main {
        height: 0;
        padding-top: 125%;     /* 5/4 * 100 = 125 */
    }
    .csp-gallery-main > * {
        position: absolute;
        inset: 0;
    }
}

.csp-gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* fills box, crops slightly rather than letterboxing */
    object-position: center top;/* keep product top visible when cropping */
    display: block;
    transition: opacity 0.15s;
}

/* When the seller uploads square images (1:1 ratio close), still works fine
   because cover handles both. For very wide images we still keep top alignment. */

/* Thumbnails: square, larger on desktop */
.csp-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 10px;
    overflow: visible;
    padding: 0;
}
.csp-gallery-thumb {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.65;
    transition: opacity 0.15s, border-color 0.15s, transform 0.15s;
}
@supports not (aspect-ratio: 1/1) {
    .csp-gallery-thumb {
        height: 90px !important;
    }
}
.csp-gallery-thumb:hover { opacity: 0.9; transform: translateY(-2px); }
.csp-gallery-thumb.active {
    opacity: 1;
    border-color: var(--ppm-primary, #e63946);
}

/* Empty-state gallery (no images uploaded) */
.csp-gallery-empty {
    width: 100%;
    aspect-ratio: 4 / 5;
    background: #f3f4f6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #9ca3af;
    gap: 8px;
}
.csp-gallery-empty span { font-size: 4rem; }

/* Sold overlay positioning (unchanged behaviour, just make sure it still works) */
.csp-gallery-main .ppm-sold-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}
.csp-gallery-main .ppm-sold-overlay span {
    background: #ef4444;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

/* ─── Mobile: fewer thumb columns, slightly tighter ─────────────────── */
@media (max-width: 600px) {
    .csp-gallery-thumbs {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .csp-gallery-main,
    .csp-gallery-empty {
        border-radius: 10px;
    }
}

/* Tablets — keep the 5-column thumb grid but slightly smaller image */
@media (min-width: 768px) and (max-width: 1024px) {
    .csp-gallery-thumbs {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Override the old fixed-pixel thumbnail size that prime-pm.css set
   (width:72px; height:56px). Our new grid handles sizing. */
.csp-single-wrap .csp-gallery-thumbs .ppm-gallery-thumb.csp-gallery-thumb {
    /* selector specificity beats prime-pm.css's `.ppm-gallery-thumb` rule */
    width: auto !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
}

/* ===== Pharmacy-specific badges ===== */
.csp-img-badge--rx {
    background: #7c3aed !important;
    color: #fff !important;
}
.csp-img-badge--rx::before {
    content: "Rx ";
}

/* ===== Prescription form styles ===== */
.ppm-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: #111827;
    appearance: auto;
}
.ppm-select:focus {
    border-color: var(--ppm-primary, #16a34a);
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

/* Prescription order status form inline */
.pgsp-rx-status-form select {
    margin-top: 4px;
    width: 100%;
}

/* Category tiles — pharmacy themed */
.csp-category-tile--pharmacy { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #14532d; }
.csp-category-tile--medical  { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #075985; }
.csp-category-tile--general  { background: linear-gradient(135deg, #fef9c3, #fde68a); color: #713f12; }
.csp-category-tile--ayurvedic{ background: linear-gradient(135deg, #f0fdf4, #bbf7d0); color: #166534; }

/* Prescription upload zone */
input[type=file][name=pgsp_prescription] {
    border: 2px dashed #16a34a !important;
    background: #f0fdf4;
}
input[type=file][name=pgsp_prescription]:hover {
    background: #dcfce7;
}

/* =============================================================================
   PREMIUM UI/UX UPGRADE — v5.1
   Dashboard, Prescription Form, Product Cards, Tables, Buttons
   ============================================================================= */

/* ── Premium Dashboard Layout ──────────────────────────────────────────────── */
.pgsp-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dashboard Header */
.pgsp-dash-header {
    background: linear-gradient(135deg, #16a34a 0%, #059669 60%, #0ea5e9 100%);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(22,163,74,.25);
    flex-wrap: wrap;
    gap: 16px;
}
.pgsp-dash-user-info h2 {
    font-size: 1.4rem;
    margin: 0 0 4px;
    color: #fff;
}
.pgsp-dash-user-info p {
    color: rgba(255,255,255,.8);
    margin: 0;
    font-size: .9rem;
}
.pgsp-dash-phone { font-size: .82rem !important; color: rgba(255,255,255,.65) !important; }
.pgsp-dash-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Premium avatar */
.pgsp-avatar {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.5rem !important;
    background: rgba(255,255,255,.2) !important;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255,255,255,.4) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

/* ── Section Cards ───────────────────────────────────────────────────────────── */
.pgsp-section-card {
    border-radius: 16px !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    overflow: hidden;
    transition: box-shadow .2s ease;
}
.pgsp-section-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,.1); }

.pgsp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px !important;
    background: linear-gradient(135deg, #f0fdf4, #fff);
    border-bottom: 1px solid #e5e7eb;
}
.pgsp-card-header h3 {
    margin: 0 !important;
    font-size: 1rem;
    color: #1f2937;
}
.pgsp-count-badge {
    font-size: .72rem;
    background: #e5e7eb;
    color: #6b7280;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
    margin-left: 8px;
}
.pgsp-section-note {
    font-size: .78rem;
    color: #9ca3af;
    font-style: italic;
}
.pgsp-section-desc {
    padding: 4px 24px 12px;
    font-size: .82rem;
    color: #6b7280;
    margin: 0;
}

/* ── Plan Card ───────────────────────────────────────────────────────────────── */
.pgsp-plan-card {
    border-radius: 16px !important;
    margin-bottom: 24px;
    overflow: hidden;
    border-top: 4px solid var(--ppm-primary) !important;
}
.pgsp-plan-card--admin { border-top-color: #10b981 !important; }
.pgsp-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 20px 24px;
}
.pgsp-plan-stat {
    background: #f9fafb;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    border: 1px solid #f3f4f6;
}
.pgsp-plan-stat--ok  { background: #f0fdf4; border-color: #bbf7d0; }
.pgsp-plan-stat--warn { background: #fffbeb; border-color: #fde68a; }
.pgsp-plan-stat--danger { background: #fef2f2; border-color: #fca5a5; }
.pgsp-plan-val { font-size: 1.4rem; font-weight: 800; color: var(--ppm-primary); line-height: 1.1; }
.pgsp-plan-val--sm { font-size: 1rem !important; }
.pgsp-plan-val--xs { font-size: .85rem !important; color: #1d4ed8 !important; }
.pgsp-plan-lbl { font-size: .72rem; color: #9ca3af; margin-top: 4px; }
.pgsp-plan-badge {
    font-size: .7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: .05em;
}
.pgsp-plan-badge--active  { background: #f0fdf4; color: #065f46; }
.pgsp-plan-badge--expired { background: #fef2f2; color: #991b1b; }
.pgsp-progress-wrap { padding: 0 24px 16px; }
.pgsp-progress-bar {
    background: #f3f4f6;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}
.pgsp-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}
.pgsp-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: .72rem;
    color: #9ca3af;
    margin-top: 4px;
}
.pgsp-plan-action { padding: 0 24px 20px; }
.pgsp-notice-plan {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px !important;
    border-radius: 12px !important;
}

/* ── Statistics ──────────────────────────────────────────────────────────────── */
.pgsp-stats-section { margin-bottom: 28px; }
.pgsp-stats-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 14px !important;
}
.pgsp-stat-card {
    border-radius: 14px !important;
    padding: 20px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .15s ease, box-shadow .15s ease;
    border: none !important;
}
.pgsp-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.pgsp-slot-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin: -6px 0 20px;
    font-size: .9rem;
    color: #6b7280;
}
.pgsp-slot-remaining { font-weight: 700; }
.pgsp-slot-remaining--ok     { color: #10b981; }
.pgsp-slot-remaining--danger { color: #ef4444; }

/* ── Platform Stats ──────────────────────────────────────────────────────────── */
.pgsp-platform-section { margin-bottom: 8px; }
.pgsp-platform-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}
.pgsp-platform-stat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pgsp-platform-icon { font-size: 1.4rem; }

/* ── Premium Tables ──────────────────────────────────────────────────────────── */
.pgsp-table {
    font-size: .875rem;
}
.pgsp-table thead tr {
    background: linear-gradient(135deg, #f0fdf4, #f9fafb);
}
.pgsp-table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    padding: 12px 14px !important;
    border-bottom: 2px solid #e5e7eb;
}
.pgsp-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background .12s ease;
}
.pgsp-table tbody tr:hover { background: #fafef9; }

/* Product row */
.pgsp-td-prop { display: flex; align-items: center; gap: 12px; }
.pgsp-td-thumb { width: 44px !important; height: 44px !important; border-radius: 8px !important; object-fit: cover; border: 1px solid #e5e7eb; flex-shrink: 0; }
.pgsp-prop-title { font-size: .875rem; font-weight: 700; color: #1f2937; display: block; }
.pgsp-prop-brand { color: #9ca3af; font-size: .75rem; }
.pgsp-oos-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: .65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-top: 2px;
}

/* Status badges */
.pgsp-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}
.pgsp-status--live    { background: #f0fdf4; color: #15803d; }
.pgsp-status--pending { background: #fffbeb; color: #92400e; }
.pgsp-status--danger  { background: #fef2f2; color: #991b1b; }
.pgsp-status--draft   { background: #f3f4f6; color: #6b7280; }

/* Row actions */
.pgsp-row-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pgsp-row-actions .ppm-btn--sm { padding: 4px 8px; font-size: .78rem; border-radius: 6px; min-width: 28px; }
.pgsp-row-actions .ppm-btn--danger { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.pgsp-row-actions .ppm-btn--danger:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

.pgsp-td-muted { color: #6b7280; font-size: .82rem; }
.pgsp-td-date  { color: #9ca3af; font-size: .78rem; white-space: nowrap; }
.pgsp-td-sm    { font-size: .85rem; }
.pgsp-td-msg   { font-size: .78rem; color: #374151; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pgsp-tel-link { font-weight: 700; color: var(--ppm-primary); text-decoration: none; }
.pgsp-tel-link:hover { text-decoration: underline; }
.pgsp-wa-icon  { color: #25d366; font-size: 1.1rem; text-decoration: none; }

/* ── View More Button ──────────────────────────────────────────────────────── */
.pgsp-view-more-wrap {
    padding: 14px 24px;
    border-top: 1px solid #f3f4f6;
    text-align: center;
    background: #fafafa;
}
.pgsp-view-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 2px solid var(--ppm-primary);
    color: var(--ppm-primary);
    border-radius: 10px;
    padding: 9px 24px;
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}
.pgsp-view-more-btn:hover {
    background: var(--ppm-primary);
    color: #fff;
}
.pgsp-view-more-btn--open .pgsp-vm-icon { transform: rotate(180deg); }
.pgsp-vm-icon { transition: transform .2s ease; display: inline-block; }
.pgsp-more-rows { animation: pgspFadeIn .25s ease; }
@keyframes pgspFadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── Prescription Status / RX specifics ─────────────────────────────────────── */
.pgsp-rx-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; }
.pgsp-btn-view { font-size: .72rem !important; padding: 3px 8px !important; }
.pgsp-status-select { font-size: .72rem; padding: 3px 6px; border-radius: 6px; border: 1px solid #d1d5db; margin-top: 4px; width: 100%; }
.pgsp-rx-status { display: block; margin-bottom: 4px; }
.pgsp-notes-hint { cursor: help; color: #9ca3af; }
.pgsp-text-rx-preview {
    font-size: .78rem;
    color: #374151;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 6px 10px;
    max-width: 200px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}
.pgsp-urgency-badge {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 3px;
}
.pgsp-urgency-badge--urgent      { background: #fffbeb; color: #92400e; }
.pgsp-urgency-badge--very_urgent { background: #fef2f2; color: #991b1b; }

/* ── PRESCRIPTION UPLOAD FORM — Premium Redesign ────────────────────────────── */
.ppm-rx-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 16px;
}
.ppm-rx-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 32px rgba(0,0,0,.10);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.ppm-rx-header {
    background: linear-gradient(135deg, #16a34a 0%, #0ea5e9 100%);
    padding: 32px 36px 24px;
    text-align: center;
    color: #fff;
}
.ppm-rx-header-icon { font-size: 3rem; margin-bottom: 10px; }
.ppm-rx-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px; color: #fff; }
.ppm-rx-subtitle { font-size: .9rem; color: rgba(255,255,255,.85); margin: 0; }
.ppm-rx-form { padding: 28px 32px 32px; }
@media (max-width: 600px) {
    .ppm-rx-header { padding: 24px 20px 18px; }
    .ppm-rx-form { padding: 20px 16px 24px; }
}

/* Prescription Method Tabs */
.pgsp-rx-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.pgsp-rx-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 18px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    cursor: pointer;
    background: #f9fafb;
    transition: all .15s ease;
}
.pgsp-rx-tab input[type="radio"] { display: none; }
.pgsp-rx-tab:hover { border-color: var(--ppm-primary); background: #f0fdf4; }
.pgsp-rx-tab--active {
    border-color: var(--ppm-primary) !important;
    background: #f0fdf4 !important;
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.pgsp-rx-tab--active::after {
    content: '✓';
    position: absolute;
    top: 8px; right: 10px;
    width: 20px; height: 20px;
    background: var(--ppm-primary);
    color: #fff;
    border-radius: 50%;
    font-size: .7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
    padding: 0;
}
.pgsp-rx-tab-icon  { font-size: 1.8rem; }
.pgsp-rx-tab-title { font-weight: 700; font-size: .9rem; color: #1f2937; }
.pgsp-rx-tab-desc  { font-size: .75rem; color: #6b7280; line-height: 1.3; }
.pgsp-rx-tab--active .pgsp-rx-tab-title { color: var(--ppm-primary); }

/* Upload zone */
.pgsp-rx-panel { margin-top: 4px; }
.pgsp-rx-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .15s ease;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}
.pgsp-rx-upload-zone:hover, .pgsp-rx-upload-zone.pgsp-drag-over {
    border-color: var(--ppm-primary);
    background: #f0fdf4;
}
.pgsp-rx-upload-zone.pgsp-drag-over { transform: scale(1.01); }
.pgsp-file-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
.pgsp-upload-icon { font-size: 2.4rem; margin-bottom: 8px; }
.pgsp-upload-text { font-weight: 700; color: #374151; font-size: .95rem; margin-bottom: 4px; }
.pgsp-upload-sub  { font-size: .78rem; color: #9ca3af; margin-bottom: 14px; }
.pgsp-upload-preview { padding: 16px; text-align: center; }
.pgsp-preview-img { max-width: 200px; max-height: 180px; border-radius: 10px; border: 2px solid #e5e7eb; object-fit: contain; margin-bottom: 8px; }
.pgsp-file-icon { font-size: 3rem; margin-bottom: 6px; }
.pgsp-file-name { font-size: .82rem; font-weight: 600; color: #1f2937; word-break: break-all; }
.pgsp-file-size { font-size: .72rem; color: #9ca3af; margin-top: 2px; }
.pgsp-remove-file { margin-top: 10px !important; }

/* Text prescription box */
.pgsp-text-rx-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    animation: pgspFadeIn .2s ease;
}

/* ── Premium Notice icon style ──────────────────────────────────────────────── */
.ppm-notice--icon {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.ppm-notice-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }

/* ── Submit button premium ───────────────────────────────────────────────────── */
.pgsp-submit-btn {
    border-radius: 12px !important;
    font-size: 1rem !important;
    padding: 14px 28px !important;
    box-shadow: 0 4px 16px rgba(22,163,74,.3);
    transition: all .15s ease !important;
    letter-spacing: .01em;
}
.pgsp-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(22,163,74,.4) !important;
}

/* ── Mobile Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .pgsp-stats-row { grid-template-columns: repeat(2, 1fr) !important; }
    .pgsp-platform-stats { grid-template-columns: repeat(2, 1fr); }
    .pgsp-plan-grid { grid-template-columns: repeat(2, 1fr); }
    .pgsp-rx-method-tabs { grid-template-columns: 1fr; }
    .pgsp-dash-header { padding: 20px !important; }
    .pgsp-card-header { padding: 14px 16px !important; }
    .ppm-table-wrap { overflow-x: auto; }
    .pgsp-table { min-width: 600px; }
    .pgsp-view-more-btn { width: 100%; justify-content: center; }
}

