/* =============================================================================
   Store MM — Store Grid  (Woodmart-safe, full specificity)
   Palette : #E84040 accent · #111827 dark · #374151 body · #6B7280 muted
   All layout-critical rules use .smm-sg-wrap scope + !important
   ============================================================================= */

/* ── Custom properties ─────────────────────────────────────────────────────── */
.smm-sg-wrap {
    --sg-accent:    #E84040;
    --sg-dark:      #111827;
    --sg-body:      #374151;
    --sg-muted:     #6B7280;
    --sg-border:    #E5E7EB;
    --sg-bg:        #F9FAFB;
    --sg-white:     #FFFFFF;
    --sg-radius-sm: 6px;
    --sg-radius-md: 10px;
    --sg-radius-lg: 14px;
}

/* ── Box-sizing reset ──────────────────────────────────────────────────────── */
.smm-sg-wrap,
.smm-sg-wrap *,
.smm-sg-wrap *::before,
.smm-sg-wrap *::after {
    box-sizing: border-box !important;
}

/* ── Root wrapper ──────────────────────────────────────────────────────────── */
.smm-sg-wrap {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 32px 20px 64px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: var(--sg-body) !important;
    background: var(--sg-white) !important;
}

/* =============================================================================
   MOBILE BAR  (shows only on small screens)
   ============================================================================= */
.smm-sg-wrap .smm-sg-mobile-bar {
    display: none !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 0 16px !important;
    margin-bottom: 8px !important;
}
.smm-sg-wrap .smm-sg-count-label {
    font-size: 13px !important;
    color: var(--sg-muted) !important;
}
.smm-sg-wrap .smm-sg-filter-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 9px 16px !important;
    background: var(--sg-dark) !important;
    color: var(--sg-white) !important;
    border: none !important;
    border-radius: var(--sg-radius-sm) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

/* =============================================================================
   LAYOUT  — sidebar + main  !important to defeat Woodmart "display:block"
   ============================================================================= */
