/**
 * Copyright © KW. All rights reserved.
 * See COPYING.txt for license details.
 */

/* Customizable Options Enhanced Styling */

.customizable-options-enhanced {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.customizable-options-title {
    margin-bottom: 15px;
}

.customizable-options-title h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.customizable-option-section {
    margin-bottom: 20px;
}

.customizable-option-section.required .customizable-option-label-text::after {
    content: "";
}

.customizable-option-label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.customizable-option-label-text {
    font-size: 14px;
    margin-right: 5px;
}

.customizable-option-label .required {
    color: #e02b27;
    font-size: 16px;
    font-weight: bold;
}

.customizable-options-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

/* Mobile responsive - 2 columns like desktop */
@media (max-width: 767px) {
    .customizable-options-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* Tablet responsive */
@media (min-width: 768px) and (max-width: 1024px) {
    .customizable-options-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Desktop responsive */
@media (min-width: 1025px) {
    .customizable-options-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Customizable Option Buttons - Red color scheme */
.customizable-option-button {
    /* Inherit all styles from configurable-option-button */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 2px solid #A91D3A !important;
    border-radius: 6px;
    background-color: #fff !important;
    color: #333 !important;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
}

/* Desktop: keep price on same line */
@media (min-width: 768px) {
    .customizable-option-button {
        flex-direction: row;
        align-items: center;
    }
}

/* Mobile: stack text and price vertically for equal button widths */
@media (max-width: 767px) {
    .customizable-option-button {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        min-height: 60px;
        padding: 10px 12px;
    }
    
    .customizable-option-button .option-text {
        width: 100%;
        margin-bottom: 4px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .customizable-option-button .option-price {
        width: 100%;
        text-align: left;
        margin-left: 0;
        font-size: 13px;
    }
}

.customizable-option-button:hover {
    border-color: #8B1730 !important;
    background-color: #FFF5F7 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(169, 29, 58, 0.2) !important;
}

.customizable-option-button:focus {
    outline: none;
    border-color: #A91D3A !important;
    box-shadow: 0 0 0 3px rgba(169, 29, 58, 0.25) !important;
}

.customizable-option-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(169, 29, 58, 0.2) !important;
}

.customizable-option-button.selected {
    border-color: #A91D3A !important;
    background-color: #A91D3A !important;
    color: #fff !important;
}

.customizable-option-button.selected:hover {
    background-color: #8B1730 !important;
    border-color: #8B1730 !important;
}

.customizable-option-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5 !important;
    color: #999 !important;
    border-color: #ddd !important;
}

.customizable-option-button:disabled:hover {
    transform: none;
    box-shadow: none !important;
}

/* Option text and price layout */
.customizable-option-button .option-text {
    flex: 1;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.customizable-option-button .option-price {
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    opacity: 0.8;
    white-space: nowrap;
}

.customizable-option-button.selected .option-price {
    opacity: 1;
}

/* Multi-select specific styling */
.customizable-option-button.multi-select.selected {
    background-color: #28a745;
    border-color: #28a745;
}

.customizable-option-button.multi-select.selected:hover {
    background-color: #218838;
    border-color: #218838;
}

/* Selected values display */
.customizable-option-selected-values {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    min-height: 16px;
}

.customizable-option-selected-values:not(:empty) {
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.customizable-option-selected-values .selected-value {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 4px;
    padding: 2px 8px;
    background-color: #A91D3A !important;
    color: #fff !important;
    border-radius: 12px;
    font-size: 11px;
}

/* Error states */
.customizable-option-section.has-error .customizable-option-label {
    color: #e02b27;
}

.customizable-option-section.has-error .customizable-options-container {
    border: 1px solid #e02b27;
    border-radius: 4px;
    padding: 8px;
    background-color: #fdf2f2;
}

.customizable-option-error-message {
    color: #e02b27;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.customizable-option-section.has-error .customizable-option-error-message {
    display: block;
}

/* Loading states */
.customizable-options-enhanced.loading {
    opacity: 0.6;
    pointer-events: none;
}

.customizable-options-enhanced.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #A91D3A !important;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Integration with existing configurable options */
.configurable-options-enhanced + .customizable-options-enhanced {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

/* Ensure consistent spacing */
.product-options-wrapper .customizable-options-enhanced {
    margin-top: 20px;
}

/* Print styles */
@media print {
    .customizable-options-enhanced {
        break-inside: avoid;
    }
    
    .customizable-option-button {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
    
    .customizable-option-button.selected {
        background: #000 !important;
        color: #fff !important;
    }
}