/* ========================================
   OfficeLine Plugin - Combined Styles
   ======================================== */

/* ========================================
   Bundle Edit Modal Styles
   ======================================== */
#bundle-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    width: 500px;
    max-width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 20px;
    cursor: pointer;
}

#bundle-items ul {
    list-style: none;
    padding: 0;
}

#bundle-items li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#bundle-items label {
    flex: 1;
}

#bundle-items input[type="number"] {
    width: 60px;
    padding: 5px;
}

#bundle-items select {
    width: 150px;
    padding: 5px;
}

#bundle-items input[type="checkbox"] {
    margin-right: 10px;
}

#save-bundle-changes {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
}

#save-bundle-changes:hover {
    background: #00a0d2;
}

.edit-bundle-product {
    cursor: pointer; 
    margin-right: 10px;
    color: #0073aa;
    font-size: 16px;
}

.elementor-widget-container .edit-bundle-product{
    display: none;
}

.elementor-menu-cart__main .edit-bundle-product{
    display: inline-block;
}

.edit-bundle-product:hover {
    color: #00a0d2;
}

#bundle-ajax-loader .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hide duplicate edit icons */
.woocommerce-mini-cart-item .edit-bundle-product:not(:first-child) {
    display: none;
}

/* ========================================
   Monthly Subscription Styles
   ======================================== */
.ol-subscription-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    clear: both;
    width: 100%;
    box-sizing: border-box;
}

/* Positioning after coupon box */
.woocommerce-checkout .ol-subscription-section {
    margin: 20px 0;
    clear: both;
}

/* Ensure proper spacing after coupon section */
.woocommerce-form-coupon + .ol-subscription-section {
    margin-top: 25px;
}

/* Position in order review area after coupon */
#order_review .ol-subscription-section {
    margin: 20px 0;
    order: -1; /* Place at the top of order review */
}

/* RTL positioning adjustments */
.rtl .woocommerce-checkout .ol-subscription-section {
    margin: 20px 0;
}

/* Ensure proper spacing in checkout flow */
.woocommerce-checkout .ol-subscription-section {
    position: relative;
    z-index: 5;
}

/* Specific positioning after coupon in order review */
.woocommerce-checkout .woocommerce-checkout-review-order-table:first-child + .ol-subscription-section {
    margin-top: 25px;
}

.ol-subscription-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* Subscription Toggle */
.ol-subscription-toggle {
    margin-bottom: 20px;
}

.ol-subscription-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #333;
    position: relative;
    padding-left: 35px;
}

/* RTL Checkbox Layout */
.rtl .ol-subscription-checkbox {
    padding-left: 0;
    padding-right: 35px;
    flex-direction: row;
}

.ol-subscription-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.ol-subscription-checkbox:hover input ~ .checkmark {
    border-color: #007cba;
}

.ol-subscription-checkbox input:checked ~ .checkmark {
    background-color: #007cba;
    border-color: #007cba;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ol-subscription-checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* Subscription Options */
.ol-subscription-options {
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}

.ol-subscription-duration,
.ol-subscription-payment {
    margin-bottom: 20px;
}

.ol-subscription-duration label,
.ol-subscription-payment label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.ol-subscription-duration select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.ol-subscription-duration select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Payment Options */
.ol-payment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ol-payment-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    transition: all 0.3s ease;
    position: relative;
}

.ol-payment-option:hover {
    border-color: #007cba;
    background-color: #f8f9ff;
}

.ol-payment-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.radio-mark {
    position: relative;
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.ol-payment-option:hover .radio-mark {
    border-color: #007cba;
}

.ol-payment-option input:checked ~ .radio-mark {
    background-color: #007cba;
    border-color: #007cba;
}

.radio-mark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ol-payment-option input:checked ~ .radio-mark:after {
    display: block;
}

/* Subscription Summary */
.ol-subscription-summary {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.ol-original-total,
.ol-subscription-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ol-original-total {
    color: #666;
    font-size: 14px;
}

.ol-subscription-total {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    border-top: 1px solid #b8daff;
    padding-top: 8px;
    margin-top: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ol-subscription-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .ol-payment-options {
        gap: 8px;
    }
    
    .ol-payment-option {
        padding: 10px;
    }
    
    .ol-subscription-summary {
        padding: 12px;
    }
}

/* Animation Classes */
.ol-subscription-options.slide-down {
    animation: slideDown 0.3s ease-out;
}

.ol-subscription-options.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding-top: 20px;
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        max-height: 500px;
        padding-top: 20px;
    }
    to {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
    }
}

/* Focus States for Accessibility */
.ol-subscription-checkbox:focus-within .checkmark,
.ol-payment-option:focus-within .radio-mark {
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* RTL Support */
.rtl .checkmark {
    left: auto;
    right: 0;
    margin-left: 12px;
    margin-right: 0;
}

.rtl .checkmark:after {
    left: 2px;
    right: 6px;
}

.rtl .radio-mark {
    margin-right: 0;
    margin-left: 12px;
}

.rtl .ol-payment-option {
    flex-direction: row-reverse;
}

.rtl .ol-original-total,
.rtl .ol-subscription-total {
    flex-direction: row-reverse;
}

/* RTL Payment Options Layout */
.rtl .ol-payment-options {
    direction: rtl;
}

.rtl .ol-payment-option {
    text-align: right;
}

/* RTL Form Elements */
.rtl .ol-subscription-duration select {
    text-align: right;
}

.rtl .ol-subscription-duration label,
.rtl .ol-subscription-payment label {
    text-align: right;
}

/* RTL Summary Section */
.rtl .ol-subscription-summary {
    text-align: right;
}

.rtl .ol-original-total span:first-child,
.rtl .ol-subscription-total span:first-child {
    margin-left: 10px;
    margin-right: 0;
}

/* RTL Section Spacing */
.rtl .ol-subscription-section {
    text-align: right;
}

.rtl .ol-subscription-section h3 {
    text-align: right;
}

/* Total Update Animation */
.ol-total-updated {
    animation: totalUpdate 0.5s ease-in-out;
    color: #007cba !important;
    font-weight: bold !important;
}

@keyframes totalUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Enhanced total display */
.woocommerce-checkout-review-order-table .order-total .amount {
    transition: all 0.3s ease;
}

.woocommerce-checkout-review-order-table .order-total .amount.ol-total-updated {
    background-color: #e8f4fd;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #007cba;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ol-subscription-section {
        border-color: #000;
    }
    
    .checkmark,
    .radio-mark {
        border-color: #000;
    }
    
    .ol-payment-option {
        border-color: #000;
    }
}
