/**
 * Frontend styles for Product Multi Options
 */

/* Theme accent color - inherits from theme CSS variables */
.pmo-product-addons {
    --pmo-accent-color: var(--color-accent, #C1853E);
}

/* Main container */
.pmo-product-addons {
    margin: 20px 0;
    padding: 0;
}

/* Select variation notice */
.pmo-select-variation-notice {
    padding: 12px 15px;
    background: #f8f8f8;
    border-left: 4px solid var(--pmo-accent-color);
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
}

/* Addon group */
.pmo-addon-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.pmo-addon-group:last-child {
    border-bottom: none;
    margin-bottom: 15px;
}

/* Group header */
.pmo-group-header {
    margin-bottom: 15px;
}

.pmo-group-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
}

.pmo-group-description {
    font-size: 13px;
    color: #666;
    margin: 0 0 5px 0;
}

.pmo-group-limits {
    font-size: 12px;
    color: #888;
    margin: 0;
    font-style: italic;
}

/* Options grid */
.pmo-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

/* Option item */
.pmo-option-item {
    position: relative;
    cursor: pointer;
    display: block;
}

.pmo-option-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pmo-option-content {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f5f5f5;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
    overflow: hidden;
}

.pmo-option-item:hover .pmo-option-content {
    border-color: #999;
}

.pmo-option-item input:checked + .pmo-option-content {
    border-color: var(--pmo-accent-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--pmo-accent-color) 30%, transparent);
}

.pmo-option-item input:disabled + .pmo-option-content {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Option image - full size background */
.pmo-option-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.pmo-option-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pmo-option-item:hover .pmo-option-image img {
    transform: scale(1.05);
}

/* Option info - overlay at bottom with blur */
.pmo-option-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.5) 60%, rgba(0, 0, 0, 0) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
}

/* When no image, adjust info styling */
.pmo-no-image .pmo-option-info {
    position: relative;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 15px 10px;
    height: 100%;
    justify-content: center;
}

.pmo-no-image .pmo-option-label {
    color: #333;
    text-shadow: none;
}

.pmo-no-image .pmo-option-price {
    color: var(--pmo-accent-color);
    text-shadow: none;
}

.pmo-option-label {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.pmo-option-price {
    font-size: 12px;
    color: var(--pmo-accent-color);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Checkmark */
.pmo-option-checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 50%;
    background: #fff;
    transition: all 0.2s ease;
    z-index: 3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pmo-option-item input:checked + .pmo-option-content .pmo-option-checkmark {
    background: var(--pmo-accent-color);
    border-color: var(--pmo-accent-color);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--pmo-accent-color) 30%, transparent);
}

.pmo-option-item input:checked + .pmo-option-content .pmo-option-checkmark::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Addons total */
.pmo-addons-total {
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 14px;
}

.pmo-addons-total strong {
    margin-right: 10px;
}

.pmo-total-price {
    color: var(--pmo-accent-color);
    font-weight: 600;
}

/* Validation error */
.pmo-addon-group.pmo-error .pmo-group-header {
    color: #dc3232;
}

.pmo-addon-group.pmo-error .pmo-option-content {
    border-color: #dc3232;
}

/* Disabled state when max reached */
.pmo-option-item.pmo-disabled:not(.pmo-selected) .pmo-option-content {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media screen and (max-width: 480px) {
    .pmo-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .pmo-option-content {
        min-height: 100px;
    }

    .pmo-option-label {
        font-size: 11px;
    }

    .pmo-option-price {
        font-size: 10px;
    }

    .pmo-option-checkmark {
        width: 20px;
        height: 20px;
        top: 6px;
        right: 6px;
    }

    .pmo-option-item input:checked + .pmo-option-content .pmo-option-checkmark::after {
        top: 3px;
        left: 6px;
        width: 4px;
        height: 8px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .pmo-option-content {
        background: #2c2c2c;
        border-color: #444;
    }

    .pmo-option-item:hover .pmo-option-content {
        border-color: #666;
    }

    .pmo-option-item input:checked + .pmo-option-content {
        background: #1a3a4a;
    }

    .pmo-option-label {
        color: #eee;
    }

    .pmo-group-title {
        color: #eee;
    }

    .pmo-addons-total {
        background: #333;
    }
}