/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

.cart-offer-container {
    background: #ffffff;
    border: 2px solid #000000;
    border-radius: 12px;
    margin: 20px 0;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.cart-offer-container:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.cart-offer-inner {
    padding: 24px;
    color: #000000;
    background: #ffffff;
}

.cart-offer-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cart-offer-product-info {
    display: flex;
    /* align-items: center; */
    gap: 15px;
    flex: 1;
    min-width: 300px;
}

.cart-offer-image {
    flex-shrink: 0;
}

.cart-offer-image img {
    border-radius: 6px;
    max-width: 80px;
    height: auto;
}

.cart-offer-details {
    flex: 1;
}

.cart-offer-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #000000;
}

.cart-offer-pricing {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 10px;
}

.cart-offer-original-price {
    text-decoration: line-through !important;
    color: #999999 !important;
    font-size: 0.9em !important;
    display: inline-block;
}

.cart-offer-discounted-price {
    color: #000000 !important;
    font-weight: bold !important;
    font-size: 1.1em;
    display: inline-block;
}

.cart-offer-discount-badge {
    background: #000000;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: auto;
    text-align: center;
}

.cart-offer-savings {
    color: #666666 !important;
    font-size: 0.85em !important;
    font-weight: bold !important;
    display: block;
    width: 100%;
    text-align: left;
}

.cart-offer-cta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    min-width: 200px;
}

.cart-offer-text p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.cart-offer-actions {
    display: flex;
    align-items: center;
    margin: 0 auto;
    gap: 10px;
}

.cart-offer-quantity {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 80px;
}

.cart-offer-quantity label {
    color: #000000;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-offer-quantity-input {
    padding: 8px 10px !important;
    border: 2px solid rgba(0, 0, 0, 0.2) !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    text-align: center !important;
    width: 60px !important;
    height: 44px !important;
    transition: all 0.3s ease !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
}

.cart-offer-quantity-input:focus {
    outline: none !important;
    border-color: rgba(0, 0, 0, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1) !important;
}

.cart-offer-quantity-input::-webkit-outer-spin-button,
.cart-offer-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.cart-offer-add-btn {
    background: #000000 !important;
    border: 2px solid #000000 !important;
    color: #ffffff !important;
    padding: 14px 28px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
}

