/* =============================================
   Ouidget WooCommerce — Base Styles
   Visual overrides live in Elementor controls.
   This file normalises layout only.
   ============================================= */

/* ── Variations wrapper ── */
.ouidget-variations-wrapper {
    width: 100%;
}

.ouidget-variations-wrapper .variations_form {
    margin: 0;
    padding: 0;
}

/* ── Row layout: stacked (default) ── */
.ouidget-variations-wrapper.row-layout-stacked .ouidget-variation-row {
    display: flex;
    flex-direction: column;
}

/* ── Row layout: inline ── */
.ouidget-variations-wrapper.row-layout-inline .ouidget-variation-row {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.ouidget-variations-wrapper.row-layout-inline .ouidget-variation-input {
    flex: 1;
}

/* ── Labels ── */
.ouidget-variation-label {
    display: block;
}

.ouidget-variation-label label {
    display: block;
    cursor: default;
    margin: 0;
    padding: 0;
}

/* ── Dropdown normalisation ── */
.ouidget-variation-input select {
    appearance: auto;
    -webkit-appearance: auto;
    display: block;
    box-sizing: border-box;
    height: auto;
    max-width: 100%;
    line-height: normal;
}

/* ── Inline list ── */
.ouidget-list-items {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Hide the native select in list mode — keep it in DOM for WC JS */
.input-type-list .ouidget-variation-input > select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.ouidget-list-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    line-height: normal;
    text-align: center;
}

.ouidget-list-item:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ── Reset link ── */
.ouidget-reset-wrap {
    display: block;
}

.ouidget-reset-link {
    display: inline-block;
    text-decoration: underline;
    cursor: pointer;
}

/* ── Add to Cart wrapper ── */
.ouidget-addtocart-wrapper {
    width: 100%;
}

.ouidget-addtocart-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ── Quantity ── */
.ouidget-addtocart-wrapper .quantity {
    display: flex;
    align-items: center;
}

.ouidget-addtocart-wrapper .quantity input.qty {
    display: block;
    box-sizing: border-box;
    text-align: center;
    -moz-appearance: textfield;
}

.ouidget-addtocart-wrapper .quantity input.qty::-webkit-outer-spin-button,
.ouidget-addtocart-wrapper .quantity input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Button ── */
.ouidget-addtocart-wrapper .single_add_to_cart_button {
    display: inline-block;
    cursor: pointer;
    line-height: normal;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
    border: none;
    outline: none;
}

.ouidget-addtocart-wrapper .single_add_to_cart_button.disabled {
    cursor: not-allowed;
    pointer-events: auto;
}

.ouidget-addtocart-wrapper .single_add_to_cart_button.loading {
    opacity: 0.7;
}

/* ── Price ── */
.ouidget-price-display {
    display: block;
}

.ouidget-price-display del {
    opacity: 0.6;
    margin-right: 4px;
}

/* ── Category Tree ── */
.ouidget-cat-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ouidget-cat-tree ul.children {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-left: 18px;
}

.ouidget-cat-tree li {
    margin-bottom: 6px;
}

.ouidget-cat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding-bottom: 6px;
}

.ouidget-cat-item a {
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.ouidget-cat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    width: 1.2em;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ouidget-cat-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.ouidget-cat-tree li.expanded > .ouidget-cat-item > .ouidget-cat-toggle .toggle-expand {
    display: none;
}

.ouidget-cat-tree li.collapsed > .ouidget-cat-item > .ouidget-cat-toggle .toggle-collapse {
    display: none;
}

.ouidget-cat-count {
    display: inline-block;
    font-size: 0.85em;
    opacity: 0.7;
    white-space: nowrap;
}

/* ── Featured Products ── */
.ouidget-fp-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ouidget-fp-card {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.ouidget-fp-img-wrap {
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}

.ouidget-fp-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    display: block;
}

.ouidget-fp-badge {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 10px;
    line-height: 1;
    padding: 2px 5px;
    white-space: nowrap;
}

.ouidget-fp-badge--sale {
    background-color: #e2401c;
    color: #fff;
}

.ouidget-fp-badge--featured {
    background-color: #4169e1;
    color: #fff;
}

.ouidget-fp-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ouidget-fp-cat {
    font-size: 0.75em;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ouidget-fp-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.ouidget-fp-stars {
    font-size: 12px;
    line-height: 1;
    color: #f5a623;
    letter-spacing: 1px;
}

.ouidget-fp-price {
    font-size: 0.9em;
}

.ouidget-fp-price del {
    opacity: 0.5;
    margin-right: 4px;
}

.ouidget-fp-price ins {
    text-decoration: none;
}

/* ── Product Search ── */
.ouidget-search-wrapper {
    position: relative;
    width: 100%;
}

.ouidget-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.ouidget-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    color: inherit;
    opacity: 0.5;
}

.ouidget-search-icon svg {
    width: 16px;
    height: 16px;
}

.ouidget-search-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 40px 10px 38px;
    border: 1px solid #ccc;
    outline: none;
    background: #fff;
    font-size: inherit;
    font-family: inherit;
    line-height: normal;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ouidget-search-input:focus {
    border-color: #666;
}

/* Spinner */
.ouidget-search-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.ouidget-search-spinner.active {
    opacity: 0.5;
    animation: ouidget-spin 0.6s linear infinite;
}

@keyframes ouidget-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Results dropdown */
.ouidget-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ouidget-search-results.visible {
    display: block;
}

/* Result item */
.ouidget-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.ouidget-search-item:hover,
.ouidget-search-item.active {
    background-color: #f5f5f5;
}

.ouidget-search-item + .ouidget-search-item {
    border-top: 1px solid #eee;
}

.ouidget-search-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    flex-shrink: 0;
}

.ouidget-search-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ouidget-search-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ouidget-search-item-cat {
    font-size: 0.8em;
    opacity: 0.6;
}

.ouidget-search-item-price {
    font-size: 0.85em;
}

.ouidget-search-item-price del {
    opacity: 0.5;
}

/* No results */
.ouidget-search-no-results {
    padding: 16px 12px;
    text-align: center;
    opacity: 0.6;
}

/* ── Editor placeholder ── */
.ouidget-placeholder {
    padding: 20px;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    text-align: center;
    color: #888;
    font-size: 13px;
}
