/* Variation Modal Styles */
.variation-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.variation-modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.variation-modal {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.variation-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.variation-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.variation-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.variation-modal-close:hover {
    color: #333;
}

.variation-modal-body {
    padding: 20px;
}

/* Product Info */
.variation-product-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.variation-product-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.variation-product-row:last-child {
    margin-bottom: 0;
}

.variation-product-label {
    color: #666;
    font-size: 14px;
}

.variation-product-value {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.variation-product-price {
    color: #0096c8;
    font-size: 16px;
    font-weight: 600;
}

/* Variation Sections */
.variation-section {
    margin-bottom: 20px;
}

.variation-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.variation-required {
    color: #e74c3c;
}

/* Color Options */
.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option:hover .color-box {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-option.selected .color-box {
    box-shadow: 0 0 0 3px #0096c8;
}

.color-box {
    width: 65px !important;
    height: 65px !important;
    border-radius: 8px;
    overflow: hidden !important;
    display: block !important;
    background: #fff;
    border: 1px solid #e8e8e8;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s ease;
}

.color-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

.color-fallback {
    background: #f0f0f0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    font-weight: 600;
}

.color-name {
    font-size: 12px;
    color: #666;
    text-align: center;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

/* Size Options */
.size-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.size-option {
    padding: 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.size-option:hover {
    border-color: #0096c8;
}

.size-option.selected {
    border-color: #0096c8;
    background: #f0f8ff;
    color: #0096c8;
}

/* Error Container */
.variation-error {
    background: #fee;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
}

.variation-error i {
    margin-right: 8px;
}

/* Footer */
.variation-modal-footer {
    padding: 20px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
}

.variation-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.variation-btn-cancel {
    background: #f8f9fa;
    color: #666;
}

.variation-btn-cancel:hover {
    background: #e9ecef;
}

.variation-btn-add {
    background: linear-gradient(135deg, #00bcd4 0%, #0096c8 100%);
    color: white;
}

.variation-btn-add:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.variation-btn-add:hover:not(:disabled) {
    background: linear-gradient(135deg, #00b0bf 0%, #007ba0 100%);
    box-shadow: 0 4px 12px rgba(0, 150, 200, 0.3);
}

.variation-btn-add.loading {
    position: relative;
    color: transparent;
}

.variation-btn-add.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .variation-modal {
        width: 95%;
        max-height: 95vh;
    }

    .variation-modal-body {
        padding: 15px;
    }

    .variation-modal-footer {
        padding: 15px;
    }
    
    .color-options {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .size-options {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
}
