/* Wholesale Widgets – shared styles */
* { font-family: 'Inter', sans-serif; box-sizing: border-box; }
:root { --ws-color: #8F259A; }

.ws-btn-primary {
    background-color: var(--ws-color) !important;
    color: #fff !important;
    border: none;
    cursor: pointer;
    transition: opacity .2s;
}
.ws-btn-primary:hover { opacity: .85; }

.ws-badge-green  { background: #dcfce7; color: #166534; }
.ws-badge-blue   { background: #dbeafe; color: #1e40af; }
.ws-badge-yellow { background: #fef9c3; color: #854d0e; }
.ws-badge-red    { background: #fee2e2; color: #991b1b; }

/* scrollbar hidden */
.ws-scroll::-webkit-scrollbar { display: none; }
.ws-scroll { -ms-overflow-style: none; scrollbar-width: none; }

/* product card */
.ws-product-card { background:#fff; border:1px solid #e5e7eb; border-radius:12px; overflow:hidden; transition: box-shadow .2s; }
.ws-product-card:hover { box-shadow: 0 10px 25px rgba(0,0,0,.1); }

/* news card */
.ws-news-card { border-left: 4px solid var(--ws-color); background: #faf5fb; border-radius: 8px; padding: 12px 16px; }

/* modal overlay */
.ws-modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:99999; align-items:center; justify-content:center; padding:24px; }
.ws-modal.open { display:flex; }

/* ── Mobile Responsive ──────────────────────────────────────────── */

/* Product catalog: 3-col → 2-col → 1-col */
@media (max-width: 900px) {
    /* product grid forced from PHP inline style — override with a class if needed */
    #ws-catalog-grid-override { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Product detail modal: side-by-side → stacked on mobile */
@media (max-width: 640px) {
    /* Modal inner panels that use grid 1fr 1fr */
    [id$="-modal-body"] > div[style*="grid-template-columns:1fr 1fr"],
    [id$="-modal-body"] > div[style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
    }
    /* modals: full screen feel */
    [id$="-modal"] > div {
        max-height: 95vh !important;
        border-radius: 12px !important;
    }
    /* Purchase reports table — allow horizontal scroll */
    .ws-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Welcome banner stat cards: 2-col on mobile */
    .ws-stat-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Sales analytics KPI cards: 2-col on mobile */
    .ws-kpi-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Filters row: stack on mobile */
    .ws-filters-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .ws-filters-row > * {
        width: 100% !important;
        min-width: unset !important;
    }
    /* Pagination: center on mobile */
    .ws-pagination-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }
    /* Date filter row */
    .ws-date-row {
        flex-wrap: wrap !important;
    }
    .ws-date-row input[type="date"] {
        width: 100% !important;
    }
}

/* News widget cards: keep readable on small screens */
@media (max-width: 480px) {
    .ws-news-card { padding: 10px 12px; }
    .ws-stat-cards { grid-template-columns: 1fr 1fr !important; }
}

/* Prevent horizontal overflow on the whole page */
.elementor-widget-wholesale_product_catalog,
.elementor-widget-wholesale_purchase_reports,
.elementor-widget-wholesale_news,
.elementor-widget-wholesale_marketing_creatives,
.elementor-widget-wholesale_sales_analytics,
.elementor-widget-wholesale_welcome_banner {
    max-width: 100%;
    overflow-x: hidden;
}

/* Responsive table scroll wrapper */
.ws-tbl-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    .ws-btn-primary,
    button[class*="ws-"],
    [id*="-atc-btn"],
    [id*="-tab-"] {
        min-height: 40px;
    }
}
