/**
 * Wholesale Pricing B2B - Frontend Styles
 */

/* Pricing Display */
.wpb2b-price-display {
    font-size: 1.25em;
    font-weight: bold;
    color: #77a464;
}

.wpb2b-price-display.loading {
    opacity: 0.5;
    position: relative;
}

.wpb2b-price-display.loading::after {
    content: "";
    position: absolute;
    right: -25px;
    top: 50%;
    width: 15px;
    height: 15px;
    margin-top: -7px;
    border: 2px solid #f3f3f3;
    border-radius: 50%;
    border-top: 2px solid #77a464;
    animation: wpb2b-spin 1s linear infinite;
}

@keyframes wpb2b-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Savings Display */
.wpb2b-savings {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    background: #77a464;
    color: #fff;
    border-radius: 3px;
    font-size: 0.875em;
    font-weight: normal;
}

.wpb2b-total-price {
    margin-top: 10px;
    padding: 10px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
}

.wpb2b-total-price .label {
    font-weight: 600;
    margin-right: 5px;
}

.wpb2b-total-price .amount {
    color: #77a464;
    font-size: 1.1em;
    font-weight: bold;
}

/* Pricing Table */
.wpb2b-pricing-table-container {
    margin: 20px 0;
    overflow-x: auto;
}

.wpb2b-pricing-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

.wpb2b-pricing-table caption {
    padding: 10px;
    font-size: 1.1em;
    font-weight: 600;
    text-align: left;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
}

.wpb2b-pricing-table thead {
    background: #333;
    color: #fff;
}

.wpb2b-pricing-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.wpb2b-pricing-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.wpb2b-pricing-table tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.wpb2b-pricing-table tbody tr:hover {
    background: #f9f9f9;
}

.wpb2b-pricing-table tbody tr.highlight {
    background: #fff9e6;
}

.wpb2b-pricing-table tbody tr.selected {
    background: #e8f5e9;
    border-left: 3px solid #77a464;
}

.wpb2b-pricing-table .price {
    font-weight: bold;
    color: #77a464;
}

.wpb2b-pricing-table .original-price {
    text-decoration: line-through;
    color: #999;
    margin-right: 5px;
}

.wpb2b-pricing-table .discount-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #ff5722;
    color: #fff;
    border-radius: 3px;
    font-size: 0.85em;
    margin-left: 5px;
}

/* Bulk Quantity Selector */
.wpb2b-quantity-selector {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.wpb2b-quantity-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.wpb2b-quantity-tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.wpb2b-quantity-tier {
    flex: 1 1 100px;
    padding: 10px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wpb2b-quantity-tier:hover {
    border-color: #77a464;
    background: #f5faf5;
}

.wpb2b-quantity-tier.active {
    border-color: #77a464;
    background: #77a464;
    color: #fff;
}

.wpb2b-quantity-tier .qty {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.wpb2b-quantity-tier .price {
    display: block;
    font-size: 0.9em;
}

.wpb2b-quantity-tier .unit-price {
    display: block;
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 3px;
}

/* Role Badge */
.wpb2b-role-badge {
    display: inline-block;
    padding: 3px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 15px;
    font-size: 0.85em;
    margin: 5px 0;
}

.wpb2b-role-badge.wholesale {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.wpb2b-role-badge.vip {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Customer Pricing Notice */
.wpb2b-customer-notice {
    margin: 15px 0;
    padding: 12px 15px;
    background: #e8f5e9;
    border-left: 4px solid #77a464;
    border-radius: 3px;
}

.wpb2b-customer-notice .icon {
    display: inline-block;
    margin-right: 8px;
    color: #77a464;
}

.wpb2b-customer-notice strong {
    color: #333;
}

/* Price Request Form */
.wpb2b-price-request-form {
    margin: 20px 0;
    padding: 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.wpb2b-price-request-form h3 {
    margin-top: 0;
    color: #333;
}

.wpb2b-price-request-form .form-row {
    margin-bottom: 15px;
}

.wpb2b-price-request-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.wpb2b-price-request-form input[type="text"],
.wpb2b-price-request-form input[type="email"],
.wpb2b-price-request-form input[type="number"],
.wpb2b-price-request-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.wpb2b-price-request-form button {
    background: #77a464;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background 0.2s ease;
}

.wpb2b-price-request-form button:hover {
    background: #5f8550;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .wpb2b-pricing-table-container {
        margin: 15px -15px;
    }
    
    .wpb2b-pricing-table {
        font-size: 0.9em;
    }
    
    .wpb2b-pricing-table th,
    .wpb2b-pricing-table td {
        padding: 8px;
    }
    
    .wpb2b-quantity-tiers {
        flex-direction: column;
    }
    
    .wpb2b-quantity-tier {
        flex: 1 1 auto;
    }
    
    .wpb2b-customer-notice {
        font-size: 0.95em;
        padding: 10px 12px;
    }
}

/* Shop Loop Integration */
.products .product .wpb2b-loop-price {
    margin-top: 5px;
}

.products .product .wpb2b-wholesale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #77a464;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
}

.products .product .wpb2b-bulk-available {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
}

.products .product .wpb2b-bulk-available strong {
    color: #77a464;
}

/* Cart Page Enhancements */
.woocommerce-cart .wpb2b-cart-savings {
    padding: 10px;
    background: #e8f5e9;
    border: 1px solid #77a464;
    border-radius: 3px;
    margin-bottom: 20px;
}

.woocommerce-cart .wpb2b-cart-savings .title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.woocommerce-cart .wpb2b-cart-savings .amount {
    font-size: 1.3em;
    color: #77a464;
    font-weight: bold;
}

/* Checkout Page */
.woocommerce-checkout .wpb2b-order-savings {
    padding: 15px;
    background: #fff9e6;
    border: 1px solid #ffc107;
    border-radius: 3px;
    margin: 20px 0;
}

.woocommerce-checkout .wpb2b-order-savings .icon {
    display: inline-block;
    margin-right: 10px;
    color: #ffc107;
    font-size: 1.2em;
}

/* Animation Effects */
.wpb2b-fade-in {
    animation: wpb2bFadeIn 0.3s ease-in;
}

@keyframes wpb2bFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpb2b-pulse {
    animation: wpb2bPulse 1s infinite;
}

@keyframes wpb2bPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}