/**
 * Ring Builder — Settings Loop (Elegant Theme).
 *
 * Queensmith-inspired layout: admin-configurable header, sticky
 * filter bar, 3-column grid, shape banner, mobile drawer.
 * BLACK accent (#1a1a1a).
 *
 * @package    NivoSync
 * @subpackage ring-builder/assets/css/elegant
 * @since      2.2.0
 */

/* ─── Scoped Reset / Isolation ──────────────────────────────────────── */

.ns-rbl--elegant,
.ns-rbl--elegant *,
.ns-rbl--elegant *::before,
.ns-rbl--elegant *::after {
    box-sizing: border-box;
}

.ns-rbl--elegant {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* Theme overrides (hide page-header, neutralise page-content, etc.)     */
/* are now centralised in assets/css/ns-rb-main.css — loaded on ALL      */
/* plugin pages. Do NOT duplicate them here.                              */

/* ─── Page Header ───────────────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-header {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 280px;
    overflow: hidden;
}

.ns-rbl--elegant .ns-rbl-header__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.ns-rbl--elegant .ns-rbl-header__content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: var(--ns-rbl-container-width, 1440px);
    margin: 0 auto;
    padding: 60px 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ns-rbl--elegant .ns-rbl-header__subtitle {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1.4;
}

.ns-rbl--elegant .ns-rbl-header__title {
    margin: 0 0 16px;
    font-size: 42px;
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.ns-rbl--elegant .ns-rbl-header__desc {
    margin: 0;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.6;
    max-width: 600px;
}

.ns-rbl--elegant .ns-rbl-header__desc a {
    color: inherit;
    text-decoration: underline;
}

/* Center desc when text-align is center */
.ns-rbl--elegant .ns-rbl-header__content[style*="text-align: center"] .ns-rbl-header__desc {
    margin-left: auto;
    margin-right: auto;
}

/* ─── Shape Banner ──────────────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-shape-banner {
    background: #f5f5f5;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ns-rbl--elegant .ns-rbl-shape-banner__inner {
    max-width: var(--ns-rbl-container-width, 1440px);
    margin: 0 auto;
    padding: 12px 100px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #555;
}

.ns-rbl--elegant .ns-rbl-shape-banner__icon {
    flex-shrink: 0;
    color: #888;
}

.ns-rbl--elegant .ns-rbl-shape-banner__text {
    flex: 1;
}

.ns-rbl--elegant .ns-rbl-shape-banner__text strong {
    color: #1a1a1a;
    font-weight: 600;
}

.ns-rbl--elegant .ns-rbl-shape-banner__clear {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 4px 10px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #555 !important;
    background: #fff !important;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: border-color 0.2s, color 0.2s !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.ns-rbl--elegant .ns-rbl-shape-banner__clear:hover,
.ns-rbl--elegant .ns-rbl-shape-banner__clear:focus,
.ns-rbl--elegant .ns-rbl-shape-banner__clear:active {
    border-color: #999 !important;
    color: #1a1a1a !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* ─── Sticky Filter Bar ─────────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-filters__sentinel {
    height: 1px;
    margin: 0;
    padding: 0;
}

.ns-rbl--elegant .ns-rbl-filters {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.ns-rbl--elegant .ns-rbl-filters.is-sticky {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.ns-rbl--elegant .ns-rbl-filters__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: var(--ns-rbl-container-width, 1440px);
    margin: 0 auto;
    padding: 20px 100px;
}

.ns-rbl--elegant .ns-rbl-filters__selects {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.ns-rbl--elegant .ns-rbl-filters__right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ─── Custom Dropdown Filter Components ────────────────────────────── */
/* All button styles use !important to override aggressive WP theme     */
/* defaults (background, color, border, padding, etc.) that target the  */
/* generic `button` element.                                            */

.ns-rbl--elegant .ns-rbl-filters__dropdown {
    position: relative;
}

/* ── Trigger button ── */
.ns-rbl--elegant .ns-rbl-filters__trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 4px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    color: #1a1a1a !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    outline: none !important;
    transition: color 0.15s !important;
}

.ns-rbl--elegant .ns-rbl-filters__trigger:hover,
.ns-rbl--elegant .ns-rbl-filters__trigger:focus,
.ns-rbl--elegant .ns-rbl-filters__trigger:active {
    color: #555 !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
}

.ns-rbl--elegant .ns-rbl-filters__trigger.is-open,
.ns-rbl--elegant .ns-rbl-filters__trigger.is-open:hover {
    color: #1a1a1a !important;
    background: none !important;
    background-color: transparent !important;
}

/* Bold label when a filter value is actively selected */
.ns-rbl--elegant .ns-rbl-filters__trigger.has-value .ns-rbl-filters__trigger-label {
    font-weight: 600 !important;
}

