/**
 * APMR Bullion Pricing - Frontend Styles
 */

/* Pricing Table */
.apmr-bp-pricing-table-wrapper {
    margin: 20px 0;
    clear: both;
}

.apmr-bp-pricing-table-wrapper h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
}

.apmr-bp-pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.apmr-bp-pricing-table th,
.apmr-bp-pricing-table td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #ddd;
}

.apmr-bp-pricing-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    white-space: nowrap;
}

/* Premium Savings column - stacked text */
.apmr-bp-pricing-table th.premium-savings-header {
    white-space: normal;
    line-height: 1.2;
    text-align: center;
    min-width: auto;
    width: auto;
    padding: 6px 4px;
}

/* QTY column optimization */
.apmr-bp-pricing-table th:first-child,
.apmr-bp-pricing-table td:first-child {
    width: 8%;
    text-align: center;
}

/* Payment method columns auto-size equally */
.apmr-bp-pricing-table th.payment-method-card,
.apmr-bp-pricing-table th.payment-method-ach,
.apmr-bp-pricing-table th.payment-method-wire,
.apmr-bp-pricing-table td.payment-method-card,
.apmr-bp-pricing-table td.payment-method-ach,
.apmr-bp-pricing-table td.payment-method-wire {
    text-align: center;
}

.apmr-bp-pricing-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.apmr-bp-pricing-table tr.campaign-pricing {
    background-color: #fff3cd;
}

/* Base pricing (no discount) */
.apmr-bp-pricing-table tr[data-discount="0"] .price {
    color: #333;
    font-weight: bold;
}

/* Tiered discount coloring */
.apmr-bp-pricing-table .price {
    font-weight: bold;
}

/* Small discount (1-10%) - Yellow */
.apmr-bp-pricing-table tr[data-discount-tier="small"] .price {
    color: #d4a017;
}

/* Medium discount (10-25%) - Golden Yellow */
.apmr-bp-pricing-table tr[data-discount-tier="medium"] .price {
    color: #ff9500;
}

/* Large discount (25-40%) - Orange */
.apmr-bp-pricing-table tr[data-discount-tier="large"] .price {
    color: #ff6b00;
}

/* Huge discount (40-60%) - Deep Orange */
.apmr-bp-pricing-table tr[data-discount-tier="huge"] .price {
    color: #ff4500;
    font-weight: 700;
}

/* Mega discount (60-75%) - Orange Red */
.apmr-bp-pricing-table tr[data-discount-tier="mega"] .price {
    color: #dc143c;
    font-weight: 800;
}

