/**
 * Purchase Interval Styles
 *
 * @package CMLI
 */

/* Purchase Interval Information */
.cmli-purchase-interval-info {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.cmli-purchase-interval-info .notice {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    margin: 0;
    padding: 10px 15px;
}

.cmli-purchase-interval-info .info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
    margin: 0 0 10px 0;
    padding: 10px 15px;
}

.cmli-interval-restriction {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.cmli-interval-restriction p {
    margin: 0;
    font-weight: 500;
}

.cmli-interval-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.cmli-remaining-quantity {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    margin-top: 10px;
}

/* Countdown Timer */
.cmli-countdown-timer {
    margin: 10px 0;
    padding: 10px;
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
    border-radius: 4px;
}

.cmli-countdown-timer .countdown {
    font-weight: bold;
    font-family: monospace;
}

/* Fixed quantity styles - Hide quantity selector for purchase interval products */
.cmli-fixed-quantity {
    display: none !important;
}

/* Hide quantity input wrapper for purchase interval products */
.single-product .cmli-fixed-quantity,
.single-product .quantity:has(.cmli-fixed-quantity) {
    display: none !important;
}

/* Alternative approach for browsers that don't support :has() */
.single-product .quantity input.cmli-fixed-quantity {
    display: none !important;
}

.single-product .quantity:has(input.cmli-fixed-quantity) {
    display: none !important;
}

/* Fallback for older browsers */
.single-product .quantity input[class*="cmli-fixed-quantity"] {
    display: none !important;
}

.single-product .quantity:has(input[class*="cmli-fixed-quantity"]) {
    display: none !important;
}

/* Hide quantity controls in cart for purchase interval products */
.cart .cmli-fixed-quantity,
.cart .quantity:has(.cmli-fixed-quantity) {
    display: none !important;
}

/* Show fixed quantity message instead */
.cmli-fixed-quantity-message {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin: 5px 0;
}

/* Quantity validation styles */
.cmli-quantity-validation {
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
}

.cmli-quantity-validation.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.cmli-quantity-validation.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.cmli-quantity-validation.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* Notice wrapper fixes */
/* .woocommerce-notices-wrapper {
    position: relative !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    z-index: auto !important;
    margin: 15px 0 !important;
} */

/* Ensure notices are visible */
/* .woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    position: relative !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
} */

/* Cart quantity note */
.cmli-quantity-note {
    display: block;
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

/* Restricted product styles */
.cmli-restricted {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cmli-purchase-interval-info .notice {
        border-width: 2px;
        font-weight: bold;
    }

    .cmli-purchase-interval-info .info {
        border-width: 2px;
        font-weight: bold;
    }

    .cmli-countdown-timer {
        border-width: 2px;
        font-weight: bold;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cmli-countdown-timer .countdown {
        animation: none;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .cmli-purchase-interval-info {
        margin: 10px 0;
        padding: 10px;
    }

    .cmli-countdown-timer {
        padding: 8px;
        font-size: 0.9em;
    }
}

/* Print Styles */
@media print {
    .cmli-countdown-timer,
    .cmli-notice,
    .quantity-validation {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cmli-notice-error {
        background-color: #fff !important;
        border: 2px solid #d00 !important;
        color: #d00 !important;
    }

    .cmli-notice-info {
        background-color: #fff !important;
        border: 2px solid #0066cc !important;
        color: #0066cc !important;
    }

    .cmli-notice-success {
        background-color: #fff !important;
        border: 2px solid #008000 !important;
        color: #008000 !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .cmli-notice,
    .quantity-validation span.loading {
        animation: none !important;
        transition: none !important;
    }
}