.cart-offer-add-btn:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.cart-offer-add-btn:disabled {
    background: #666666 !important;
    color: #999999 !important;
    border: 2px solid #666666 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Button states for cart offer */
.cart-offer-add-btn.processing {
    opacity: 0.7;
    cursor: not-allowed;
    background: #666666 !important;
    color: #ffffff !important;
}

.cart-offer-add-btn.added {
    background-color: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
}

.cart-offer-add-btn.error {
    background-color: #ff4444 !important;
    border-color: #ff4444 !important;
    color: #ffffff !important;
}

.cart-offer-dismiss-btn {
    background: transparent;
    border: 2px solid rgba(0, 0, 0, 0.3);
    color: #000000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-offer-dismiss-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
}

.cart-offer-dismiss-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.cart-offer-test-mode {
    background: rgba(0, 0, 0, 0.1);
    margin: 15px -20px -20px -20px;
    padding: 10px 20px;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.cart-offer-test-mode small {
    color: rgba(0, 0, 0, 0.6);
    font-style: italic;
}

/* Cart table styling for offer items */
.cart-offer-price-display {
    text-align: left;
    line-height: 1.4;
}

/* Fixed quantity display for limited offer items */
.cart-offer-fixed-quantity {
    display: inline-block !important;
    padding: 8px 12px !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border: 2px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 4px !important;
    color: #000000 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-align: center !important;
    min-width: 40px !important;
    line-height: 1.2 !important;
}

.cart-offer-original-price {
    text-decoration: line-through !important;
    color: #999 !important;
    font-size: 0.9em !important;
    display: block;
}

.cart-offer-discounted-price {
    color: #e74c3c !important;
    font-weight: bold !important;
    font-size: 1.1em;
    display: block;
}

.cart-offer-savings {
    color: #27ae60 !important;
    font-size: 0.85em !important;
    font-weight: bold !important;
    display: block;
    width: 100%;
    text-align: left;
}

.cart-offer-badge {
    background: #e74c3c !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    font-size: 0.7em !important;
    font-weight: bold !important;
    margin-left: 5px !important;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cart totals styling */
/* Make cart totals use flexbox for reordering */
.cart_totals .shop_table tbody {
    display: flex !important;
    flex-direction: column !important;
}

.cart_totals .shop_table tbody tr {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
}

.cart_totals .shop_table tbody tr th,
.cart_totals .shop_table tbody tr td {
    flex: 0 0 auto !important;
    text-align: left !important;
}

.cart_totals .shop_table tbody tr td {
    text-align: right !important;
    margin-left: auto !important;
}

/* Put savings row first */
.cart-offer-total-savings {
    order: -1 !important;
    position: relative !important;
}

.cart-offer-total-savings::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-top: 1px dashed #27ae60 !important;
}

.cart-offer-total-savings th,
.cart-offer-total-savings td {
    padding-top: 10px !important;
    border-bottom: none !important;
}

.cart-offer-total-savings th {
    color: #27ae60 !important;
    font-weight: bold !important;
}

.cart-offer-total-savings td {
    color: #27ae60 !important;
    font-weight: bold !important;
    font-size: 1em !important;
}

/* Fix WooCommerce coupon discount border to be on TR instead of children */
.cart_totals .shop_table tbody tr.cart-discount th,
.cart_totals .shop_table tbody tr.cart-discount td {
    border-top: none !important;
    border-bottom: none !important;
}

.cart-subtotal td, .cart-subtotal th {
    border: none !important;
}

.order-total td, .order-total th {
    border: none !important;
}

.cart_totals .shop_table tbody tr.cart-discount {
    border-top: 1px solid #e0e0e0 !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

/* Cart offer validation notices */
.woocommerce-message {
    border-left-color: #f39c12 !important;
}

.woocommerce-message.cart-offer-notice {
    background-color: #fff8e1;
    border-left: 4px solid #f39c12;
    color: #8a6914;
}

.woocommerce-message.cart-offer-quantity-notice {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    margin-bottom: 15px;
}

.woocommerce-info.cart-offer-discount-removed {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #0d47a1;
}

/* Responsive design */
@media (max-width: 768px) {
    .cart-offer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cart-offer-product-info {
        min-width: auto;
        flex-direction: column;
        text-align: center;
    }
    
    .cart-offer-cta {
        align-items: center;
        min-width: auto;
        width: 100%;
    }
    
    .cart-offer-text p {
        text-align: center;
    }
    
    .cart-offer-pricing {
        justify-content: center;
        flex-direction: row;
        gap: 10px;
    }
    
    .cart-offer-original-price,
    .cart-offer-discounted-price {
        display: inline-block;
        width: auto;
    }
    
    .cart-offer-discount-badge {
        width: auto;
        margin-top: 5px;
        text-align: center;
    }
    
    .cart-offer-price-display {
        text-align: center;
    }
    
    .cart-offer-badge {
        display: block;
        margin: 5px 0 0 0 !important;
        text-align: center;
        width: fit-content;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .cart-offer-actions {
        flex-direction: column;
        margin: 0 auto;
        gap: 15px;
        width: 100%;
    }
    
    .cart-offer-quantity {
        align-items: center;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    .cart-offer-quantity label {
        margin-bottom: 0;
        font-size: 14px;
    }
}

/* Variation Selection Styles */
.cart-offer-variations {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    width: 100%;
}

.cart-offer-variations h5 {
    margin: 0 0 15px 0;
    color: #000000;
    font-size: 16px;
    font-weight: 600;
}

.cart-offer-variation-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cart-offer-variation-option:last-child {
    margin-bottom: 0;
}

.cart-offer-variation-option label {
    color: #000000;
    font-weight: 500;
    font-size: 14px;
}

.cart-offer-variation-select {
    padding: 8px 12px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: #ffffff;
    color: #333;
    font-size: 14px;
    transition: all 0.3s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    line-height: 1.4;
}

.cart-offer-variation-select:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.6);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.cart-offer-variation-select.error {
    border-color: #ff6b6b;
    background: #ffebee;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@media (max-width: 768px) {
    .cart-offer-variations {
        padding: 12px;
        margin: 12px 0;
    }
    
    .cart-offer-variations h5 {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .cart-offer-variation-option {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .cart-offer-variation-option label {
        flex-shrink: 0;
        min-width: 80px;
        margin-bottom: 0;
    }
    
    .cart-offer-variation-select {
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
        flex: 1;
    }
}

@media (max-width: 480px) {
    .cart-offer-inner {
        padding: 15px;
    }
    
    .cart-offer-add-btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
    }
    
    .cart-offer-title {
        font-size: 16px;
    }
    
    .cart-offer-discounted-price {
        font-size: 18px;
    }
}

/* Mobile cart layout improvements */
@media (max-width: 689.98px) {
    .cart-offer-prices-group {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .cart-offer-price-display {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .cart-offer-original-price {
        margin-right: 0 !important;
    }
    
    .cart-offer-discounted-price {
        margin-left: 0 !important;
    }
    
    .cart-offer-badge {
        flex-shrink: 0;
        margin: 0 !important;
        display: inline-block !important;
    }

    .cart-offer-total-savings td, .cart-subtotal td, .order-total td, .cart-discount td {
        width: 100%;
    }

    .shop_table .fee td {
        width: 100%;
    }
}
