/**
 * Infrapipe Product Bundles - Frontend Styles
 */

/* Main Container */
.ipbundle-add-to-cart {
    margin: 30px 0;
}

/* Contents Section */
.ipbundle-contents {
    margin-bottom: 25px;
}

.ipbundle-contents-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* Items List */
.ipbundle-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Single Item */
.ipbundle-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    transition: all 0.2s ease;
}

.ipbundle-item:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.ipbundle-item-optional {
    background: #fff;
    border: 1px dashed #ccc;
}

.ipbundle-item-optional:hover {
    border-color: #999;
}

.ipbundle-item-out-of-stock {
    opacity: 0.6;
}

/* Item Checkbox (Optional Items) */
.ipbundle-item-checkbox {
    display: flex;
    align-items: flex-start;
    padding-top: 3px;
}

.ipbundle-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ipbundle-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ipbundle-checkbox-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s ease;
}

.ipbundle-checkbox-label input:checked + .ipbundle-checkbox-custom {
    background: #2c6ecb;
    border-color: #2c6ecb;
}

.ipbundle-checkbox-custom::after {
    content: "";
    display: none;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.ipbundle-checkbox-label input:checked + .ipbundle-checkbox-custom::after {
    display: block;
}

.ipbundle-checkbox-label:hover .ipbundle-checkbox-custom {
    border-color: #2c6ecb;
}

.ipbundle-item-out-of-stock .ipbundle-checkbox-label {
    cursor: not-allowed;
}

.ipbundle-item-out-of-stock .ipbundle-checkbox-custom {
    background: #f0f0f0;
    border-color: #ddd;
}

/* Item Image */
.ipbundle-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e5e5;
}

.ipbundle-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Item Details */
.ipbundle-item-details {
    flex: 1;
    min-width: 0;
}

