/**
 * Advanced Price Lists for WooCommerce - Frontend Styles
 * Version: 1.0.0
 */

/* =============================================================================
   User Price List Information
   ========================================================================== */

.aplwc-user-pricelist-info {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.aplwc-pricelist-badge {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
}

.aplwc-pricelist-icon {
    margin-right: 8px;
    font-size: 18px;
    color: #ffd700;
}

.aplwc-discount-badge {
    background: #ff4757;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

.aplwc-b2b-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    opacity: 0.9;
}

.aplwc-b2b-icon {
    margin-right: 8px;
    font-size: 16px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* =============================================================================
   Quantity Pricing Table
   ========================================================================== */

.aplwc-quantity-pricing-wrapper {
    margin: 20px 0;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.aplwc-price-range-display h4 {
    background: #f8f9fa;
    margin: 0;
    padding: 15px 20px;
    color: #2c3e50;
    font-size: 18px;
    border-bottom: 1px solid #e1e5e9;
}

.aplwc-quantity-pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.aplwc-quantity-pricing-table thead th {
    background: #34495e;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.aplwc-quantity-pricing-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f2f6;
    font-size: 14px;
}

.aplwc-quantity-pricing-table tbody tr:last-child td {
    border-bottom: none;
}

.aplwc-quantity-pricing-table tbody tr:hover {
    background: #f8f9fa;
}

.aplwc-quantity-pricing-table tbody tr:nth-child(even) {
    background: #fbfcfd;
}

.aplwc-quantity-pricing-table tbody tr:nth-child(even):hover {
    background: #f1f2f6;
}

/* =============================================================================
   Cart and Checkout Information
   ========================================================================== */

.aplwc-cart-pricelist-notice {
    margin-bottom: 20px;
}

.aplwc-cart-pricelist-notice .woocommerce-info {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 15px 20px;
    color: #2c5aa0;
    font-weight: 500;
}

.aplwc-checkout-pricelist-info {
    margin-bottom: 25px;
}

.aplwc-checkout-pricelist-info .woocommerce-info {
    background: #f0f8ff;
    border: 1px solid #b8daff;
    border-radius: 6px;
    padding: 20px;
}

.aplwc-checkout-pricelist-info h3 {
    margin-top: 0;
    color: #2c5aa0;
    font-size: 18px;
}

.aplwc-quantity-break-info {
    color: #7f8c8d;
    font-style: italic;
    font-size: 12px;
}

/* =============================================================================
   Account Dashboard Section Divider
   ========================================================================== */

.aplwc-section-divider {
    border: none;
    border-top: 1px solid #e1e5e9;
    margin: 30px 0 25px 0;
}

/* =============================================================================
   Account Dashboard Pricing Summary
   ========================================================================== */

.aplwc-account-pricing-summary {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
}

.aplwc-account-pricing-summary h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 22px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.aplwc-pricing-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.aplwc-pricing-card {
    flex: 1;
    min-width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    overflow: hidden;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.aplwc-pricing-card.aplwc-b2b-card {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.aplwc-card-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aplwc-card-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.aplwc-b2b-badge {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aplwc-b2b-icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.aplwc-card-body {
    padding: 20px;
}

.aplwc-card-body p {
    margin: 0 0 10px 0;
    opacity: 0.9;
}

.aplwc-card-body ul {
    margin: 0;
    padding-left: 20px;
    opacity: 0.9;
}

.aplwc-card-body li {
    margin-bottom: 8px;
}

.aplwc-pricing-cta {
    text-align: center;
}

.aplwc-shop-now-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.aplwc-shop-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

/* =============================================================================
   Price Display Enhancements
   ========================================================================== */

.aplwc-dynamic-price {
    font-weight: bold;
    color: #e74c3c;
}

.aplwc-original-price {
    text-decoration: line-through;
    color: #95a5a6;
    margin-right: 8px;
}

.aplwc-savings-badge {
    background: #27ae60;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
}

/* =============================================================================
   Loading States
   ========================================================================== */

.aplwc-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.aplwc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3498db;
    border-top-color: transparent;
    border-radius: 50%;
    animation: aplwc-spin 1s linear infinite;
}

@keyframes aplwc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .aplwc-pricing-cards {
        flex-direction: column;
    }
    
    .aplwc-quantity-pricing-table {
        font-size: 12px;
    }
    
    .aplwc-quantity-pricing-table thead th,
    .aplwc-quantity-pricing-table tbody td {
        padding: 8px 10px;
    }
    
    .aplwc-user-pricelist-info {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .aplwc-pricelist-badge {
        font-size: 14px;
        flex-wrap: wrap;
    }
    
    .aplwc-discount-badge {
        margin: 5px 0 0 0;
        order: 3;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .aplwc-quantity-pricing-table thead th:nth-child(n+3),
    .aplwc-quantity-pricing-table tbody td:nth-child(n+3) {
        display: none;
    }
    
    .aplwc-account-pricing-summary {
        padding: 15px;
    }
    
    .aplwc-card-header,
    .aplwc-card-body {
        padding: 15px;
    }
}

/* =============================================================================
   WooCommerce Integration Overrides
   ========================================================================== */

.woocommerce .aplwc-quantity-pricing-wrapper {
    clear: both;
}

.woocommerce-page .aplwc-user-pricelist-info {
    margin-top: 0;
}

.single-product .aplwc-quantity-pricing-wrapper {
    margin: 20px 0 30px 0;
}

/* Ensure compatibility with popular themes */
.storefront .aplwc-user-pricelist-info,
.astra .aplwc-user-pricelist-info,
.oceanwp .aplwc-user-pricelist-info {
    margin-bottom: 20px;
}

/* =============================================================================
   Print Styles
   ========================================================================== */

@media print {
    .aplwc-user-pricelist-info,
    .aplwc-cart-pricelist-notice,
    .aplwc-checkout-pricelist-info {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }

    .aplwc-quantity-pricing-table {
        border-collapse: collapse;
    }

    .aplwc-quantity-pricing-table th,
    .aplwc-quantity-pricing-table td {
        border: 1px solid #ccc;
    }
}

/* =============================================================================
   Hidden Prices Message for Guests
   ========================================================================== */

.aplwc-hidden-price-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.aplwc-hidden-price-message {
    color: #333;
    font-style: normal;
    font-size: 0.8em;
    font-weight: 600;
}

.aplwc-register-button {
    background: #000 !important;
    color: #fff !important;
    padding: 12px 24px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
}

.aplwc-register-button:hover {
    background: #333 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
    color: #fff !important;
}

@media (max-width: 768px) {
    .aplwc-hidden-price-container {
        align-items: center;
        text-align: center;
    }

    .aplwc-register-button {
        width: 100%;
        text-align: center;
    }
}

/* =============================================================================
   Hide WooCommerce stock messages when prices are hidden for guests
   ========================================================================== */

/* When hidden price container is visible, hide the out of stock message */
.aplwc-hidden-price-container ~ .stock.out-of-stock,
.aplwc-hidden-price-container ~ p.stock.out-of-stock,
.summary .aplwc-hidden-price-container ~ .stock {
    display: none !important;
}

/* Also hide via body class when guest mode is active */
body.aplwc-guest-mode .single-product .stock.out-of-stock {
    display: none !important;
}