.product-tos-notice {
    display: flex;
    align-items: center;
    margin-top: 25px !important;
    padding: 10px;
    border-radius: 4px;
    background-color: #f7f7f7;
    width: 100% !important;
    order: 9999 !important;
    clear: both;
}

.product-tos-notice input[type="checkbox"] {
    margin-right: 8px;
}

.product-tos-notice label {
    font-size: 0.9em;
    margin: 0;
    display: inline;
}

.product-tos-notice .required {
    color: #dc3545;
    margin-left: 4px;
}

.product-tos-error {
    color: #dc3545;
    font-size: 0.85em;
    margin-top: 5px;
    display: none;
}

.product-tos-error.success {
    color: #28a745;
}

/* Important overrides for various themes */
.woocommerce form.cart .product-tos-notice,
.woocommerce-page form.cart .product-tos-notice,
.woocommerce div.product form.cart .product-tos-notice {
    order: 9999 !important;
    margin-top: 20px !important;
    width: 100% !important;
    clear: both !important;
}

/* For themes that use flex layout in add-to-cart forms */
.woocommerce div.product form.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.woocommerce div.product form.cart .button {
    margin-right: 10px;
}

/* For smaller screens, ensure good spacing */
@media (max-width: 768px) {
    .product-tos-notice {
        margin-top: 15px !important;
    }
}

/* Popup styling */
.product-tos-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.product-tos-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 800px;
    height: 90vh;
    max-height: 800px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.product-tos-popup-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-tos-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.product-tos-popup-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.product-tos-popup-close {
    font-size: 1.5em;
    cursor: pointer;
    color: #6c757d;
}

.product-tos-popup-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.product-tos-popup-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    .product-tos-popup-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.product-tos-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.product-tos-accept-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.product-tos-accept-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Fix for Astra theme */
.woocommerce div.product form.cart .button {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.woocommerce div.product form.cart .button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Admin styles */
.mapping-row {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

@media (max-width: 768px) {
    .product-selector, .page-selector, .url-field {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .product-selector, .page-selector, .url-field {
        width: 30%;
    }
}