/* Ultra discount (75%+) - Deep Red */
.apmr-bp-pricing-table tr[data-discount-tier="ultra"] .price {
    color: #8b0000;
    font-weight: 900;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.apmr-bp-pricing-table .premium-percentage {
    font-size: 0.85em;
    color: #666;
}

/* As Low As Pricing */
.apmr-bp-as-low-as-wrapper {
    margin-top: 10px;
    margin-bottom: 15px;
}

.apmr-bp-as-low-as {
    display: block;
    font-size: 0.9em;
}

.apmr-bp-as-low-as.sale-price {
    color: #333; /* Normal color for crossed out price */
}

.apmr-bp-as-low-as.sale-price del {
    opacity: 0.7;
    text-decoration: line-through;
}

.apmr-bp-as-low-as.sale-price .sale-price {
    color: #e2401c;
    font-weight: 600;
}

.apmr-bp-as-low-as .premium-discount {
    color: #e2401c;
    font-weight: 600;
}

/* Single product page */
.single-product .apmr-bp-as-low-as {
    font-size: 1.1em;
    font-weight: bold;
}

/* Product loops - simpler display */
.woocommerce ul.products li.product .apmr-bp-as-low-as {
    font-size: 0.85em;
    margin-top: 3px;
}

/* Discount badges */
.apmr-bp-pricing-table .discount-badge {
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
    background-color: #dc143c; /* Default red background for sales */
}

/* No discount */
.apmr-bp-pricing-table tr[data-discount="0"] .discount-badge {
    display: none;
}

/* Small discount badge (1-10%) - Yellow */
.apmr-bp-pricing-table tr[data-discount-tier="small"] .discount-badge {
    background-color: #d4a017;
}

/* Medium discount badge (10-25%) - Golden Yellow */
.apmr-bp-pricing-table tr[data-discount-tier="medium"] .discount-badge {
    background-color: #ff9500;
}

/* Large discount badge (25-40%) - Orange */
.apmr-bp-pricing-table tr[data-discount-tier="large"] .discount-badge {
    background-color: #ff6b00;
}

/* Huge discount badge (40-60%) - Deep Orange */
.apmr-bp-pricing-table tr[data-discount-tier="huge"] .discount-badge {
    background-color: #ff4500;
}

/* Mega discount badge (60-75%) - Orange Red */
.apmr-bp-pricing-table tr[data-discount-tier="mega"] .discount-badge {
    background-color: #dc143c;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Ultra discount badge (75%+) - Deep Red */
.apmr-bp-pricing-table tr[data-discount-tier="ultra"] .discount-badge {
    background-color: #8b0000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

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

/* Campaign Notice */
.campaign-notice {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 3px;
    color: #856404;
}

.campaign-notice .dashicons {
    margin-right: 5px;
    color: #f39c12;
}

/* Premium Info */
.apmr-bp-premium-info {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* As Low As Display */
.apmr-bp-as-low-as {
    font-size: 0.9em;
    font-weight: bold;
}

.apmr-bp-discount-badge {
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
    background-color: #dc143c; /* Default red background for sales */
}

/* Discount badge tier colors matching pricing table */
.apmr-bp-discount-badge.discount-tier-small,
.apmr-bp-discount-badge[data-discount-tier="small"] {
    background-color: #d4a017;
}

.apmr-bp-discount-badge.discount-tier-medium,
.apmr-bp-discount-badge[data-discount-tier="medium"] {
    background-color: #ff9500;
}

.apmr-bp-discount-badge.discount-tier-large,
.apmr-bp-discount-badge[data-discount-tier="large"] {
    background-color: #ff6b00;
}

.apmr-bp-discount-badge.discount-tier-huge,
.apmr-bp-discount-badge[data-discount-tier="huge"] {
    background-color: #ff4500;
}

.apmr-bp-discount-badge.discount-tier-mega,
.apmr-bp-discount-badge[data-discount-tier="mega"] {
    background-color: #dc143c;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.apmr-bp-discount-badge.discount-tier-ultra,
.apmr-bp-discount-badge[data-discount-tier="ultra"] {
    background-color: #8b0000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

/* Cart Premium Display */
.apmr-bp-cart-premium {
    color: #666;
}

/* Style Variations */
.apmr-bp-style-minimal .apmr-bp-pricing-table {
    border: none;
}

.apmr-bp-style-minimal .apmr-bp-pricing-table th,
.apmr-bp-style-minimal .apmr-bp-pricing-table td {
    border: none;
    border-bottom: 1px solid #eee;
}

.apmr-bp-style-minimal .apmr-bp-pricing-table th {
    background-color: transparent;
    border-bottom: 2px solid #333;
}

.apmr-bp-style-modern .apmr-bp-pricing-table {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.apmr-bp-style-modern .apmr-bp-pricing-table th,
.apmr-bp-style-modern .apmr-bp-pricing-table td {
    border: none;
}

.apmr-bp-style-modern .apmr-bp-pricing-table th {
    background-color: #333;
    color: white;
}

.apmr-bp-style-modern .apmr-bp-pricing-table tr:nth-child(even) {
    background-color: #f8f8f8;
}

/* Clean Style - Minimal formatting */
.apmr-bp-style-clean .apmr-bp-pricing-table {
    border: none;
    background: none;
    box-shadow: none;
}

.apmr-bp-style-clean .apmr-bp-pricing-table th,
.apmr-bp-style-clean .apmr-bp-pricing-table td {
    border: none;
    background: none;
    padding: 8px 12px;
}

.apmr-bp-style-clean .apmr-bp-pricing-table th {
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.apmr-bp-style-clean .apmr-bp-pricing-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.apmr-bp-style-clean .apmr-bp-pricing-table tbody tr:last-child {
    border-bottom: none;
}

/* Basic Style - Transparent formatting */
.apmr-bp-style-basic .apmr-bp-pricing-table tr {
    background-color: transparent !important;
}

.apmr-bp-style-basic .apmr-bp-pricing-table th,
.apmr-bp-style-basic .apmr-bp-pricing-table td {
    border: none;
    padding: 0.5rem;
    background-color: transparent;
}

.apmr-bp-style-basic .campaign-notice {
    background-color: transparent;
    border: none;
    padding: 0;
    color: #000;
}

/* As Low As Price Styling */
.apmr-bp-as-low-as .as-low-as-prefix {
    color: #000;
}

/* As Low As price inherits tier colors */
.apmr-bp-as-low-as[data-discount-tier="small"] .as-low-as-price {
    color: #d4a017;
}

.apmr-bp-as-low-as[data-discount-tier="medium"] .as-low-as-price {
    color: #ff9500;
}

.apmr-bp-as-low-as[data-discount-tier="large"] .as-low-as-price {
    color: #ff6b00;
}

.apmr-bp-as-low-as[data-discount-tier="huge"] .as-low-as-price {
    color: #ff4500;
    font-weight: 700;
}

.apmr-bp-as-low-as[data-discount-tier="mega"] .as-low-as-price {
    color: #dc143c;
    font-weight: 800;
}

.apmr-bp-as-low-as[data-discount-tier="ultra"] .as-low-as-price {
    color: #8b0000;
    font-weight: 900;
}

/* Table wrapper for horizontal scroll on very narrow screens */
.apmr-bp-pricing-table-wrapper {
    overflow-x: auto;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .apmr-bp-pricing-table {
        font-size: 0.85em;
    }
    
    .apmr-bp-pricing-table th,
    .apmr-bp-pricing-table td {
        padding: 4px 6px;
    }
}

@media screen and (max-width: 600px) {
    .apmr-bp-pricing-table {
        font-size: 0.8em;
        min-width: 480px; /* Prevent excessive compression */
    }
    
    .apmr-bp-pricing-table th,
    .apmr-bp-pricing-table td {
        padding: 4px 5px;
    }
    
    .apmr-bp-pricing-table .premium-percentage {
        display: block;
        margin-top: 2px;
    }
}

/* Campaign Notice in Cart */
.apmr-bp-campaign-notice {
    margin-bottom: 20px;
}

.apmr-bp-campaign-notice .dashicons {
    margin-right: 5px;
    color: #f39c12;
    vertical-align: middle;
}

/* Campaign Sale Badge */
.apmr-bp-campaign-badge {
    background-color: #c0392b;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
}

/* Price Lock Notice */
.apmr-bp-price-lock-notice {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    position: relative;
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
    display: flex;
    align-items: center;
}

.apmr-bp-price-lock-notice .dashicons {
    margin-right: 10px;
    font-size: 20px;
}

.apmr-bp-lock-timer {
    margin-left: 10px;
    font-weight: bold;
    color: #155724;
}