/**
 * Storage Box Configurator Styles v2.2
 * Combined original styling with new discount badge functionality
 */

.storage-box-configurator {
    margin: 20px 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
}

.configurator-section {
    margin-bottom: 10px;
    padding: 0;
    animation: fadeIn 0.3s ease-in-out;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
    text-transform: none;
    text-align: center;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    justify-content: center;
    gap: 10px;
    max-width: 100%;
}

.config-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    text-align: center;
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    min-width: 180px;
    max-width: calc(33.333% - 7px);
}

.config-btn:hover:not(.unavailable):not(:disabled) {
    border-color: #999;
    background: #f9f9f9;
}

.config-btn.active {
    background: #94DB21 !important;
    border-color: #94DB21 !important;
    color: #fff !important;
}

.config-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    color: #999;
    border-color: #ddd;
}

.config-btn.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background: #3a3a3a;
    color: #999;
    border-color: #3a3a3a;
}

.config-btn.unavailable:hover {
    background: #3a3a3a;
    border-color: #3a3a3a;
}

/* Address buttons */
.address-button {
    /* Uses flex: 1 1 auto from .config-btn */
}

/* Level buttons */
.level-button {
    /* Uses flex: 1 1 auto from .config-btn */
}

/* Term buttons with discount badges */
.term-button {
    /* Uses flex: 1 1 auto from .config-btn */
    position: relative;
}

/* Discount Badge - Red Circular Bubble */
.discount-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: #dc3232;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    padding: 0 4px;
    z-index: 10;
    line-height: 1;
}

/* Shelf buttons with price badge */
.shelf-button {
    /* Uses flex: 1 1 auto from .config-btn */
    position: relative;
}

.shelf-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: #dc3232;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    padding: 0 4px;
    z-index: 10;
    line-height: 1;
}

/* Price Section */
.price-section {
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.price-display {
    display: flex;
    flex-direction: column;
}

/* Price Breakdown Box */
.price-breakdown {
    background: transparent;
    padding: 10px 0;
    padding-bottom: 0;
    border-radius: 0;
    margin: 0;
    margin-bottom: 0;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    color: #000;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: none;
}

.price-breakdown .price-row {
    border-bottom: none;
}

.price-row:last-child {
    border-bottom: none;
}

.price-label {
    font-size: 14px;
    color: #666;
    flex: 1;
    text-align: left;
}

.price-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: right;
}

.total-row {
    border-top: 2px solid #ddd;
    padding-top: 8px;
    margin-top: 8px;
}

.total-row .price-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.total-row .price-value {
    font-size: 20px;
    font-weight: bold;
    color: #333333;
}

/* Shelf breakdown styling */
.shelf-breakdown {
    display: none;
}

.shelf-breakdown.show,
.shelf-breakdown[style*="display: flex"] {
    display: flex !important;
}

.price-range-display {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    background: #f0f8ff;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Add to cart button */
.storage-box-configurator .single_add_to_cart_button,
.single_add_to_cart_button.button.alt {
    width: 80% !important;
    max-width: 800px !important;
    height: 50px !important;
    padding: 0 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    background: #333333 !important;
    border-color: #333333 !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 2px solid #333333 !important;
    border-radius: 4px !important;
    line-height: normal !important;
    display: block !important;
    margin: 20px auto 0 auto !important;
}

.storage-box-configurator .single_add_to_cart_button:hover:not(.disabled):not(:disabled),
.single_add_to_cart_button.button.alt:hover:not(.disabled):not(:disabled) {
    background: #6a9f1a !important;
    border-color: #333333 !important;
}

.storage-box-configurator .single_add_to_cart_button:disabled,
.storage-box-configurator .single_add_to_cart_button.disabled,
.single_add_to_cart_button.button.alt:disabled,
.single_add_to_cart_button.button.alt.disabled {
    background: #d3d3d3 !important;
    border-color: #d3d3d3 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.storage-box-configurator .single_add_to_cart_button:disabled:hover,
.storage-box-configurator .single_add_to_cart_button.disabled:hover,
.single_add_to_cart_button.button.alt:disabled:hover,
.single_add_to_cart_button.button.alt.disabled:hover {
    background: #d3d3d3 !important;
    border-color: #d3d3d3 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .price-section {
        padding: 0;
        margin-top: 0;
    }
    
    .config-btn {
        max-width: calc(50% - 5px) !important;
        flex: 0 1 calc(50% - 5px) !important;
        min-width: auto !important;
    }
    
    .button-group {
        gap: 10px;
    }
    
    .price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .price-value {
        text-align: left;
    }
    
    .price-label {
        text-align: left;
    }
    
    .discount-badge,
    .shelf-badge {
        min-width: 28px;
        height: 28px;
        font-size: 11px;
    }
}

/* Loading state */
.config-btn.loading {
    position: relative;
    color: transparent;
}

.config-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7ab51d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Out of stock message */
.out-of-stock {
    color: #e74c3c;
    font-weight: 600;
    padding: 15px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    text-align: center;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.unavailable-text {
    display: block;
    font-size: 12px;
    font-weight: normal;
    margin-top: 5px;
}

/* Loading spinner */
.loading {
    display: inline-block;
    color: #999;
}