.ipbundle-item-name {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.ipbundle-item-name a {
    color: inherit;
    text-decoration: none;
}

.ipbundle-item-name a:hover {
    color: #2c6ecb;
}

/* Badges */
.ipbundle-required-badge,
.ipbundle-optional-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

.ipbundle-required-badge {
    background: #e8f5e9;
    color: #2e7d32;
}

.ipbundle-optional-badge {
    background: #fff3e0;
    color: #e65100;
}

/* Item Description */
.ipbundle-item-description {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Item Price */
.ipbundle-item-price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.ipbundle-item-price del {
    color: #999;
    font-size: 13px;
}

.ipbundle-item-price ins {
    text-decoration: none;
    font-weight: 600;
    color: #111;
}

.ipbundle-item-discount-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #d32f2f;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

/* Stock Status */
.ipbundle-item-stock {
    margin-top: 8px;
    font-size: 13px;
}

.ipbundle-item-stock.out-of-stock {
    color: #d32f2f;
    font-weight: 500;
}

/* Variations */
.ipbundle-item-variations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e5e5;
}

.ipbundle-variation-select {
    margin-bottom: 10px;
}

.ipbundle-variation-select:last-of-type {
    margin-bottom: 0;
}

.ipbundle-variation-select label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.ipbundle-attribute-select {
    width: 100%;
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.ipbundle-attribute-select:focus {
    outline: none;
    border-color: #2c6ecb;
    box-shadow: 0 0 0 2px rgba(44, 110, 203, 0.1);
}

/* Item Quantity */
.ipbundle-item-quantity {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    min-width: 120px;
}

/* Quantity Wrapper */
.ipbundle-qty-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.ipbundle-qty-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ipbundle-qty-btn:hover {
    background: #eee;
}

.ipbundle-qty-btn:active {
    background: #ddd;
}

.ipbundle-qty-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ipbundle-qty-input {
    width: 50px;
    height: 36px;
    padding: 0;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    -moz-appearance: textfield;
}

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

.ipbundle-qty-input:focus {
    outline: none;
}

/* Fixed Quantity */
.ipbundle-fixed-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 15px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

/* Item Subtotal */
.ipbundle-item-subtotal {
    font-size: 16px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
}

/* Summary Section */
.ipbundle-summary {
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    position: sticky;
    top: 100px;
}

/* Price Summary */
.ipbundle-price-summary {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.ipbundle-regular-price,
.ipbundle-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ipbundle-regular-price:last-child,
.ipbundle-total-price:last-child {
    margin-bottom: 0;
}

.ipbundle-regular-price .label,
.ipbundle-total-price .label {
    font-size: 14px;
    color: #666;
}

.ipbundle-regular-price .value del {
    color: #999;
    font-size: 14px;
}

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

.ipbundle-total-price .value {
    font-size: 24px;
    font-weight: 700;
    color: #111;
}

.ipbundle-calculated-price {
    transition: all 0.3s ease;
}

.ipbundle-calculated-price.updating {
    opacity: 0.5;
}

/* Savings Badge */
.ipbundle-savings {
    margin-top: 15px;
    text-align: right;
}

.ipbundle-savings-badge {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, #4caf50 0%, #43a047 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* Add to Cart Form */
.ipbundle-add-to-cart-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.ipbundle-quantity {
    flex: 0 0 auto;
}

.ipbundle-quantity label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.ipbundle-quantity .ipbundle-qty-wrapper {
    border-color: #ccc;
}

.ipbundle-main-qty-input {
    width: 60px;
}

/* Add to Cart Button */
.ipbundle-add-to-cart-btn {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px !important;
    transition: all 0.3s ease !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ipbundle-add-to-cart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ipbundle-add-to-cart-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.ipbundle-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ipbundle-btn-loading svg {
    animation: ipbundle-spin 1s linear infinite;
}

@keyframes ipbundle-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Cart Badge */
.ipbundle-cart-badge {
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    font-weight: normal;
    color: #666;
}

/* Notice Messages */
.ipbundle-notice {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.ipbundle-notice-success {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
}

.ipbundle-notice-error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
}

.ipbundle-notice-warning {
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    color: #e65100;
}

/* No Items Message */
.ipbundle-no-items,
.ipbundle-no-items-notice {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
    margin: 20px 0;
}

.ipbundle-no-items-notice p {
    margin: 0;
}

/* Shop/Archive Display */
.ipbundle-archive-price {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ipbundle-archive-price .ipbundle-savings-badge {
    font-size: 11px;
    padding: 4px 8px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .ipbundle-item {
        flex-wrap: wrap;
    }

    .ipbundle-item-checkbox {
        order: 1;
    }

    .ipbundle-item-image {
        order: 2;
        width: 60px;
        height: 60px;
    }

    .ipbundle-item-details {
        order: 3;
        flex-basis: calc(100% - 100px);
    }

    .ipbundle-item-quantity {
        order: 4;
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #e5e5e5;
    }

    .ipbundle-summary {
        position: static;
    }

    .ipbundle-add-to-cart-form {
        flex-direction: column;
    }

    .ipbundle-quantity {
        width: 100%;
    }

    .ipbundle-quantity .ipbundle-qty-wrapper {
        width: 100%;
        justify-content: center;
    }

    .ipbundle-add-to-cart-btn {
        width: 100%;
        min-width: 100%;
    }

    .ipbundle-total-price .value {
        font-size: 20px;
    }
}

@media screen and (max-width: 480px) {
    .ipbundle-item {
        padding: 15px;
    }

    .ipbundle-item-details {
        flex-basis: 100%;
        margin-top: 10px;
    }

    .ipbundle-item-name {
        font-size: 14px;
    }

    .ipbundle-required-badge,
    .ipbundle-optional-badge {
        display: block;
        margin-left: 0;
        margin-top: 5px;
        width: fit-content;
    }

    .ipbundle-item-variations {
        padding-top: 10px;
        margin-top: 10px;
    }

    .ipbundle-attribute-select {
        max-width: 100%;
    }
}

/* Shortcode: Bundle Contents */
.ipbundle-contents-shortcode {
    margin: 20px 0;
}

.ipbundle-contents-shortcode .ipbundle-contents-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.ipbundle-contents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ipbundle-contents-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    align-items: center;
}

.ipbundle-contents-item.is-optional {
    background: #fff;
    border-style: dashed;
}

.ipbundle-contents-item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e5e5;
}

.ipbundle-contents-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ipbundle-contents-item-info {
    flex: 1;
    min-width: 0;
}

.ipbundle-contents-item-name {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.ipbundle-contents-item-name a {
    color: inherit;
    text-decoration: none;
}

.ipbundle-contents-item-name a:hover {
    color: #2c6ecb;
}

.ipbundle-optional-tag {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: #fff3e0;
    color: #e65100;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

.ipbundle-contents-item-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: #666;
}

.ipbundle-contents-item-qty {
    color: #333;
    font-weight: 500;
}

.ipbundle-contents-item-price {
    font-weight: 600;
    color: #111;
}

.ipbundle-contents-item-discount {
    display: inline-block;
    padding: 2px 6px;
    background: #d32f2f;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

.ipbundle-contents-savings {
    margin-top: 15px;
    text-align: right;
}

/* Print Styles */
@media print {
    .ipbundle-add-to-cart-form {
        display: none;
    }

    .ipbundle-item-checkbox {
        display: none;
    }

    .ipbundle-qty-btn {
        display: none;
    }
}