.ns-rbl--elegant .ns-rbl-filters__trigger-chevron {
    flex-shrink: 0;
    color: #666;
    transition: transform 0.2s ease;
}

.ns-rbl--elegant .ns-rbl-filters__trigger.is-open .ns-rbl-filters__trigger-chevron {
    transform: rotate(180deg);
}

/* ── Panel — the dropdown that opens below the trigger ── */
.ns-rbl--elegant .ns-rbl-filters__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 320px;
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
    z-index: 110;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    overflow: hidden;
    padding: 16px !important;
}

.ns-rbl--elegant .ns-rbl-filters__panel[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Right-aligned panel for Sort dropdown */
.ns-rbl--elegant .ns-rbl-filters__panel--right {
    left: auto;
    right: 0;
    min-width: 220px;
}

/* Sort panel stays as a vertical list (fewer items) */
.ns-rbl--elegant .ns-rbl-filters__panel--right .ns-rbl-filters__options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ns-rbl--elegant .ns-rbl-filters__panel--right .ns-rbl-filters__option {
    width: 100% !important;
    text-align: left !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
}

/* ── Options list — grid layout (Queensmith-style) ── */
.ns-rbl--elegant .ns-rbl-filters__options {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.ns-rbl--elegant .ns-rbl-filters__options li {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* ── Option buttons ── */
.ns-rbl--elegant .ns-rbl-filters__option {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    font-family: inherit !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-align: center !important;
    text-decoration: none !important;
    color: #555 !important;
    background: #f8f8f8 !important;
    background-color: #f8f8f8 !important;
    border: 1px solid #e8e8e8 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition: background 0.1s, color 0.1s, border-color 0.1s !important;
}

.ns-rbl--elegant .ns-rbl-filters__option:hover,
.ns-rbl--elegant .ns-rbl-filters__option:focus {
    background: #f0f0f0 !important;
    background-color: #f0f0f0 !important;
    color: #1a1a1a !important;
    border-color: #ccc !important;
    box-shadow: none !important;
    text-decoration: none !important;
    outline: none !important;
}

.ns-rbl--elegant .ns-rbl-filters__option.is-active {
    font-weight: 600 !important;
    color: #1a1a1a !important;
    background: #fff !important;
    background-color: #fff !important;
    border-color: #1a1a1a !important;
}

.ns-rbl--elegant .ns-rbl-filters__option.is-active:hover {
    background: #fff !important;
    background-color: #fff !important;
    border-color: #1a1a1a !important;
    color: #1a1a1a !important;
}

.ns-rbl--elegant .ns-rbl-filters__option:focus-visible {
    outline: 2px solid #1a1a1a !important;
    outline-offset: -2px;
}

.ns-rbl--elegant .ns-rbl-filters__count {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.45);
    white-space: nowrap;
}

.ns-rbl--elegant .ns-rbl-filters__mobile-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
    cursor: pointer !important;
    color: #1a1a1a !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.ns-rbl--elegant .ns-rbl-filters__mobile-toggle:hover,
.ns-rbl--elegant .ns-rbl-filters__mobile-toggle:focus,
.ns-rbl--elegant .ns-rbl-filters__mobile-toggle:active {
    background: #f5f5f5 !important;
    background-color: #f5f5f5 !important;
    color: #1a1a1a !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* ─── Product Grid ──────────────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-grid__wrapper {
    position: relative;
    max-width: var(--ns-rbl-container-width, 1440px);
    margin: 0 auto;
    padding: 30px 100px 60px;
}

.ns-rbl--elegant .ns-rbl-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* ─── Loading Overlay ───────────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-grid__loading {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    align-items: center;
    justify-content: center;
}

.ns-rbl--elegant .ns-rbl-grid__loading.is-active {
    display: flex;
}

.ns-rbl--elegant .ns-rbl-grid__spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #eee;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: ns-rbl-spin 0.7s linear infinite;
}

@keyframes ns-rbl-spin {
    to { transform: rotate(360deg); }
}

/* ─── Empty State ───────────────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 24px;
    color: #999;
}

.ns-rbl--elegant .ns-rbl-empty svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.ns-rbl--elegant .ns-rbl-empty__title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 500;
    color: #555;
}

.ns-rbl--elegant .ns-rbl-empty__text {
    margin: 0;
    font-size: 14px;
    color: #888;
}

/* ─── Mobile Filter Drawer ──────────────────────────────────────────── */

.ns-rbl--elegant .ns-rbl-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    visibility: hidden;
    pointer-events: none;
}

.ns-rbl--elegant .ns-rbl-drawer[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}