.smm-sg-wrap .smm-sg-layout {
    display: grid !important;
    grid-template-columns: 240px 1fr !important;
    gap: 36px !important;
    align-items: start !important;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */
.smm-sg-wrap .smm-sg-sidebar {
    position: sticky !important;
    top: 88px !important;
    display: block !important;
}
.smm-sg-wrap .smm-sg-sidebar-inner {
    background: var(--sg-white) !important;
    border: 1px solid var(--sg-border) !important;
    border-radius: var(--sg-radius-lg) !important;
    padding: 24px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

/* Filter block */
.smm-sg-wrap .smm-sg-filter-block {
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
}
.smm-sg-wrap .smm-sg-filter-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .7px !important;
    color: var(--sg-muted) !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Search input */
.smm-sg-wrap .smm-sg-search-wrap {
    position: relative !important;
}
.smm-sg-wrap .smm-sg-search-icon {
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--sg-muted) !important;
    pointer-events: none !important;
    display: block !important;
}
.smm-sg-wrap .smm-sg-search-input,
.smm-sg-wrap input.smm-sg-search-input,
.smm-sg-wrap input[type="search"].smm-sg-search-input {
    width: 100% !important;
    height: 40px !important;
    padding: 0 12px 0 34px !important;
    border: 1px solid var(--sg-border) !important;
    border-radius: var(--sg-radius-sm) !important;
    font-size: 14px !important;
    color: var(--sg-dark) !important;
    background: var(--sg-bg) !important;
    outline: none !important;
    box-shadow: none !important;
    display: block !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.smm-sg-wrap .smm-sg-search-input:focus {
    border-color: var(--sg-accent) !important;
    background: var(--sg-white) !important;
    box-shadow: 0 0 0 3px rgba(232,64,64,.12) !important;
}

/* Selects */
.smm-sg-wrap .smm-sg-select,
.smm-sg-wrap select.smm-sg-select {
    width: 100% !important;
    height: 40px !important;
    padding: 0 32px 0 12px !important;
    border: 1px solid var(--sg-border) !important;
    border-radius: var(--sg-radius-sm) !important;
    font-size: 14px !important;
    color: var(--sg-dark) !important;
    background: var(--sg-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    display: block !important;
    margin: 0 !important;
}
.smm-sg-wrap .smm-sg-select:focus {
    border-color: var(--sg-accent) !important;
    background-color: var(--sg-white) !important;
    box-shadow: 0 0 0 3px rgba(232,64,64,.12) !important;
}

/* Sidebar action buttons */
.smm-sg-wrap .smm-sg-filter-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding-top: 4px !important;
    border-top: 1px solid var(--sg-border) !important;
}

/* =============================================================================
   SHARED BUTTON STYLES
   ============================================================================= */
.smm-sg-wrap .smm-sg-btn,
.smm-sg-wrap button.smm-sg-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 18px !important;
    height: 40px !important;
    border-radius: var(--sg-radius-sm) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: 1px solid transparent !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease !important;
    font-family: inherit !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
.smm-sg-wrap .smm-sg-btn-primary {
    background: var(--sg-dark) !important;
    color: var(--sg-white) !important;
    border-color: var(--sg-dark) !important;
    width: 100% !important;
}
.smm-sg-wrap .smm-sg-btn-primary:hover {
    background: #1F2937 !important;
    box-shadow: 0 4px 12px rgba(17,24,39,.22) !important;
}
.smm-sg-wrap .smm-sg-btn-ghost {
    background: transparent !important;
    color: var(--sg-body) !important;
    border-color: var(--sg-border) !important;
    width: 100% !important;
}
.smm-sg-wrap .smm-sg-btn-ghost:hover {
    border-color: var(--sg-dark) !important;
    color: var(--sg-dark) !important;
}
.smm-sg-wrap .smm-sg-btn:disabled {
    opacity: .4 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

/* =============================================================================
   MAIN CONTENT AREA
   ============================================================================= */
.smm-sg-wrap .smm-sg-main {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
}
.smm-sg-wrap .smm-sg-top-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 24px !important;
}
.smm-sg-wrap .smm-sg-result-count {
    font-size: 13px !important;
    color: var(--sg-muted) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* =============================================================================
   PRODUCT GRID
   ============================================================================= */
.smm-sg-wrap .smm-sg-grid {
    display: grid !important;
    grid-template-columns: repeat( 3, 1fr ) !important;
    gap: 24px !important;
    min-height: 260px !important;
}

/* Loading */
.smm-sg-wrap .smm-sg-loading {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 60px 20px !important;
    color: var(--sg-muted) !important;
    font-size: 14px !important;
}
.smm-sg-wrap .smm-sg-spinner {
    width: 22px !important;
    height: 22px !important;
    border: 2px solid rgba(0,0,0,.08) !important;
    border-top-color: var(--sg-accent) !important;
    border-radius: 50% !important;
    animation: sg-spin .8s linear infinite !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }

/* Empty / error state */
.smm-sg-wrap .smm-sg-empty {
    grid-column: 1 / -1 !important;
    text-align: center !important;
    padding: 56px 20px !important;
    color: var(--sg-muted) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
}
.smm-sg-wrap .smm-sg-empty svg { opacity: .3 !important; }
.smm-sg-wrap .smm-sg-empty p   { margin: 0 !important; font-size: 15px !important; }
.smm-sg-wrap .smm-sg-empty .smm-sg-btn { width: auto !important; }
.smm-sg-wrap .smm-sg-error .smm-sg-btn-primary { width: auto !important; }

/* =============================================================================
   PRODUCT CARD
   ============================================================================= */
.smm-sg-wrap .smm-sg-card {
    background: var(--sg-white) !important;
    border: 1px solid var(--sg-border) !important;
    border-radius: var(--sg-radius-lg) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease !important;
    position: relative !important;
    height: 100% !important;
}
.smm-sg-wrap .smm-sg-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,.10) !important;
    transform: translateY(-3px) !important;
    border-color: #d1d5db !important;
}

/* Image link */
.smm-sg-wrap .smm-sg-img-link {
    display: block !important;
    position: relative !important;
    text-decoration: none !important;
    overflow: hidden !important;
    background: var(--sg-bg) !important;
    aspect-ratio: 1 / 1 !important;
}

/* Images */
.smm-sg-wrap .smm-sg-img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    padding: 12px !important;
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    transition: opacity .35s ease !important;
}
.smm-sg-wrap .smm-sg-img-main {
    opacity: 1 !important;
    z-index: 1 !important;
}
.smm-sg-wrap .smm-sg-img-alt {
    opacity: 0 !important;
    z-index: 2 !important;
}
.smm-sg-wrap .smm-sg-card:hover .smm-sg-img-alt {
    opacity: 1 !important;
}

