/**
 * Food Store Modern Add-ons
 * Enhances the appearance of add-ons in the Food Store plugin
 */

/* Required Badge Styling */
.wfs-addon-category-title.wfs-required-addon .wfs-required-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #2ecc71;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* Hide original asterisk */
.wfs-addon-category-title.wfs-required-addon .wfs-required-indicator {
    display: none;
}

/* Add-on Group Header Styling */
.wfs-addon-category-title {
    font-size: 1.35em;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
    margin-left: -20px; /* Align titles with the left edge */
}

/* Add-on Card Layout */
.wfs-addon-category {
    margin-bottom: 10px;
    transition: all 0.2s ease;
    padding-left: 20px; /* Add indentation to options */
    padding-right: 20px; /* Equal spacing on the right side */
    width: calc(100% - 40px); /* Adjust width to account for padding */
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.wfs-addon-category label {
    display: flex;
    align-items: center;
    font-size: 0; /* Prevent spacing artifacts */
    padding: 12px 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.2;
}

.wfs-addon-category label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #bbb;
}

/* Custom Checkbox & Radio Styling */
.wfs-addon-category input[type="checkbox"],
.wfs-addon-category input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin-right: 20px;
    width: 20px;
    height: 20px;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    background-color: transparent;
    padding: 0;
    line-height: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Outer Circle / Box */
.wfs-addon-category input[type="checkbox"]::before,
.wfs-addon-category input[type="radio"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    background-color: white;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Radio is circle */
.wfs-addon-category input[type="radio"]::before {
    border-radius: 50%;
}

/* Checkbox is square */
.wfs-addon-category input[type="checkbox"]::before {
    border-radius: 3px;
}

/* Hover State */
.wfs-addon-category input[type="checkbox"]:hover::before,
.wfs-addon-category input[type="radio"]:hover::before {
    border-color: #aaa;
}

/* Checked - Green Background */
.wfs-addon-category input[type="radio"]:checked::before,
.wfs-addon-category input[type="checkbox"]:checked::before {
    border-color: #2ecc71;
    background-color: #2ecc71;
}

/* Checkmark Symbol */
.wfs-addon-category input[type="checkbox"]:checked::after,
.wfs-addon-category input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 45%;
    left: 70%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 4px 4px 0;
    animation: checkboxCheck 0.2s ease forwards;
}

/* Checkmark Animation */
@keyframes checkboxCheck {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(0); }
    50% { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1.2); }
    100% { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1); }
}

/* Accessibility Focus */
.wfs-addon-category input[type="checkbox"]:focus::before,
.wfs-addon-category input[type="radio"]:focus::before {
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.3);
}

/* Add-on Label Text */
.wfs-addon-category label span {
    font-size: 16px;
    flex-grow: 1;
    font-weight: 500;
    vertical-align: middle;
    display: inline-block;
    line-height: 1.2;
}

/* Price Styling */
.wfs-addon-category > span {
    display: inline-block;
    font-weight: 600;
    color: #666;
    margin-left: 10px;
}

/* Selected State */
.wfs-addon-category.selected label {
    background-color: #f8fff8;
    border-color: #2ecc71;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.2);
}

/* Selection Animation */
@keyframes checkmark-animation {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.wfs-addon-category input:checked::before {
    animation: checkmark-animation 0.3s ease forwards;
}

/* Mobile Responsive Adjustments */
@media (max-width: 767px) {
    .wfs-addon-category {
        margin-bottom: 8px;
        padding-left: 15px; /* Slightly less indentation on mobile */
        padding-right: 15px; /* Equal spacing on the right side */
        width: calc(100% - 30px); /* Adjust width to account for padding */
    }
    
    .wfs-addon-category label {
        padding: 10px 12px;
    }
    
    .wfs-addon-category-title {
        font-size: 1.2em;
        font-weight: 700;
        margin-bottom: 14px;
        padding-bottom: 8px;
        margin-left: -15px; /* Match the mobile indentation */
        width: calc(100% + 15px); /* Ensure title spans full width */
    }
    
    .wfs-addons-element-block {
        margin-bottom: 20px;
    }
}
