/* Attributes & Variations — admin editor styles
   Isolated to .av-* classes so nothing leaks into global site.css */

.av-attrs-header { margin-bottom: 8px; }
.av-attrs-title { font-size: 13px; font-weight: 500; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.av-attrs-sub { font-size: 11px; color: var(--bs-secondary-color, #6b7280); margin: 2px 0 0; }

.av-chip {
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 10px;
    padding: 1px 6px;
    background: #f4f4f5;
    color: #71717a;
    border-radius: 8px;
    border: 1px solid #e4e4e7;
}
.av-chip-accent { background: #e0f2f1; color: #0f766e; border-color: transparent; }

.av-attrs-empty {
    padding: 20px 14px;
    text-align: center;
    color: #71717a;
    font-size: 11px;
    border: 1px dashed #d4d4d8;
    border-radius: 4px;
    margin: 8px 0;
}

.av-attrs-list { display: flex; flex-direction: column; gap: 6px; }

.av-attr-card {
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    background: #fff;
    transition: border-color 120ms ease;
}
.av-attr-card:hover { border-color: #d4d4d8; }
.av-attr-card.av-open { border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,0.08); }

.av-attr-row {
    display: grid;
    grid-template-columns: 20px 160px 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 7px 10px;
}
.av-drag { color: #a1a1aa; font-size: 14px; line-height: 1; cursor: grab; user-select: none; letter-spacing: -2px; }
.av-attr-name { font-size: 12px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.av-code {
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 10px;
    color: #71717a;
    background: #fafafa;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid #e4e4e7;
}

/* Subtitle description under the attribute label (collapsed view) */
.av-attr-desc {
    font-size: 10.5px;
    color: #71717a;
    line-height: 1.3;
    display: block;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Key hint shown in expanded editor */
.av-key-hint {
    font-size: 10.5px;
    color: #71717a;
    padding: 4px 0;
}
.av-key-hint .mono {
    font-family: ui-monospace, 'Geist Mono', monospace;
    color: #3f3f46;
    background: #fafafa;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid #e4e4e7;
    margin-left: 4px;
}

/* Read-only key chip cell inside values table */
.av-key-chip-cell { text-align: center; }

.av-attr-values { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.av-val-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: transparent;
    border-radius: 10px;
    font-size: 11px;
    color: #15803d;
    border: 1px solid #86efac;
    font-weight: 500;
}
.av-val-chip.av-more { background: transparent; color: #15803d; border-style: dashed; border-color: #86efac; font-weight: 600; }

.av-attr-flags { display: flex; align-items: center; gap: 10px; }
.av-attr-actions { display: flex; gap: 2px; }

.av-attr-edit {
    border-top: 1px solid #e4e4e7;
    background: #fafaf9;
    padding: 10px 14px;
}
.av-edit-label {
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #71717a;
    margin-bottom: 4px;
    display: block;
}

/* Add button + library picker */
.av-attrs-add { margin-top: 8px; }
.av-add-btn {
    width: 100%;
    padding: 7px;
    border: 1px dashed #d4d4d8;
    border-radius: 4px;
    background: transparent;
    color: #71717a;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 120ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.av-add-btn:hover { border-color: #0f766e; color: #0f766e; background: #e0f2f1; }
.av-add-btn .plus { font-size: 13px; }

.av-picker {
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    padding: 10px;
    background: #fafaf9;
}
.av-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.av-link-accent { color: #0f766e; text-decoration: none; }
.av-lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 6px;
}
.av-lib-item {
    padding: 7px 10px;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    cursor: pointer;
    transition: all 120ms ease;
}
.av-lib-item:not(.disabled):hover { border-color: #0f766e; background: #e0f2f1; }
.av-lib-item.disabled { opacity: 0.4; cursor: not-allowed; }
.av-lib-item .n { font-size: 12px; font-weight: 500; }
.av-lib-item .c { font-size: 10.5px; color: #71717a; margin-top: 1px; }

/* Variations header + formula bar */
.av-variations { margin-top: 16px; }
.av-var-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.av-var-actions { display: flex; gap: 6px; align-items: center; }

.av-var-math {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fafaf9;
    border: 1px solid #e4e4e7;
    border-radius: 4px 4px 0 0;
    font-size: 12px;
    flex-wrap: wrap;
}
.av-formula { font-family: ui-monospace, 'Geist Mono', monospace; font-size: 12px; color: #3f3f46; }
.av-formula .nums { color: #18181b; font-weight: 500; }
.av-formula .equals { color: #0f766e; }
.av-formula .total {
    color: #0f766e;
    font-weight: 500;
    font-family: 'Fraunces', serif;
    font-size: 15px;
    padding: 0 3px;
}
.av-var-status { display: flex; gap: 12px; font-size: 11px; color: #52525b; }
.av-var-status b { font-family: ui-monospace, 'Geist Mono', monospace; font-weight: 500; color: #18181b; }

.av-bulk-panel {
    padding: 8px 12px;
    border: 1px solid #e4e4e7;
    border-top: 0;
    background: #fffbeb;
}

.av-var-toolbar {
    padding: 6px 10px;
    display: flex;
    gap: 6px;
    align-items: center;
    border: 1px solid #e4e4e7;
    border-top: 0;
    background: #fff;
    flex-wrap: wrap;
    min-height: 36px;
}
.av-sel-info {
    font-size: 11px;
    color: #0f766e;
    background: #e0f2f1;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}
/* Table */
.av-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid #e4e4e7;
    border-top: 0;
    scrollbar-width: thin;
    scrollbar-color: #a1a1aa #f4f4f5;
}
.av-table-wrap::-webkit-scrollbar {
    height: 10px;
}
.av-table-wrap::-webkit-scrollbar-track {
    background: #f4f4f5;
    border-top: 1px solid #e4e4e7;
}
.av-table-wrap::-webkit-scrollbar-thumb {
    background: #a1a1aa;
    border-radius: 6px;
    border: 2px solid #f4f4f5;
}
.av-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #71717a;
}
.av-var-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.av-var-table thead th {
    text-align: left;
    padding: 6px 8px;
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #71717a;
    font-weight: 500;
    background: #fafaf9;
    border-bottom: 1px solid #e4e4e7;
    white-space: nowrap;
}

/* Column header filter chrome */
.av-var-table thead th .av-th {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.av-var-table thead th.is-filtered { background: #fefce8; }
.av-th-label { display: inline-block; }
.av-filter-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
}
.av-th-filter-btn {
    border: 0;
    background: transparent;
    padding: 0 2px;
    color: #a1a1aa;
    cursor: pointer;
    line-height: 1;
    font-size: 13px;
    border-radius: 3px;
}
.av-th-filter-btn:hover { color: #18181b; background: #f4f4f5; }
.av-th-filter-btn.active { color: #d97706; }
.av-th-filter-btn:focus-visible { outline: 2px solid #fde68a; outline-offset: 1px; }

/* Filter popover body */
.av-filter-pop {
    width: 240px;
    padding: 8px;
    font-size: 12px;
    color: #18181b;
    text-transform: none;
    letter-spacing: normal;
}
.av-filter-pop.is-text { width: 220px; }
.av-filter-pop.is-status { width: 180px; }
.av-filter-pop-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: #3f3f46;
}
.av-filter-pop-search { margin-bottom: 6px; }
.av-filter-pop-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #f4f4f5;
    border-radius: 4px;
    padding: 4px;
    background: #fafafa;
}
.av-filter-pop-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 3px;
    cursor: pointer;
    margin: 0;
}
.av-filter-pop-item:hover { background: #f4f4f5; }
.av-filter-pop-item .form-check-input { margin: 0; flex: 0 0 auto; }
.av-filter-pop-label { flex: 1; }
.av-filter-pop-count {
    color: #a1a1aa;
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 11px;
}
.av-filter-pop-empty {
    padding: 12px;
    text-align: center;
    color: #a1a1aa;
}
.av-filter-pop-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f4f4f5;
}
.av-filter-pop-foot .btn-link { font-size: 11px; text-decoration: none; }

.av-var-table tbody tr { border-bottom: 1px solid #f4f4f5; transition: background 80ms ease; }
.av-var-table tbody tr:hover { background: #fafaf9; }
.av-var-table tbody tr.selected { background: #e0f2f1; }
.av-var-table tbody tr.inactive { opacity: 0.6; }
.av-var-table td { padding: 5px 8px; vertical-align: middle; white-space: nowrap; }

.av-sku-input, .av-num-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 5px;
    border-radius: 3px;
    font: inherit;
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 11px;
    color: #18181b;
    outline: none;
    width: 100%;
}
.av-sku-input { width: 100px; text-overflow: ellipsis; }
.av-num-input { width: 90px; text-align: right; }
.av-compare-input { color: #71717a; }
.av-sku-input:hover, .av-num-input:hover { border-color: #e4e4e7; background: #fafaf9; }
.av-sku-input:focus, .av-num-input:focus {
    border-color: #0f766e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15,118,110,0.08);
}

.av-v-pill {
    display: inline-block;
    padding: 1px 6px;
    background: #f4f4f5;
    border-radius: 6px;
    font-size: 10.5px;
    color: #3f3f46;
}

.av-stock-cell { display: inline-flex; align-items: center; gap: 4px; }
.av-stock-dot { width: 6px; height: 6px; border-radius: 50%; background: #16a34a; display: inline-block; }
.av-stock-dot.low { background: #ea580c; }
.av-stock-dot.out { background: #dc2626; }

.av-check {
    width: 14px; height: 14px;
    border: 1.5px solid #d4d4d8;
    border-radius: 3px;
    display: inline-grid; place-items: center;
    cursor: pointer;
    background: #fff;
    transition: all 100ms ease;
    vertical-align: middle;
}
.av-check.checked, .av-check.indeterminate { background: #0f766e; border-color: #0f766e; }
.av-check.checked::after {
    content: ""; width: 4px; height: 8px;
    border-right: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    transform: rotate(45deg) translate(-1px, -1px);
}
.av-check.indeterminate::after {
    content: ""; width: 7px; height: 1.5px; background: #fff;
}

.av-status-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    letter-spacing: 0.01em;
}
.av-status-tag.active { background: #dcfce7; color: #166534; }
.av-status-tag.paused { background: #f4f4f5; color: #71717a; }
.av-status-tag.oos { background: #fee2e2; color: #991b1b; }

/* Pagination */
.av-pager {
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #71717a;
    border: 1px solid #e4e4e7;
    border-top: 0;
    border-radius: 0 0 4px 4px;
    background: #fafaf9;
    gap: 8px;
    flex-wrap: wrap;
}
.av-pager-controls { display: flex; gap: 6px; align-items: center; }
.av-pager-size { width: auto; }
.av-pager-pages { display: flex; gap: 2px; }
.av-pager-pages .btn { min-width: 24px; padding: 2px 6px; font-family: ui-monospace, 'Geist Mono', monospace; font-size: 11px; border: 1px solid transparent; background: transparent; color: #3f3f46; border-radius: 3px; }
.av-pager-pages .btn:hover { background: #f4f4f5; }
.av-pager-pages .av-pager-current { background: #18181b; color: #fff; border-color: #18181b; }
.av-pager-pages .btn[disabled] { opacity: 0.4; pointer-events: none; }

/* Storefront preview */
.av-sf-preview { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e4e4e7; }
.av-sf-head { margin-bottom: 8px; }
.av-sf-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 12px;
    display: grid;
    grid-template-columns: 140px 1fr 180px;
    gap: 14px;
    align-items: center;
}
.av-sf-img {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    background-color: #f4f4f5;
}
.av-sf-body { min-width: 0; }
.av-sf-title { font-family: 'Fraunces', serif; font-size: 16px; letter-spacing: -0.01em; margin-bottom: 8px; }
.av-sf-options { display: flex; flex-direction: column; gap: 7px; }
.av-sf-opt-label {
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #71717a;
}
.av-sf-opts-inline { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.av-sf-opt {
    padding: 4px 8px;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    font-size: 11px;
    background: #fff;
    cursor: pointer;
    color: #3f3f46;
}
.av-sf-opt:hover { border-color: #a1a1aa; }
.av-sf-opt.active { background: #18181b; color: #fff; border-color: #18181b; }
.av-sf-opt.unavail { opacity: 0.35; text-decoration: line-through; cursor: not-allowed; }

.av-sf-price {
    text-align: right;
    border-left: 1px solid #e4e4e7;
    padding-left: 14px;
}
.av-sf-price .p {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}
.av-sf-price .cmp { font-size: 11px; color: #71717a; text-decoration: line-through; margin-top: 3px; }
.av-sf-price .per { font-size: 11px; color: #71717a; margin-top: 4px; }
.av-sf-price .sku {
    font-family: ui-monospace, 'Geist Mono', monospace;
    font-size: 10px;
    color: #71717a;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e4e4e7;
}
.av-sf-price .stock {
    font-size: 11px;
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

@media (max-width: 900px) {
    .av-attr-row { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
    .av-attr-flags { flex-wrap: wrap; }
    .av-sf-card { grid-template-columns: 1fr; }
    .av-sf-price { border-left: 0; border-top: 1px solid #e4e4e7; padding: 14px 0 0; text-align: left; }
    .av-sf-price .stock { justify-content: flex-start; }
}
