/**
 * Reorder Styles
 *
 * @package PihlfeltB2B
 */

/* Reorder button */
.pb2b-reorder-action {
    margin-top: 20px;
}

.pb2b-reorder-button {
    display: inline-block;
}

/* Quick order description */
.pb2b-quick-order-description {
    color: #666;
    margin-bottom: 20px;
}

/* Product search wrapper */
.pb2b-product-search-wrapper {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
    position: relative;
}

/* On My Account page, no extra margin/padding needed */
.woocommerce-account .pb2b-product-search-wrapper {
    margin-top: 0;
    padding: 0;
    background: transparent;
}

.pb2b-product-search-wrapper h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.pb2b-search-input-wrapper {
    position: relative;
}

#pb2b-product-search {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#pb2b-product-search:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

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

/* Search item */
.pb2b-search-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.pb2b-search-item:last-child {
    border-bottom: none;
}

.pb2b-search-item:hover {
    background: #f5f5f5;
}

.pb2b-search-item-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
}

.pb2b-search-item-info {
    flex: 1;
    min-width: 0;
}

.pb2b-search-item-name {
    display: block;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb2b-search-item-name:hover {
    color: #0073aa;
}

.pb2b-search-item-meta {
    font-size: 13px;
    color: #666;
}

.pb2b-search-item-meta span {
    margin-right: 10px;
}

.pb2b-search-item-price {
    font-weight: 600;
    color: #333;
}

.pb2b-search-item-actions {
    flex-shrink: 0;
    margin-left: 12px;
}

/* Quantity input */
.pb2b-qty-wrapper {
    display: inline-block;
    margin-right: 8px;
}

.pb2b-qty-input {
    width: 60px !important;
    padding: 6px 8px !important;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.pb2b-qty-input:focus {
    border-color: #0073aa;
    outline: none;
}

.pb2b-add-to-cart {
    white-space: nowrap;
}

.pb2b-add-to-cart.pb2b-added {
    background: #46b450 !important;
    border-color: #46b450 !important;
    color: #fff !important;
}

.pb2b-out-of-stock {
    color: #a00;
    font-size: 13px;
}

/* Search messages */
.pb2b-search-message {
    padding: 15px;
    text-align: center;
    color: #666;
}

.pb2b-search-message--loading {
    color: #0073aa;
}

.pb2b-search-message--error {
    color: #a00;
}

/* Mini cart on quick-order page */
.pb2b-mini-cart-wrapper {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pb2b-mini-cart-wrapper h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.pb2b-mini-cart-count {
    font-weight: normal;
    color: #666;
}

.pb2b-mini-cart-empty {
    color: #666;
    font-style: italic;
    margin: 20px 0;
}

.pb2b-mini-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.pb2b-mini-cart-table th,
.pb2b-mini-cart-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.pb2b-mini-cart-table th {
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
}

.pb2b-col-qty,
.pb2b-col-price {
    text-align: right;
    white-space: nowrap;
}

.pb2b-col-remove {
    width: 30px;
    text-align: center;
}

.pb2b-sku {
    color: #999;
    font-size: 12px;
}

.pb2b-remove-item {
    background: none;
    border: none;
    color: #a00;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.pb2b-remove-item:hover {
    color: #dc3232;
}

.pb2b-mini-cart-totals {
    text-align: right;
    padding-top: 10px;
    border-top: 2px solid #ddd;
}

.pb2b-mini-cart-total {
    font-size: 16px;
    margin: 0;
}

.pb2b-cart-total-amount {
    font-size: 18px;
}

.pb2b-mini-cart-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.pb2b-mini-cart-actions .button {
    margin: 0;
}

/* Highlight newly added row */
.pb2b-mini-cart-table tr.pb2b-just-added {
    background: #e7f7e7;
    animation: pb2b-highlight-fade 2s ease-out;
}

@keyframes pb2b-highlight-fade {
    0% { background: #c6efc6; }
    100% { background: transparent; }
}

/* Responsive */
@media screen and (max-width: 600px) {
    .pb2b-search-item {
        flex-wrap: wrap;
    }

    .pb2b-search-item-image {
        width: 40px;
        height: 40px;
    }

    .pb2b-search-item-info {
        width: calc(100% - 52px);
    }

    .pb2b-search-item-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .pb2b-qty-wrapper {
        margin-right: 0;
    }

    .pb2b-qty-input {
        width: 50px !important;
    }

    .pb2b-add-to-cart {
        flex: 1;
    }

    /* Mini cart responsive */
    .pb2b-mini-cart-table th {
        font-size: 11px;
    }

    .pb2b-mini-cart-table td {
        padding: 8px 5px;
        font-size: 14px;
    }

    .pb2b-mini-cart-actions {
        flex-direction: column;
    }

    .pb2b-mini-cart-actions .button {
        width: 100%;
        text-align: center;
    }
}
