/* Enhanced Product Attributes & Weight Options Styling */

/* Import Arabic Font */
@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap");

/* Arabic Font Support */
.product-attributes-container,
.weight-options-container,
.attribute-option-box,
.weight-option-box,
.attribute-label,
.attribute-value,
.weight-value,
.weight-price,
.weight-tooltip {
    font-family: "Tajawal", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
}

/* RTL Support for Arabic */
[dir="rtl"] .product-attributes-container,
[dir="rtl"] .weight-options-container {
    direction: rtl;
}

[dir="rtl"] .attribute-option-box,
[dir="rtl"] .weight-option-box {
    text-align: center;
}

[dir="rtl"] .weight-tooltip {
    font-family: "Tajawal", sans-serif;
    direction: rtl;
}

/* Product Attributes Container */
.product-attributes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    padding: 8px 0;
}

/* Attribute Option Labels */
.attribute-option-label {
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    overflow: hidden;
}

.attribute-option-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

/* Attribute Option Box */
.attribute-option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 80px;
    min-height: 60px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.attribute-label {
    font-size: 10px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.attribute-value {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    transition: color 0.3s ease;
    text-align: center;
}

/* Hover Effects for Attributes */
.attribute-option-label:hover .attribute-option-box {
    border-color: #007bff;
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.15);
}

.attribute-option-label:hover .attribute-label {
    color: #007bff;
}

.attribute-option-label:hover .attribute-value {
    color: #007bff;
}

/* Selected State for Attributes */
.attribute-option-label.selected .attribute-option-box {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}

.attribute-option-label.selected .attribute-label,
.attribute-option-label.selected .attribute-value {
    color: white;
}

.attribute-option-label.selected .attribute-option-box::after {
    content: "✓";
    position: absolute;
    top: 4px;
    right: 6px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Weight Options Container */
.weight-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    padding: 8px 0;
}

/* Weight Option Labels */
.weight-option-label {
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    overflow: hidden;
}

.weight-option-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

/* Weight Option Box */
.weight-option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 90px;
    min-height: 70px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.weight-value {
    font-size: 16px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

.weight-price {
    font-size: 12px;
    color: #28a745;
    font-weight: 600;
    background: rgba(40, 167, 69, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

/* Hover Effects for Weight Options */
.weight-option-label:hover .weight-option-box {
    border-color: #28a745;
    background: linear-gradient(145deg, #f0fff4, #e8f5e8);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.15);
}

.weight-option-label:hover .weight-value {
    color: #28a745;
}

.weight-option-label:hover .weight-price {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.3);
}

/* Selected State for Weight Options */
.weight-option-label.selected .weight-option-box {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.3);
}

.weight-option-label.selected .weight-value {
    color: white;
}

.weight-option-label.selected .weight-price {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.weight-option-label.selected .weight-option-box::after {
    content: "✓";
    position: absolute;
    top: 6px;
    right: 8px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading States */
.weight-options-container.weight-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.weight-options-container.weight-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.weight-options-container.weight-loading .weight-option-box {
    animation: pulse 1.5s ease-in-out infinite;
}

.current-price.price-updating {
    opacity: 0.6;
    animation: pulse 1.5s ease-in-out infinite;
    position: relative;
}

.current-price.price-updating::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -30px;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 0;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

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

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

/* Tooltip Styling */
.weight-tooltip {
    animation: fadeInUp 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
}

/* Focus States for Accessibility */
.attribute-option-label input[type="radio"]:focus + .attribute-option-box,
.weight-option-label input[type="radio"]:focus + .weight-option-box {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-attributes-container,
    .weight-options-container {
        gap: 8px;
    }

    .attribute-option-box {
        padding: 10px 12px;
        min-width: 70px;
        min-height: 50px;
    }

    .weight-option-box {
        padding: 12px 16px;
        min-width: 80px;
        min-height: 60px;
    }

    .weight-value {
        font-size: 14px;
    }

    .weight-price {
        font-size: 11px;
        padding: 2px 6px;
    }

    .attribute-value {
        font-size: 13px;
    }

    .attribute-label {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .product-attributes-container,
    .weight-options-container {
        gap: 6px;
    }

    .attribute-option-box,
    .weight-option-box {
        padding: 8px 10px;
        min-width: 60px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .attribute-option-box,
    .weight-option-box {
        background: linear-gradient(145deg, #2d3748, #1a202c);
        border-color: #4a5568;
        color: #e2e8f0;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .attribute-label,
    .attribute-value,
    .weight-value {
        color: #e2e8f0;
    }

    .weight-price {
        background: rgba(72, 187, 120, 0.2);
        color: #68d391;
        border-color: rgba(72, 187, 120, 0.3);
    }

    .attribute-option-label:hover .attribute-option-box,
    .weight-option-label:hover .weight-option-box {
        background: linear-gradient(145deg, #4a5568, #2d3748);
        border-color: #63b3ed;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .attribute-option-box,
    .weight-option-box {
        border-width: 3px;
    }

    .attribute-option-label.selected .attribute-option-box,
    .weight-option-label.selected .weight-option-box {
        border-width: 4px;
    }
}
