/**
 * Product flow styles (PEWC select box overrides + race condition UI).
 * Consolidated to keep the front-end lean.
 */

/* === PEWC Select Box Overrides === */
.pewc-moved-to-ddslick {
    display: none !important;
}

.dd-container,
.dd-container .dd-select {
    width: 100% !important;
    box-sizing: border-box;
}

.dd-select a.dd-selected {
    display: flex !important;
    align-items: center !important;
    padding: 10px !important;
    text-align: left !important;
}

.pewc-select-box-field-wrapper .dd-select {
    padding: 10px !important;
    text-align: left !important;
    min-height: 64px !important;
}

.dd-selected-content-custom-layout {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
}

.dd-option-image {
    vertical-align: middle;
    float: left;
    margin-right: 5px;
    max-width: 64px;
    max-height: 64px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.dd-selected-image-box-custom {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-right: 12px;
}

.dd-selected-image-box-custom .dd-selected-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.dd-selected-main-text-area-custom {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    flex-grow: 1;
    overflow: hidden;
}

.dd-selected-left-text-column-custom {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    padding-right: 8px;
    overflow: hidden;
}

.pewc-dd-field-label-custom {
    font-size: 1em;
    font-weight: bold;
    line-height: 1.25;
    margin-bottom: 3px;
    color: #111;
    word-wrap: break-word;
}

.pewc-dd-field-label-custom .required {
    color: red;
    font-weight: bold;
    margin-left: 2px;
}

.pewc-dd-option-name-custom {
    font-size: 0.9em;
    font-weight: normal;
    line-height: 1.3;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-selected-right-price-column-custom {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex-shrink: 0;
    padding-left: 8px;
    text-align: right;
}

.dd-selected-right-price-column-custom small.dd-selected-description {
    font-size: 0.95em;
    font-weight: bold;
    line-height: 1.25;
    color: #111111;
    white-space: nowrap;
}

.pewc-item-products-select-box > .pewc-item-field-wrapper > h4.pewc-field-label,
.pewc-item-select-box > .pewc-item-field-wrapper > h4.pewc-field-label,
.pewc-item-products-select-box > .pewc-item-field-wrapper > p.pewc-description,
.pewc-item-select-box > .pewc-item-field-wrapper > p.pewc-description {
    display: none !important;
}

ul.dd-options li a.dd-option small.dd-option-description {
    color: #000000;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.3;
}

.pewc-product-extra-groups li {
    margin-bottom: 0 !important;
}

/* === Race Condition UI Feedback === */
.pewc-race-fix-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.pewc-race-fix-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: pewc-spin 0.8s linear infinite;
}

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

.pewc-race-fix-text {
    margin-top: 8px;
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.pewc-locked {
    position: relative;
    opacity: 0.8;
    pointer-events: none !important;
}

.pewc-locked * {
    pointer-events: none !important;
}

.pewc-race-fix-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2271b1;
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    font-size: 14px;
    max-width: 300px;
}

@media (max-width: 768px) {
    .pewc-race-fix-notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}