.ns-rbl--elegant .ns-rbl-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ns-rbl--elegant .ns-rbl-drawer[aria-hidden="false"] .ns-rbl-drawer__backdrop {
    opacity: 1;
}

.ns-rbl--elegant .ns-rbl-drawer__panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.ns-rbl--elegant .ns-rbl-drawer[aria-hidden="false"] .ns-rbl-drawer__panel {
    transform: translateY(0);
}

.ns-rbl--elegant .ns-rbl-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.ns-rbl--elegant .ns-rbl-drawer__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.ns-rbl--elegant .ns-rbl-drawer__close {
    border: none !important;
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    cursor: pointer !important;
    padding: 4px !important;
    margin: 0 !important;
    color: #666 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.ns-rbl--elegant .ns-rbl-drawer__close:hover,
.ns-rbl--elegant .ns-rbl-drawer__close:focus,
.ns-rbl--elegant .ns-rbl-drawer__close:active {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #333 !important;
}

.ns-rbl--elegant .ns-rbl-drawer__body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.ns-rbl--elegant .ns-rbl-drawer__group {
    margin-bottom: 16px;
}

.ns-rbl--elegant .ns-rbl-drawer__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.ns-rbl--elegant .ns-rbl-drawer__select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3e%3cpath fill='%23666' d='M0 0l5 6 5-6z'/%3e%3c/svg%3e") right 12px center/8px no-repeat;
    -webkit-appearance: none;
    appearance: none;
    color: #1a1a1a;
}

.ns-rbl--elegant .ns-rbl-drawer__footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

.ns-rbl--elegant .ns-rbl-drawer__clear {
    flex: 1;
    padding: 12px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
    color: #555 !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.ns-rbl--elegant .ns-rbl-drawer__clear:hover,
.ns-rbl--elegant .ns-rbl-drawer__clear:focus,
.ns-rbl--elegant .ns-rbl-drawer__clear:active {
    background: #f5f5f5 !important;
    background-color: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
}

.ns-rbl--elegant .ns-rbl-drawer__apply {
    flex: 2;
    padding: 12px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    border: none !important;
    border-radius: 8px !important;
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    box-shadow: none !important;
    color: #fff !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition: background 0.2s !important;
}

.ns-rbl--elegant .ns-rbl-drawer__apply:hover,
.ns-rbl--elegant .ns-rbl-drawer__apply:focus,
.ns-rbl--elegant .ns-rbl-drawer__apply:active {
    background: #333 !important;
    background-color: #333 !important;
    color: #fff !important;
    box-shadow: none !important;
}

/* Prevent scroll when drawer open */
body.ns-rbl-drawer-open {
    overflow: hidden;
}

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

@media (max-width: 1024px) {
    .ns-rbl--elegant .ns-rbl-header__content {
        padding: 48px 40px;
    }

    .ns-rbl--elegant .ns-rbl-shape-banner__inner {
        padding: 12px 40px;
    }

    .ns-rbl--elegant .ns-rbl-filters__bar {
        padding: 16px 40px;
    }

    .ns-rbl--elegant .ns-rbl-grid__wrapper {
        padding: 24px 40px 48px;
    }

    .ns-rbl--elegant .ns-rbl-grid {
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .ns-rbl--elegant .ns-rbl-header {
        min-height: 200px;
    }

    .ns-rbl--elegant .ns-rbl-header__content {
        padding: 32px 20px;
    }

    .ns-rbl--elegant .ns-rbl-header__title {
        font-size: 28px !important;
    }

    .ns-rbl--elegant .ns-rbl-header__subtitle {
        font-size: 11px !important;
    }

    .ns-rbl--elegant .ns-rbl-shape-banner__inner {
        padding: 10px 20px;
        font-size: 13px;
    }

    .ns-rbl--elegant .ns-rbl-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .ns-rbl--elegant .ns-rbl-grid__wrapper {
        padding: 16px 20px 40px;
    }

    /* Hide desktop filter dropdowns, show mobile toggle */
    .ns-rbl--elegant .ns-rbl-filters__selects {
        display: none;
    }

    .ns-rbl--elegant .ns-rbl-filters__sort-dropdown {
        display: none;
    }

    .ns-rbl--elegant .ns-rbl-filters__mobile-toggle {
        display: flex;
    }

    .ns-rbl--elegant .ns-rbl-filters__bar {
        padding: 10px 20px;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .ns-rbl--elegant .ns-rbl-grid {
        grid-template-columns: 1fr;
    }

    .ns-rbl--elegant .ns-rbl-header {
        min-height: 160px;
    }

    .ns-rbl--elegant .ns-rbl-header__title {
        font-size: 24px !important;
    }
}
