/**
 * Linear Meter Calculator Styles
 * Modern, clean UI for length input on WooCommerce products
 */

.ecml-linear-meter-calculator {
    margin: 20px 0 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.ecml-linear-meter-calculator:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Header */
.ecml-lm-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.ecml-lm-header label {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.ecml-lm-unit {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 400;
}

/* Input Group */
.ecml-lm-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

/* Increment/Decrement Buttons */
.ecml-lm-decrement,
.ecml-lm-increment {
    width: 48px;
    height: 48px;
    border: 2px solid #e1e5e9;
    background: #ffffff;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    padding: 0;
}

.ecml-lm-decrement {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.ecml-lm-increment {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.ecml-lm-decrement:hover:not(:disabled),
.ecml-lm-increment:hover:not(:disabled) {
    background: #ff0c3a;
    color: white;
    border-color: #ff0c3a;
    transform: scale(1.05);
}

.ecml-lm-decrement:active:not(:disabled),
.ecml-lm-increment:active:not(:disabled) {
    transform: scale(0.95);
}

.ecml-lm-decrement:disabled,
.ecml-lm-increment:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Input Field */
.ecml-lm-input {
    width: 120px !important;
    height: 48px !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    border: 2px solid #e1e5e9 !important;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    padding: 0 15px !important;
    -moz-appearance: textfield !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.ecml-lm-input::-webkit-outer-spin-button,
.ecml-lm-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ecml-lm-input:focus {
    outline: none !important;
    border-color: #ff0c3a !important;
    box-shadow: 0 0 0 3px rgba(255, 12, 58, 0.1) !important;
}

/* Preset Buttons */
.ecml-lm-presets {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.ecml-lm-preset-label {
    font-size: 13px;
    color: #7f8c8d;
    margin-right: 5px;
}

.ecml-lm-preset {
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #dfe3e7;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #5a6c7d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ecml-lm-preset:hover {
    background: #ff0c3a;
    color: white;
    border-color: #ff0c3a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 12, 58, 0.2);
}

.ecml-lm-preset:active {
    transform: translateY(0);
}

/* Price Display */
.ecml-lm-price-display {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.ecml-lm-calculation {
    margin-bottom: 12px;
}

.ecml-lm-formula {
    font-size: 14px;
    color: #7f8c8d;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ecml-lm-length-display {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.ecml-lm-total {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #e1e5e9;
}

.ecml-lm-total-label {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.ecml-lm-total-price {
    font-size: 24px;
    font-weight: 700;
    color: #27ae60;
    display: flex;
    align-items: center;
}

.ecml-lm-total-price .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
}

/* Loading State */
.ecml-lm-calculating {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

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

@keyframes ecml-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ecml-linear-meter-calculator {
        padding: 20px 15px;
    }
    
    .ecml-lm-input-group {
        max-width: 100%;
    }
    
    .ecml-lm-input {
        width: 100px !important;
        height: 44px !important;
        font-size: 16px !important;
    }
    
    .ecml-lm-decrement,
    .ecml-lm-increment {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .ecml-lm-presets {
        justify-content: flex-start;
    }
    
    .ecml-lm-preset-label {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .ecml-lm-total-price {
        font-size: 20px;
    }
}

/* Integration with various themes */
.single_add_to_cart_button {
    margin-top: 15px;
}

/* Ensure calculator appears above add to cart button */
.ecml-linear-meter-calculator + .single_add_to_cart_button {
    clear: both;
}

/* Animation for price updates */
.ecml-lm-total-price {
    transition: all 0.3s ease;
}

.ecml-price-updating .ecml-lm-total-price {
    transform: scale(1.05);
    color: #ff0c3a;
}

/* Error state */
.ecml-lm-input.error {
    border-color: #ff0c3a !important;
}

.ecml-lm-input.error:focus {
    box-shadow: 0 0 0 3px rgba(255, 12, 58, 0.1) !important;
}

/* Success animation */
@keyframes ecml-success-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
    }
}

.ecml-lm-input.success {
    animation: ecml-success-pulse 1s;
}

/* Select variation message */
.ecml-select-variation {
    color: #999;
    font-style: italic;
    font-size: 14px;
}

/* Cart Controls Styling */
.ecml-cart-controls {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
}

.ecml-cart-controls-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Quantity Container */
.ecml-quantity-container {
    display: flex;
    align-items: center;
    gap: 0;
}

.ecml-quantity-label {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    margin-right: 10px;
}

/* Quantity Input Group */
.ecml-quantity-group {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.ecml-qty-btn {
    width: 40px;
    height: 44px;
    border: none;
    background: #ffffff;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.ecml-qty-btn:hover:not(:disabled) {
    background: #ff0c3a;
    color: white;
}

.ecml-qty-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.ecml-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ecml-qty-input {
    width: 60px !important;
    height: 44px !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    border: none !important;
    border-left: 1px solid #e1e5e9 !important;
    border-right: 1px solid #e1e5e9 !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    -moz-appearance: textfield !important;
}

.ecml-qty-input::-webkit-outer-spin-button,
.ecml-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ecml-qty-input:focus {
    outline: none !important;
    border-color: #ff0c3a !important;
    box-shadow: 0 0 0 2px rgba(255, 12, 58, 0.1) !important;
}

/* Add to Cart Button Styling */
.ecml-addtocart-container .single_add_to_cart_button {
    margin: 0 !important;
    padding: 12px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    background: #ff0c3a !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    width: 200px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

.ecml-addtocart-container .single_add_to_cart_button:hover {
    background: #e0092f !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(255, 12, 58, 0.3) !important;
}

.ecml-addtocart-container .single_add_to_cart_button:active {
    transform: translateY(0) !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ecml-cart-controls-inner {
        flex-direction: column;
        gap: 15px;
    }
    
    .ecml-quantity-container {
        order: 1;
    }
    
    .ecml-addtocart-container {
        order: 2;
        width: 100%;
    }
    
    .ecml-addtocart-container .single_add_to_cart_button {
        width: 100% !important;
        padding: 15px 20px !important;
    }
}

/* Hide original cart elements when Linear Meter calculator is present */
.ecml-linear-meter-calculator ~ .cart .single_add_to_cart_button,
.ecml-linear-meter-calculator ~ .single_add_to_cart_button {
    display: none !important;
}

/* Hide specific quantity elements inside the container */
.quantity.buttons_added .input-text.qty.text,
.quantity.buttons_added .quantity-nav,
.quantity.buttons_added .quantity-button,
.quantity.buttons_added label {
    display: none !important;
}

/* Hide the entire quantity container for good measure */
.quantity.buttons_added {
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}