/**
 * MCS Enhanced Product Addons - Frontend Styles
 *
 * Theme-adaptive styling with dark theme support
 */

/* Container - transparent to blend with theme */
.mcs-epa-product-addons {
    margin: 20px 0;
    padding: 0;
    background: transparent;
    border: none;
}

.mcs-epa-product-addons h3 {
    margin: 0 0 20px 0;
    padding: 0;
    border: none;
    font-size: 1.2em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: inherit;
}

/* Individual option groups */
.mcs-epa-option-group {
    margin-bottom: 24px;
}

.mcs-epa-option-group:last-of-type {
    margin-bottom: 20px;
}

.mcs-epa-option-group > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: inherit;
    opacity: 0.9;
}

/* Dropdown styles - dark theme compatible */
.mcs-epa-dropdown {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.mcs-epa-dropdown:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.mcs-epa-dropdown:focus {
    border-color: #b1d698;
    outline: none;
    box-shadow: 0 0 0 2px rgba(177, 214, 152, 0.25);
}

.mcs-epa-dropdown option {
    background: #313131;
    color: #e0e0e0;
    padding: 10px;
}

/* Checkbox/multiselect styles */
.mcs-epa-checkboxes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mcs-epa-checkbox-item {
    margin-bottom: 12px;
}

.mcs-epa-checkbox-item:last-child {
    margin-bottom: 0;
}

.mcs-epa-checkbox-item label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

.mcs-epa-checkbox-item label:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.mcs-epa-checkbox-item input:checked + .mcs-epa-choice-label,
.mcs-epa-checkbox-item input:checked ~ .mcs-epa-price-modifier {
    color: #b1d698;
}

.mcs-epa-checkbox-item label:has(input:checked) {
    border-color: #b1d698;
    background: rgba(177, 214, 152, 0.1);
}

/* Custom checkbox */
.mcs-epa-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-right: 12px;
    cursor: pointer;
    position: relative;
    background: transparent;
    transition: all 0.2s ease;
}

.mcs-epa-checkbox:checked {
    background: #b1d698;
    border-color: #b1d698;
}

.mcs-epa-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #313131;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mcs-epa-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(177, 214, 152, 0.3);
}

.mcs-epa-choice-label {
    flex: 1;
    font-size: 15px;
}

.mcs-epa-price-modifier {
    color: #b1d698;
    font-size: 0.9em;
    margin-left: 8px;
    font-weight: 500;
}

/* Dynamic price display */
.mcs-epa-dynamic-price {
    margin-top: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.mcs-epa-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mcs-epa-price-row:last-child {
    margin-bottom: 0;
}

.mcs-epa-price-label {
    color: inherit;
    opacity: 0.7;
    font-size: 0.9em;
}

.mcs-epa-price-value {
    font-weight: 600;
    color: inherit;
}

.mcs-epa-addon-summary {
    display: none;
}

.mcs-epa-addon-summary .mcs-epa-addon-amount {
    color: #b1d698;
}

.mcs-epa-total-price {
    font-size: 1.15em;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mcs-epa-total-price .mcs-epa-price-label {
    opacity: 1;
    font-weight: 500;
}

.mcs-epa-total-price .mcs-epa-price-value {
    color: #b1d698;
    font-size: 1.1em;
}

/* WooCommerce price styling override */
.mcs-epa-dynamic-price .woocommerce-Price-amount {
    color: inherit;
}

.mcs-epa-total-price .woocommerce-Price-amount {
    color: #b1d698;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .mcs-epa-dropdown {
        padding: 16px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .mcs-epa-checkbox-item label {
        padding: 14px;
    }

    .mcs-epa-checkbox {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }

    .mcs-epa-checkbox:checked::after {
        left: 6px;
        top: 2px;
        width: 6px;
        height: 12px;
    }
}

/* Light theme fallback - for sites with light backgrounds */
@media (prefers-color-scheme: light) {
    .mcs-epa-dropdown {
        border-color: rgba(0, 0, 0, 0.15);
        background: rgba(0, 0, 0, 0.02);
    }

    .mcs-epa-dropdown:hover {
        border-color: rgba(0, 0, 0, 0.25);
        background: rgba(0, 0, 0, 0.04);
    }

    .mcs-epa-dropdown option {
        background: #fff;
        color: #333;
    }

    .mcs-epa-checkbox-item label {
        border-color: rgba(0, 0, 0, 0.12);
        background: rgba(0, 0, 0, 0.02);
    }

    .mcs-epa-checkbox-item label:hover {
        border-color: rgba(0, 0, 0, 0.2);
        background: rgba(0, 0, 0, 0.04);
    }

    .mcs-epa-checkbox {
        border-color: rgba(0, 0, 0, 0.25);
    }

    .mcs-epa-dynamic-price {
        background: rgba(0, 0, 0, 0.02);
        border-color: rgba(0, 0, 0, 0.1);
    }

    .mcs-epa-total-price {
        border-top-color: rgba(0, 0, 0, 0.1);
    }

    .mcs-epa-price-modifier {
        color: #2e7d32;
    }

    .mcs-epa-total-price .mcs-epa-price-value,
    .mcs-epa-total-price .woocommerce-Price-amount {
        color: #2e7d32;
    }
}
