/**
 * WooCommerce Blocks Label Selector Styling
 * Extracted from enhanced-label-styling-improved.js for proper block integration
 * Maintains exact same visual design in React-compliant way
 */

/* Enhanced Label Button Styling - Horizontal Layout with Image + Text */

/* Base button styling - horizontal layout like the mockup */
.clpep-label-selector button[data-label-id],
.clpep-label-selector .clpep-label-option {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 15px !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    border-radius: 12px !important;
    padding: 15px 20px !important;
    margin: 8px 0 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    background: #ffffff !important;
    border: 2px solid #e0e0e0 !important;
    color: #333333 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    text-align: left !important;
    width: 100% !important;
    min-height: 70px !important;
}

/* Image container - fixed size on left */
.clpep-label-selector button[data-label-id] img,
.clpep-label-selector .clpep-label-option img {
    width: 50px !important;
    height: 50px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    border-radius: 8px !important;
    background: #f8f9fa !important;
    padding: 5px !important;
}

/* Text content container - fills remaining space */
.clpep-label-selector button[data-label-id] > *:not(img):not(::before),
.clpep-label-selector .clpep-label-option > *:not(img):not(::before) {
    flex: 1 !important;
    text-align: left !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
}

/* Ensure text spans the full width */
.clpep-label-selector button[data-label-id] span,
.clpep-label-selector button[data-label-id] .label-text,
.clpep-label-selector .clpep-label-option span,
.clpep-label-selector .clpep-label-option .label-text {
    display: block !important;
    width: 100% !important;
    font-size: 16px !important;
    color: inherit !important;
}

/* Hover state for better UX */
.clpep-label-selector button[data-label-id]:hover,
.clpep-label-selector .clpep-label-option:hover {
    border-color: #007cba !important;
    box-shadow: 0 4px 16px rgba(0,124,186,0.15) !important;
    transform: translateY(-2px) !important;
    background: #f8f9fa !important;
}

/* SELECTED STATE - Very obvious visual indicators */
.clpep-label-selector button[data-label-id].clpep-selected,
.clpep-label-selector .clpep-label-option.clpep-selected {
    /* Strong gradient background */
    background: linear-gradient(135deg, #e8f4fd 0%, #cce7f7 100%) !important;
    
    /* Bold border with accent color */
    border: 3px solid #007cba !important;
    
    /* Prominent shadow for depth */
    box-shadow: 
        0 0 0 3px rgba(0, 124, 186, 0.2),
        0 6px 20px rgba(0, 124, 186, 0.25) !important;
    
    /* Bold text */
    font-weight: 700 !important;
    color: #005582 !important;
    
    /* Subtle transform for emphasis */
    transform: translateY(-3px) scale(1.02) !important;
}

/* Selected state image styling */
.clpep-label-selector button[data-label-id].clpep-selected img,
.clpep-label-selector .clpep-label-option.clpep-selected img {
    background: #ffffff !important;
    border: 2px solid #007cba !important;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.2) !important;
}

/* Add a checkmark icon for selected buttons - UNIFORM FOR ALL LABELS */
.clpep-label-selector button[data-label-id].clpep-selected::before,
.clpep-label-selector .clpep-label-option.clpep-selected::before {
    content: "✓" !important;
    position: absolute !important;
    top: 8px !important;
    right: 15px !important;
    color: #007cba !important;
    font-weight: 900 !important;
    font-size: 18px !important;
    background: #ffffff !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(0, 124, 186, 0.3) !important;
}

/* Pulse animation for newly selected buttons */
@keyframes clpep-selection-pulse {
    0% { 
        box-shadow: 
            0 0 0 3px rgba(0, 124, 186, 0.2),
            0 6px 20px rgba(0, 124, 186, 0.25);
    }
    50% { 
        box-shadow: 
            0 0 0 6px rgba(0, 124, 186, 0.4),
            0 8px 24px rgba(0, 124, 186, 0.4);
    }
    100% { 
        box-shadow: 
            0 0 0 3px rgba(0, 124, 186, 0.2),
            0 6px 20px rgba(0, 124, 186, 0.25);
    }
}

/* Apply pulse animation to newly selected buttons */
.clpep-label-selector button[data-label-id].clpep-just-selected,
.clpep-label-selector .clpep-label-option.clpep-just-selected {
    animation: clpep-selection-pulse 1.5s ease-out !important;
}

/* Remove any conflicting WooCommerce styles */
.wc-block-components-totals-wrapper .clpep-label-selector button[data-label-id] {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    text-align: left !important;
}

/* Ensure proper stacking context */
.clpep-label-selector button[data-label-id].clpep-selected,
.clpep-label-selector .clpep-label-option.clpep-selected {
    z-index: 10 !important;
    position: relative !important;
}

/* Fix any overflow issues */
.clpep-label-selector button[data-label-id],
.clpep-label-selector .clpep-label-option {
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: initial !important;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .clpep-label-selector button[data-label-id],
    .clpep-label-selector .clpep-label-option {
        padding: 12px 16px !important;
        gap: 12px !important;
        min-height: 60px !important;
    }
    
    .clpep-label-selector button[data-label-id] img,
    .clpep-label-selector .clpep-label-option img {
        width: 40px !important;
        height: 40px !important;
    }
    
    .clpep-label-selector button[data-label-id] span,
    .clpep-label-selector .clpep-label-option span {
        font-size: 14px !important;
    }
}

/* Container styling */
.clpep-label-selector {
    width: 100%;
    margin: 16px 0;
}

/* Compliance questions styling */
.clpep-compliance-questions {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.clpep-compliance-questions h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.clpep-compliance-questions .clpep-question {
    margin-bottom: 16px;
}

.clpep-compliance-questions .clpep-question:last-child {
    margin-bottom: 0;
}

.clpep-compliance-questions p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
}

.clpep-compliance-questions .clpep-radio-group {
    display: flex;
    gap: 16px;
}

.clpep-compliance-questions .clpep-radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.clpep-compliance-questions input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.clpep-compliance-questions label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    margin: 0;
}
/* Add proper checked state styling for radio buttons */
.clpep-compliance-questions input[type="radio"]:checked {
    accent-color: #007cba;
}

/* Ensure radio buttons are properly visible when checked */
.clpep-compliance-questions input[type="radio"]:checked::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007cba;
    margin: 3px;
}

/* Focus state for accessibility */
.clpep-compliance-questions input[type="radio"]:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}