/**
 * Configurable Products Styles
 * Professional styling for progressive selection with dependencies
 */

/* ========== Configurable Options Container ========== */
.tf-product-info-configurable-options {
    margin-bottom: 25px;
}

/* ========== Option Item ========== */
.configurable-option-item {
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.configurable-option-item.option-hidden {
    display: none;
    opacity: 0;
}

.configurable-option-item.option-visible {
    display: block;
    opacity: 1;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Option Label ========== */
.configurable-option-label {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.configurable-option-label span[style*="color: #e63946"] {
    color: #e63946;
    font-weight: bold;
}

.configurable-option-label-value {
    color: #666;
    font-weight: 500;
}

.configurable-option-description {
    font-size: 13px;
    color: #777;
    margin-bottom: 10px;
    font-style: italic;
}

/* ========== Dropdown Select ========== */
.configurable-select {
    width: 100%;
    padding: 10px 15px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
}

.configurable-select:hover {
    border-color: #999;
}

.configurable-select:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.configurable-select option:disabled {
    color: #ccc;
}

/* ========== Swatch Container (Colors/Images) ========== */
.swatch-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.configurable-swatch-btn {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.configurable-swatch-btn .btn-checkbox {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background-size: cover;
    background-position: center;
}

.configurable-swatch-btn .btn-checkbox.swatch-image {
    border-radius: 4px;
}

.configurable-swatch-btn:hover .btn-checkbox {
    border-color: #333;
    transform: scale(1.1);
}

.configurable-option-item input[type="radio"]:checked + .configurable-swatch-btn .btn-checkbox {
    border-color: #1a1a1a;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.15);
}

.configurable-option-item input[type="radio"]:disabled + .configurable-swatch-btn {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tooltip */
.configurable-swatch-btn .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.configurable-swatch-btn .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.configurable-swatch-btn:hover .tooltip {
    opacity: 1;
}

/* ========== Button Container ========== */
.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.configurable-button-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    text-align: center;
}

.configurable-button-btn p {
    margin: 0;
    line-height: 1.2;
}

.configurable-button-btn small {
    display: block;
    font-size: 11px;
    margin-top: 4px;
    color: #666;
}

.configurable-button-btn:hover {
    border-color: #999;
    background-color: #f9f9f9;
}

.configurable-option-item input[type="radio"]:checked + .configurable-button-btn {
    border-color: #1a1a1a;
    background-color: #1a1a1a;
    color: #fff;
}

.configurable-option-item input[type="radio"]:checked + .configurable-button-btn small {
    color: rgba(255, 255, 255, 0.8);
}

.configurable-option-item input[type="radio"]:disabled + .configurable-button-btn {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========== Radio Container (Default) ========== */
.radio-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.radio-item:hover {
    border-color: #999;
    background-color: #f9f9f9;
}

.radio-item input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.radio-item input[type="radio"]:checked {
    accent-color: #1a1a1a;
}

.radio-item label {
    flex: 1;
    margin: 0 0 0 12px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
}

.radio-item input[type="radio"]:checked ~ label {
    font-weight: 600;
}

.radio-item input[type="radio"]:disabled ~ label {
    color: #ccc;
    cursor: not-allowed;
}

/* ========== Hidden Radio Inputs ========== */
.configurable-option-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ========== Disabled States ========== */
.option-value-disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(100%);
}

/* ========== Price Highlight ========== */
.configurable-option-values [data-price-adjustment]:not([data-price-adjustment="0"])::after {
    content: '';
}

/* Positive price adjustment indicator */
label[data-price-adjustment] {
    position: relative;
}

/* ========== Loading State ========== */
.configurable-option-item.loading {
    pointer-events: none;
    opacity: 0.6;
}

.configurable-option-item.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 #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .configurable-option-label {
        font-size: 14px;
    }

    .configurable-swatch-btn .btn-checkbox {
        width: 35px;
        height: 35px;
    }

    .configurable-button-btn {
        padding: 8px 16px;
        font-size: 14px;
        min-width: 70px;
    }

    .swatch-container,
    .button-container {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .configurable-option-label {
        font-size: 13px;
        flex-direction: column;
        align-items: flex-start;
    }

    .configurable-swatch-btn .btn-checkbox {
        width: 32px;
        height: 32px;
    }

    .configurable-button-btn {
        width: 100%;
        min-width: auto;
    }
}

/* ========== Accessibility ========== */
.configurable-option-item input[type="radio"]:focus + label {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========== Hidden SKU Input ========== */
#configurable-final-sku {
    display: none;
}