/* Category tag on image (bottom-left) */
.smm-sg-wrap .smm-sg-cat-tag {
    position: absolute !important;
    bottom: 10px !important;
    left: 10px !important;
    background: rgba(17,24,39,.72) !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 3px 9px !important;
    border-radius: 20px !important;
    letter-spacing: .3px !important;
    backdrop-filter: blur(4px) !important;
    z-index: 3 !important;
    white-space: nowrap !important;
    max-width: calc(100% - 20px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Card body */
.smm-sg-wrap .smm-sg-card-body {
    padding: 14px 16px 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    flex: 1 !important;
}

/* Designer row */
.smm-sg-wrap .smm-sg-designer {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-height: 0 !important;
}
.smm-sg-wrap .smm-sg-d-avatar {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    display: block !important;
    border: none !important;
    box-shadow: none !important;
}
.smm-sg-wrap .smm-sg-d-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--sg-muted) !important;
    flex-shrink: 0 !important;
}
.smm-sg-wrap .smm-sg-d-name {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--sg-muted) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.3 !important;
}

/* Product title */
.smm-sg-wrap .smm-sg-card-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--sg-dark) !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
}
.smm-sg-wrap .smm-sg-card-title a {
    color: inherit !important;
    text-decoration: none !important;
}
.smm-sg-wrap .smm-sg-card-title a:hover {
    color: var(--sg-accent) !important;
}

/* Footer row: price + orders badge */
.smm-sg-wrap .smm-sg-card-footer {
    display: flex !important;
    align-items: baseline !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--sg-border) !important;
    margin-top: auto !important;
}
.smm-sg-wrap .smm-sg-price {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: var(--sg-accent) !important;
    letter-spacing: -.3px !important;
    line-height: 1 !important;
}
.smm-sg-wrap .smm-sg-orders-badge {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--sg-muted) !important;
    white-space: nowrap !important;
    letter-spacing: .2px !important;
}

/* View product button */
.smm-sg-wrap .smm-sg-view-btn,
.smm-sg-wrap a.smm-sg-view-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 40px !important;
    margin-top: 4px !important;
    background: var(--sg-dark) !important;
    color: var(--sg-white) !important;
    border-radius: var(--sg-radius-sm) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    letter-spacing: .4px !important;
    text-transform: uppercase !important;
    transition: background .15s ease, box-shadow .15s ease !important;
    border: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
}
.smm-sg-wrap .smm-sg-view-btn:hover {
    background: #1F2937 !important;
    color: var(--sg-white) !important;
    box-shadow: 0 4px 12px rgba(17,24,39,.2) !important;
    text-decoration: none !important;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */
.smm-sg-wrap .smm-sg-pagination {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    padding-top: 8px !important;
}
.smm-sg-wrap .smm-sg-pagination .smm-sg-btn {
    width: auto !important;
    min-width: 90px !important;
}
.smm-sg-wrap .smm-sg-page-info {
    font-size: 13px !important;
    color: var(--sg-muted) !important;
    white-space: nowrap !important;
    font-weight: 600 !important;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* 4-column grid at very wide screens */
@media (min-width: 1280px) {
    .smm-sg-wrap .smm-sg-grid { grid-template-columns: repeat( 3, 1fr ) !important; }
}

/* Shrink sidebar at tablet landscape */
@media (max-width: 1100px) {
    .smm-sg-wrap .smm-sg-layout { grid-template-columns: 210px 1fr !important; gap: 24px !important; }
}

/* Collapse sidebar at tablet portrait */
@media (max-width: 860px) {
    /* Show mobile bar */
    .smm-sg-wrap .smm-sg-mobile-bar { display: flex !important; }

    /* Stack layout */
    .smm-sg-wrap .smm-sg-layout { grid-template-columns: 1fr !important; }

    /* Sidebar becomes a slide-down panel */
    .smm-sg-wrap .smm-sg-sidebar {
        position: static !important;
        display: none !important;
        order: -1 !important;
    }
    .smm-sg-wrap .smm-sg-sidebar.is-open { display: block !important; }
    .smm-sg-wrap .smm-sg-sidebar-inner {
        border-radius: var(--sg-radius-md) !important;
        margin-bottom: 20px !important;
    }
    .smm-sg-wrap .smm-sg-filter-actions {
        flex-direction: row !important;
    }
    .smm-sg-wrap .smm-sg-btn-primary,
    .smm-sg-wrap .smm-sg-btn-ghost { width: auto !important; flex: 1 !important; }

    /* 2-column grid */
    .smm-sg-wrap .smm-sg-grid { grid-template-columns: repeat( 2, 1fr ) !important; gap: 16px !important; }
}

/* Mobile — single column */
@media (max-width: 540px) {
    .smm-sg-wrap { padding: 16px 12px 48px !important; }
    .smm-sg-wrap .smm-sg-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
    .smm-sg-wrap .smm-sg-card-title { font-size: 14px !important; }
    .smm-sg-wrap .smm-sg-price { font-size: 16px !important; }
}
