/* Package Protection - Shopify Style */
.package-protection-toggle-container {
    margin-top: 20px;
    margin-bottom: 20px;
    max-width: 100%;
    width: 100%;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
}

.package-protection-toggle {
    border: 1px solid #c9cccf;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
    display: block !important;
    width: 100%;
    box-sizing: border-box;
    visibility: visible !important;
    opacity: 1 !important;
}

.protection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.protection-title {
    font-size: 14px;
    font-weight: 600;
    color: #202223;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.protection-icon {
    width: 18px;
    height: 18px;
    color: #008060;
    flex-shrink: 0;
}

.protection-details-link {
    font-size: 14px;
    color: #2c6ecb;
    text-decoration: none;
    cursor: pointer;
}

.protection-details-link:hover {
    text-decoration: underline;
}

.protection-description {
    font-size: 13px;
    color: #6d7175;
    margin-bottom: 16px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.protection-button-group {
    display: flex;
    gap: 8px;
}

.protection-btn {
    flex: 1;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: 1.5px solid #c9cccf !important;
    background: white !important;
    color: #202223 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.protection-btn:hover {
    background: #f6f6f7 !important;
    border-color: #202223 !important;
}

.protection-btn.active,
button.protection-btn.active {
    background: #008060 !important;
    background-color: #008060 !important;
    color: white !important;
    border-color: #008060 !important;
}

.protection-btn.active:hover,
button.protection-btn.active:hover {
    background: #006e52 !important;
    background-color: #006e52 !important;
    border-color: #006e52 !important;
    color: white !important;
}

/* Hide the original checkbox - ultra aggressive */
#package-protection-toggle,
input#package-protection-toggle,
.package-protection-toggle-container > input[type="checkbox"],
.package-protection-toggle-container input[name="package_protection_toggle"],
#package-protection-container > input[type="checkbox"],
#package-protection-container input#package-protection-toggle,
div.package-protection-toggle-container input[type="checkbox"],
.woocommerce-additional-fields #package-protection-toggle,
.wfacp-form #package-protection-toggle,
body #package-protection-toggle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    clip: rect(0,0,0,0) !important;
}

/* Ensure container doesn't show checkboxes */
.package-protection-toggle-container::before,
#package-protection-container::before {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .package-protection-toggle-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .package-protection-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 14px;
    }

    .protection-title {
        font-size: 13px;
    }

    .protection-details-link {
        font-size: 13px;
    }

    .protection-description {
        font-size: 12px;
        margin-bottom: 14px;
    }

    .protection-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .package-protection-toggle {
        padding: 12px;
    }

    .protection-header {
        margin-bottom: 10px;
    }

    .protection-description {
        margin-bottom: 12px;
    }

    .protection-btn {
        padding: 9px 12px;
        font-size: 12px;
    }
}

/* Ensure compatibility with common checkout themes */
.woocommerce-checkout .package-protection-toggle-container,
.checkout .package-protection-toggle-container,
.wc-block-checkout .package-protection-toggle-container {
    clear: both;
    overflow: visible;
}

/* FunnelKit specific adjustments */
body.wfacp_page .package-protection-toggle-container {
    margin: 15px 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.wfacp_page .package-protection-toggle {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* FunnelKit Mobile - Extra defensive */
@media (max-width: 768px) {
    body.wfacp_page .package-protection-toggle-container,
    body.wfacp_page #package-protection-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
    }

    body.wfacp_page .package-protection-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* General Mobile Override - Maximum compatibility */
@media screen and (max-width: 768px) {
    #package-protection-container,
    .package-protection-toggle-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
        height: auto !important;
        clip: auto !important;
        clip-path: none !important;
        transform: none !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
    }

    #package-protection-container .package-protection-toggle,
    .package-protection-toggle-container .package-protection-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Ultra-defensive mobile visibility - covers all mobile breakpoints */
@media screen and (max-width: 991px) {
    .wp-block-lynxdefense-package-protection,
    [data-block-name="lynxdefense/package-protection"],
    #package-protection-container,
    .package-protection-toggle-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* Block wrapper visibility */
.wp-block-lynxdefense-package-protection {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Override any parent hiding on mobile */
@media screen and (max-width: 768px) {
    .wp-block-lynxdefense-package-protection,
    .wp-block-lynxdefense-package-protection #package-protection-container,
    .wp-block-lynxdefense-package-protection .package-protection-toggle-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
    }

    /* Force visibility even if in a hidden wrapper */
    [style*="display: none"] .package-protection-toggle-container,
    [style*="display:none"] .package-protection-toggle-container {
        display: block !important;
    }
}
